当前位置:网站首页>ANOVA example
ANOVA example
2022-07-03 16:52:00 【Changsha has fat fish】
One way ANOVA
# Sipping, sipping, sipping 3 Different user ratings in different cities from scipy.stats import f_oneway a = [10,9,9,8,8,7,7,8,8,9] b = [10,8,9,8,7,7,7,8,9,9] c = [9,9,8,8,8,7,6,9,8,9] f,p = f_oneway(a,b,c) print (f)
0.101503759398 0.903820890369
among p The value is 0.903820890369
It cannot be considered that the factors tested have a significant impact on the observed value
Multivariate analysis of variance
# # Sipping, sipping, sipping 2 One factor : Environmental grade , Food grade from scipy import stats import pandas as pd import numpy as np from statsmodels.formula.api import ols from statsmodels.stats.anova import anova_lm environmental = [5,5,5,5,5,4,4,4,4,4,3,3,3,3,3,2,2,2,2,2,1,1,1,1,1] ingredients = [5,4,3,2,1,5,4,3,2,1,5,4,3,2,1,5,4,3,2,1,5,4,3,2,1] score = [5,5,4,3,2,5,4,4,3,2,4,4,3,3,2,4,3,2,2,2,3,3,3,2,1] data = {'E':environmental, 'I':ingredients, 'S':score} df = pd.DataFrame(data) df.head()
Symbolic meaning :
- (~) Isolate dependent and independent variables ( Left dependent variable , Right argument )
- (+) Separate the arguments
- (:) Indicates the interaction of two independent variables
formula = 'S~E+I+E:I' model = ols(formula,df).fit() results = anova_lm(model) print (results)
df sum_sq mean_sq F PR(>F) E 1.0 7.22 7.220000 54.539568 2.896351e-07 I 1.0 18.00 18.000000 135.971223 1.233581e-10 E:I 1.0 0.64 0.640000 4.834532 3.924030e-02 Residual 21.0 2.78 0.132381 NaN NaN
explain : E Of F value 2.896351e-07,I Of F value 1.233581e-10 Very small ,E and I Have a significant impact on the results , There is no interaction
边栏推荐
- 数据分析必备的能力
- [combinatorics] recursive equation (example 1 of recursive equation | list recursive equation)
- [JDBC] API parsing
- 美团一面:为什么线程崩溃崩溃不会导致 JVM 崩溃
- Processing strategy of message queue message loss and repeated message sending
- Difference between JSON and bson
- word 退格键删除不了选中文本,只能按delete
- 消息队列消息丢失和消息重复发送的处理策略
- To resist 7-Zip, list "three sins"? Netizen: "is the third key?"
- Necessary ability of data analysis
猜你喜欢
Network security web penetration technology
Basis of target detection (IOU)
关于视觉SLAM的最先进技术的调查-A survey of state-of-the-art on visual SLAM
Mysql database DDL and DML
Fast Ethernet and Gigabit Ethernet: what's the difference?
Aike AI frontier promotion (7.3)
CC2530 common registers for serial communication
Idea configuration plug-in
爱可可AI前沿推介(7.3)
Shentong express expects an annual loss of nearly 1billion
随机推荐
[Jianzhi offer] 57 - ii Continuous positive sequence with sum s
Using optimistic lock and pessimistic lock in MySQL to realize distributed lock
LeetCode 1657. Determine whether the two strings are close
Top k questions of interview
Interpretation of several important concepts of satellite antenna
执行脚本不认\r
Svn usage specification
Thread pool executes scheduled tasks
什么是质押池,如何进行质押呢?
To resist 7-Zip, list "three sins"? Netizen: "is the third key?"
What material is sa537cl2 equivalent to in China? Sa537cl2 corresponding material
Bcvp developer community 2022 exclusive peripheral first bullet
How to allow remote connection to MySQL server on Linux system?
Processing strategy of message queue message loss and repeated message sending
What is the maximum number of concurrent TCP connections for a server? 65535?
关于学习Qt编程的好书精品推荐
Deep understanding of grouping sets statements in SQL
PHP secondary domain name session sharing scheme
New features of C 10
【剑指 Offer】58 - I. 翻转单词顺序