search for: mom_h

Displaying 2 results from an estimated 2 matches for "mom_h".

Did you mean: mom_hs
2012 Jan 13
1
loops over regression models
...uite a while, and I know I can use foreach to build a loop to condense the codes (especially if I have a large number of models to run). In Stata, it would be something like: **************************************************** // read in data use kidiq, clear // run two regression reg kid_score mom_hs reg kid_score mom_iq // the next three lines are equivalent of the previous two lines foreach var in mom_hs mom_iq { reg kid_score `var' } *************************************************** So I want to figure out how to use R to do this. Below are my codes: #############################...
2011 Nov 10
2
plotting a function with given formula in ggplot2
...tion (something that curve() does in the standard R plotting). I did some search and found that stat_function() can be used for this. But somehow it is not working. The following is my code. Can you please tell me where I am going wrong and what the correct code would be: reg1 <- lm(kid_score ~ mom_hs, data=iqdata) scatter <- ggplot() + geom_point(data=iqdata, aes(x=as.factor(mom_hs), y=kid_score) ) + xlab("Mother's High School Status") + ylab("Children's Test Score")...