- FLOWERS = SEX (ANOVA)
- GPA = IQ (regression)
- But both are RESPONSE (dependent) VARIABLE = EXPLANATORY (independent) VARIABLE
- Only difference is SEX is categorical and IQ is continous
12/1/2021
anova(lm(FLOWERS~SEX, data = dioecious))
## Analysis of Variance Table ## ## Response: FLOWERS ## Df Sum Sq Mean Sq F value Pr(>F) ## SEX 1 171841 171841 1.1754 0.2837 ## Residuals 48 7017255 146193
summary(lm(gpa~iq, data = gpa_iq))
## ## Call: ## lm(formula = gpa ~ iq, data = gpa_iq) ## ## Residuals: ## Min 1Q Median 3Q Max ## -6.3182 -0.5377 0.2178 1.0268 3.5785 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) -3.55706 1.55176 -2.292 0.0247 * ## iq 0.10102 0.01414 7.142 4.74e-10 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 1.635 on 76 degrees of freedom ## Multiple R-squared: 0.4016, Adjusted R-squared: 0.3937 ## F-statistic: 51.01 on 1 and 76 DF, p-value: 4.737e-10
options(contrasts=c('contr.sum','contr.poly')) #Whats' this about summary(lm(FLOWERS~SEX, data = dioecious))
## ## Call: ## lm(formula = FLOWERS ~ SEX, data = dioecious) ## ## Residuals: ## Min 1Q Median 3Q Max ## -430.4 -267.4 -118.5 194.3 1050.6 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 371.53 55.19 6.732 1.89e-08 *** ## SEX1 -59.83 55.19 -1.084 0.284 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 382.4 on 48 degrees of freedom ## Multiple R-squared: 0.0239, Adjusted R-squared: 0.003568 ## F-statistic: 1.175 on 1 and 48 DF, p-value: 0.2837
anova(lm(gpa~iq, data = gpa_iq))
## Analysis of Variance Table ## ## Response: gpa ## Df Sum Sq Mean Sq F value Pr(>F) ## iq 1 136.32 136.319 51.008 4.737e-10 *** ## Residuals 76 203.11 2.672 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
options(contrasts=c('contr.sum','contr.poly')) #Whats' this about summary(lm(FLOWERS~SEX, data = dioecious))
## ## Call: ## lm(formula = FLOWERS ~ SEX, data = dioecious) ## ## Residuals: ## Min 1Q Median 3Q Max ## -430.4 -267.4 -118.5 194.3 1050.6 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 371.53 55.19 6.732 1.89e-08 *** ## SEX1 -59.83 55.19 -1.084 0.284 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 382.4 on 48 degrees of freedom ## Multiple R-squared: 0.0239, Adjusted R-squared: 0.003568 ## F-statistic: 1.175 on 1 and 48 DF, p-value: 0.2837
options(contrasts=c('contr.treatment','contr.poly')) #Whats' this about summary(lm(FLOWERS~SEX, data = dioecious))
## ## Call: ## lm(formula = FLOWERS ~ SEX, data = dioecious) ## ## Residuals: ## Min 1Q Median 3Q Max ## -430.4 -267.4 -118.5 194.3 1050.6 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 311.7 85.5 3.646 0.000655 *** ## SEX2 119.7 110.4 1.084 0.283701 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 382.4 on 48 degrees of freedom ## Multiple R-squared: 0.0239, Adjusted R-squared: 0.003568 ## F-statistic: 1.175 on 1 and 48 DF, p-value: 0.2837