I have to answer the following question for a homework assignment. A researcher was interested in whether people taking part in sports at university made more money after graduating, taking into account the students' GPA. They sampled 200 alumni from a large university. The variables are: income (income 10 years after graduating), sports (1 if they did sports, 0 if they did not), and GPA (the grade point average at university). Discuss the relationship between taking part in sports, GPA, and income for these data. The R code I used so far is Does sports predict GPA?> lm1<-lm(GPA~sports) > summary(lm1)Does sports predict income?> lm2<-lm(income~sports) > summary(lm2)Does GPA predict income?> lm3<-lm(income~GPA) > summary(lm3)Does sports predict income after accounting for GPA?> lm4<-lm(income~GPA+sports) > summary(lm4)Can someone let me know is the above is correct? I am not sure if to keep all four regressions or only 1 and 4. Also, I need to plot the data on a graph or table. Can anyone suggest how to do this? Thank you in advance :) -- View this message in context: http://www.nabble.com/Is-this-correct--tp20654004p20654004.html Sent from the R help mailing list archive at Nabble.com.
R help does have guidelines. (See the bottom of any message to R help, including yours.) Here is a relevant extract from them: "Basic statistics and classroom homework: R-help is not intended for these." Your questions are entirely inappropriate. It would also be courteous if we knew your name and not just an alias. Bill Venables http://www.cmis.csiro.au/bill.venables/ -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Rlover Sent: Monday, 24 November 2008 12:46 PM To: r-help at r-project.org Subject: [R] Is this correct? I have to answer the following question for a homework assignment. A researcher was interested in whether people taking part in sports at university made more money after graduating, taking into account the students' GPA. They sampled 200 alumni from a large university. The variables are: income (income 10 years after graduating), sports (1 if they did sports, 0 if they did not), and GPA (the grade point average at university). Discuss the relationship between taking part in sports, GPA, and income for these data. The R code I used so far is Does sports predict GPA?> lm1<-lm(GPA~sports) > summary(lm1)Does sports predict income?> lm2<-lm(income~sports) > summary(lm2)Does GPA predict income?> lm3<-lm(income~GPA) > summary(lm3)Does sports predict income after accounting for GPA?> lm4<-lm(income~GPA+sports) > summary(lm4)Can someone let me know is the above is correct? I am not sure if to keep all four regressions or only 1 and 4. Also, I need to plot the data on a graph or table. Can anyone suggest how to do this? Thank you in advance :) -- View this message in context: http://www.nabble.com/Is-this-correct--tp20654004p20654004.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Bill is right. Generally, a more appropriate type of question to the list would, for example, be: I want to run OLS. What is the function to do it in R (although this is a particularly stupid example as it is on the first pages of almost all manuals)? You would typically write to the R list if you want to get a certain thing done and can't get it done (assuming that it is not homework!). The main difference to your question being that you already know what the "thing" is (which, in your case, is your modeling question). Therefore your question is generally not one that anybody here should answer. You as the researcher determine which relationships are of interest and which make sense. You should consult the tutor/TA of your class if you have any questions what the relationships of interest are. S/he is getting paid to help you. Go there and say: Here are my ideas...what do you think? Second, if you are required to do this in R, they should give you materials to learn R from, respectively they should teach you R. Further, there are numerous sources/manuals out there from which to learn the basics of R. And they are free as R is. Just google them. Cheers, Daniel ------------------------- cuncta stricte discussurus ------------------------- -----Urspr?ngliche Nachricht----- Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im Auftrag von Rlover Gesendet: Sunday, November 23, 2008 9:46 PM An: r-help at r-project.org Betreff: [R] Is this correct? I have to answer the following question for a homework assignment. A researcher was interested in whether people taking part in sports at university made more money after graduating, taking into account the students' GPA. They sampled 200 alumni from a large university. The variables are: income (income 10 years after graduating), sports (1 if they did sports, 0 if they did not), and GPA (the grade point average at university). Discuss the relationship between taking part in sports, GPA, and income for these data. The R code I used so far is Does sports predict GPA?> lm1<-lm(GPA~sports) > summary(lm1)Does sports predict income?> lm2<-lm(income~sports) > summary(lm2)Does GPA predict income?> lm3<-lm(income~GPA) > summary(lm3)Does sports predict income after accounting for GPA?> lm4<-lm(income~GPA+sports) > summary(lm4)Can someone let me know is the above is correct? I am not sure if to keep all four regressions or only 1 and 4. Also, I need to plot the data on a graph or table. Can anyone suggest how to do this? Thank you in advance :) -- View this message in context: http://www.nabble.com/Is-this-correct--tp20654004p20654004.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
You need to do the homework yourself. What is correct depends on what the data says,(and what exactly the prof wants). :) The best idea probably is to decide yourself on what you want to present and write a rationale as to why you chose this analysis. More generally there is a lot of good documentation available on the R website although it is not always easy to get to. Try going to the R home page http://www.r-project.org/, then choose Other (left side of page) and then select contributed documentation. Something like ?Using R for Data Analysis and Graphics - Introduction, Examples and Commentary? by John Maindonald or ?Kickstarting R (version 1.6)? compiled by Jim Lemon should be helpful for ploting among other things. Have fun. --- On Sun, 11/23/08, Rlover <lmoto001 at fiu.edu> wrote:> From: Rlover <lmoto001 at fiu.edu> > Subject: [R] Is this correct? > To: r-help at r-project.org > Received: Sunday, November 23, 2008, 9:45 PM > I have to answer the following question for a homework > assignment. > > A researcher was interested in whether people taking part > in sports at > university made more money after graduating, taking into > account the > students' GPA. They sampled 200 alumni from a large > university. The > variables are: income (income 10 years after graduating), > sports (1 if they > did sports, 0 if they did not), and GPA (the grade point > average at > university). Discuss the relationship between taking part > in sports, GPA, > and income for these data. > > > The R code I used so far is > > Does sports predict GPA? > > > lm1<-lm(GPA~sports) > > summary(lm1) > > Does sports predict income? > > lm2<-lm(income~sports) > > summary(lm2) > > Does GPA predict income? > > lm3<-lm(income~GPA) > > summary(lm3) > > Does sports predict income after accounting for GPA? > > lm4<-lm(income~GPA+sports) > > summary(lm4) > > > Can someone let me know is the above is correct? I am not > sure if to keep > all four regressions or only 1 and 4. Also, I need to plot > the data on a > graph or table. Can anyone suggest how to do this? Thank > you in advance :) > > > -- > View this message in context: > http://www.nabble.com/Is-this-correct--tp20654004p20654004.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code.__________________________________________________________________ Get a sneak peak at messages with a handy read iew2/