Christopher Desjardins
2011-Nov-23 14:07 UTC
[R] SPSS F-test on change in R square between hierarchical models
Hi, I am wondering if anyone knows how to perform an F-test on the change in R square between hierarchical models in R? SPSS provides this information and a researcher that I am working with is interested in getting this information. Alternatively, if someone knows how I can calculate the test statistic (SPSS calls it F-change?) and dfs that would be helpful as well. The output and the test I am looking for is available here -> http://dl.dropbox.com/u/1501309/spss_rsquared.pdf Chris On Wed, Nov 23, 2011 at 6:20 AM, Smart Guy <smartguy3k@gmail.com> wrote:> Hi All, > I was adding a new row of data to my data frame using rbind(). I > was surprised to see that after adding new row, I lost my data frame level > attibute as well as col level attribute. Please help me to insert a new > row at frist or middle position so that my custom attribute is not lost. > > Here is what I did. > > age<-c(15,20,18) > weight<-c(40,42,30) > > ### creating my data frame #### > mydata <- data.frame(age,weight) > > ### creating data frame level attribute #### > attr(mydata,"myattr")<-c("myinfo") > > ### creating col level attribute for 'age' column ### > attr(mydata$age,"mycolattr")<-c("mycolinfo") > > #### Checking attributes ### > attributes(mydata) > attributes(mydata$age) > > ### creating new row ##### > newrow <- data.frame(age=16, weight= 42) > > #### Inserting newrow as first row to my data frame #### > mydata<- rbind(newrow, mydata) > > #### Checking attributes again ### I lost my custom attributes > attributes(mydata$age) > attributes(mydata) > > > Thanks in advance, > > > -- > SG > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]
Bert Gunter
2011-Nov-23 18:48 UTC
[R] SPSS F-test on change in R square between hierarchical models
Probably ?anova ?add1 ?drop1 are what you're looking for. -- Bert On Wed, Nov 23, 2011 at 6:07 AM, Christopher Desjardins <desja004 at umn.edu> wrote:> Hi, > > I am wondering if anyone knows how to perform an F-test on the change in R > square between hierarchical models in R? SPSS provides this information and > a researcher that I am working with is interested in getting this > information. Alternatively, if someone knows how I can calculate the test > statistic (SPSS calls it F-change?) and dfs that would be helpful as well. > > The output and the test I am looking for is available here -> > http://dl.dropbox.com/u/1501309/spss_rsquared.pdf > > Chris > > On Wed, Nov 23, 2011 at 6:20 AM, Smart Guy <smartguy3k at gmail.com> wrote: > >> Hi All, >> ? ? ? ? ? I was adding a new row of data to my data frame using rbind(). I >> was surprised to see that after adding new row, I lost my data frame level >> attibute as well as ?col level attribute. Please help me to insert a new >> row at frist or middle position so that my custom attribute is not lost. >> >> ?Here is what I did. >> >> age<-c(15,20,18) >> weight<-c(40,42,30) >> >> ### creating my data frame #### >> mydata <- data.frame(age,weight) >> >> ### creating data frame level attribute #### >> attr(mydata,"myattr")<-c("myinfo") >> >> ### creating col level attribute for 'age' column ?### >> attr(mydata$age,"mycolattr")<-c("mycolinfo") >> >> #### Checking attributes ?### >> attributes(mydata) >> attributes(mydata$age) >> >> ### creating new row ?##### >> newrow <- data.frame(age=16, weight= 42) >> >> #### Inserting newrow as first row to my data frame #### >> mydata<- rbind(newrow, mydata) >> >> #### Checking attributes again ### ?I lost my custom attributes >> attributes(mydata$age) >> attributes(mydata) >> >> >> Thanks in advance, >> >> >> -- >> SG >> >> ? ? ? ?[[alternative HTML version deleted]] >> >> ______________________________________________ >> 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. >> > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
Yvonnick Noel
2011-Nov-24 15:14 UTC
[R] SPSS F-test on change in R square between hierarchical models
Christopher,> I am wondering if anyone knows how to perform an F-test on the change in R > square between hierarchical models in R? SPSS provides this information and > a researcher that I am working with is interested in getting this > information. Alternatively, if someone knows how I can calculate the test > statistic (SPSS calls it F-change?) and dfs that would be helpful as well.What you describe is just the standard F test for comparing two models, or testing deviance reduction between tow *nested* models (I suspect this is what you mean by "hierarchical"). The anova() function will do that. The R2STATS GUI will also give you these tests, along with the R-squared, in the same table. A common misconception about an F-test is that it is the test on a variable effect, when strictly speaking it is a test on the deviance reduction between two models that include or not that particular variable (and there may be several ways to do that, each leading to possibly different F-values). Yvonnick Noel University of Brittany Department of Psychology Rennes, France