Agustin Lobo
2016-Sep-06 06:52 UTC
[R] R-square prob is not calculated by randomization in lmPerm::lmp
Any reason why the R-square prob is not calculated by randomization in lmPerm::lmp? The help pages states "Either permutation test p-values or the usual F-test p-values will be output", but I always get the F test for R-square as with lm(): require(lmPerm) x <- 1:1000 set.seed(1000) y1 <- x*2+runif(1000,-100,100) dat <- data.frame(x =x,y=y1) summary(lmp(y~x, data=dat,center=FALSE,perm="Prob")) [1] "Settings: unique SS " Call: lmp(formula = y ~ x, data = dat, center = FALSE) Residuals: Min 1Q Median 3Q Max -100.431 -48.645 2.843 48.640 101.800 Coefficients: Estimate Iter Pr(Prob) x 1.993 5000 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 57.3 on 998 degrees of freedom Multiple R-Squared: 0.9902, Adjusted R-squared: 0.9902 F-statistic: 1.009e+05 on 1 and 998 DF, p-value: < 2.2e-16 -- Agustin Lobo aloboaleu at gmail.com
Jeff Newmiller
2016-Sep-06 14:35 UTC
[R] R-square prob is not calculated by randomization in lmPerm::lmp
That is contributed code. It could do anything the author felt like. I recommend reading the source code. -- Sent from my phone. Please excuse my brevity. On September 5, 2016 11:52:15 PM PDT, Agustin Lobo <aloboaleu at gmail.com> wrote:>Any reason why the R-square prob is not calculated by randomization in >lmPerm::lmp? The help pages states "Either permutation test p-values >or the usual F-test p-values will be output", but I always get the F >test for R-square as with lm(): > >require(lmPerm) >x <- 1:1000 >set.seed(1000) >y1 <- x*2+runif(1000,-100,100) >dat <- data.frame(x =x,y=y1) >summary(lmp(y~x, data=dat,center=FALSE,perm="Prob")) > >[1] "Settings: unique SS " > >Call: >lmp(formula = y ~ x, data = dat, center = FALSE) > >Residuals: > Min 1Q Median 3Q Max >-100.431 -48.645 2.843 48.640 101.800 > >Coefficients: > Estimate Iter Pr(Prob) >x 1.993 5000 <2e-16 *** >--- >Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > >Residual standard error: 57.3 on 998 degrees of freedom >Multiple R-Squared: 0.9902, Adjusted R-squared: 0.9902 >F-statistic: 1.009e+05 on 1 and 998 DF, p-value: < 2.2e-16
Cade, Brian
2016-Sep-06 15:00 UTC
[R] R-square prob is not calculated by randomization in lmPerm::lmp
For a linear model without an intercept term as in this example, neither the usual permutation scheme for testing Ho: B1 = 0 nor usual definition of R-squared apply. So you need to check what the developer of this code chose to do. If I'm recalling correctly, in a linear model with an intercept term the permutation test for Ho: B1 = B2 = ... Bp = 0 (i.e., all coefficients other than the intercept = 0) is equivalent to a permutation test for Ho: R-squared = 0. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 80526-8818 email: cadeb at usgs.gov <brian_cade at usgs.gov> tel: 970 226-9326 On Tue, Sep 6, 2016 at 8:35 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> That is contributed code. It could do anything the author felt like. I > recommend reading the source code. > -- > Sent from my phone. Please excuse my brevity. > > On September 5, 2016 11:52:15 PM PDT, Agustin Lobo <aloboaleu at gmail.com> > wrote: > >Any reason why the R-square prob is not calculated by randomization in > >lmPerm::lmp? The help pages states "Either permutation test p-values > >or the usual F-test p-values will be output", but I always get the F > >test for R-square as with lm(): > > > >require(lmPerm) > >x <- 1:1000 > >set.seed(1000) > >y1 <- x*2+runif(1000,-100,100) > >dat <- data.frame(x =x,y=y1) > >summary(lmp(y~x, data=dat,center=FALSE,perm="Prob")) > > > >[1] "Settings: unique SS " > > > >Call: > >lmp(formula = y ~ x, data = dat, center = FALSE) > > > >Residuals: > > Min 1Q Median 3Q Max > >-100.431 -48.645 2.843 48.640 101.800 > > > >Coefficients: > > Estimate Iter Pr(Prob) > >x 1.993 5000 <2e-16 *** > >--- > >Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > > >Residual standard error: 57.3 on 998 degrees of freedom > >Multiple R-Squared: 0.9902, Adjusted R-squared: 0.9902 > >F-statistic: 1.009e+05 on 1 and 998 DF, p-value: < 2.2e-16 > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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]]