Ajay Narottam Shah
2005-Sep-25 14:41 UTC
[R] Question on lm(): When does R-squared come out as NA?
I have a situation with a large dataset (3000+ observations), where I'm doing lags as regressors, where I get: Call: lm(formula = rj ~ rM + rM.1 + rM.2 + rM.3 + rM.4) Residuals: 1990-06-04 1994-11-14 1998-08-21 2002-03-13 2005-09-15 -5.64672 -0.59596 -0.04143 0.55412 8.18229 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.003297 0.017603 -0.187 0.851 rM 0.845169 0.010522 80.322 <2e-16 *** rM.1 0.116330 0.010692 10.880 <2e-16 *** rM.2 0.002044 0.010686 0.191 0.848 rM.3 0.013181 0.010692 1.233 0.218 rM.4 0.009587 0.010525 0.911 0.362 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.044 on 3532 degrees of freedom Multiple R-Squared: NA, Adjusted R-squared: NA F-statistic: NA on 5 and 3532 DF, p-value: NA rM.1, rM.2, etc. are lagged values of rM. The OLS seems fine in every respect, except that there is an NA as the multiple R-squared. I will be happy to give sample data to someone curious about what is going on. I wondered if this was a well-known pathology. The way I know it, if the data allows computation of (X'X)^{-1}, one can compute the R2. -- Ajay Shah Consultant ajayshah at mayin.org Department of Economic Affairs http://www.mayin.org/ajayshah Ministry of Finance, New Delhi
Prof Brian Ripley
2005-Sep-28 07:23 UTC
[R] Question on lm(): When does R-squared come out as NA?
I've not seen a reply to this, nor ever seen it. Please make a reproducible example available (do see the posting guide). On Sun, 25 Sep 2005, Ajay Narottam Shah wrote:> I have a situation with a large dataset (3000+ observations), where > I'm doing lags as regressors, where I get: > > Call: > lm(formula = rj ~ rM + rM.1 + rM.2 + rM.3 + rM.4) > > Residuals: > 1990-06-04 1994-11-14 1998-08-21 2002-03-13 2005-09-15 > -5.64672 -0.59596 -0.04143 0.55412 8.18229 > > Coefficients: > Estimate Std. Error t value Pr(>|t|) > (Intercept) -0.003297 0.017603 -0.187 0.851 > rM 0.845169 0.010522 80.322 <2e-16 *** > rM.1 0.116330 0.010692 10.880 <2e-16 *** > rM.2 0.002044 0.010686 0.191 0.848 > rM.3 0.013181 0.010692 1.233 0.218 > rM.4 0.009587 0.010525 0.911 0.362 > --- > Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > Residual standard error: 1.044 on 3532 degrees of freedom > Multiple R-Squared: NA, Adjusted R-squared: NA > F-statistic: NA on 5 and 3532 DF, p-value: NA > > > rM.1, rM.2, etc. are lagged values of rM. The OLS seems fine in every > respect, except that there is an NA as the multiple R-squared. I will > be happy to give sample data to someone curious about what is going > on. I wondered if this was a well-known pathology. The way I know it, > if the data allows computation of (X'X)^{-1}, one can compute the R2. > > -- > Ajay Shah Consultant > ajayshah at mayin.org Department of Economic Affairs > http://www.mayin.org/ajayshah Ministry of Finance, New Delhi > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595