Created
April 25, 2017 15:31
-
-
Save naomispence/b25f04865dcd49671d7159c782a0b574 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
#Look at the mean of an interval variable | |
mean(GSS$childs, na.rm=TRUE) | |
# This is a generalized linear model of an interval variable with just an intercept, no independent variable | |
results<-glm(GSS$childs~1, data=GSS) | |
summary(results) | |
# This is a generalized linear model of an interval variable with an intercept and an independent variable | |
results<-glm(GSS$childs~age, data=GSS) | |
summary(results) | |
#The line below gives us a scatterplot with a "best fitting line" through it. SEE IF YOU CAN ADD TITLE AND LABELS. | |
ggplot(GSS, aes(age, childs)) + geom_point() + stat_smooth(method="lm") | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment