[R] Regression

peter dalgaard pdalgd at gmail.com
Tue May 1 10:46:08 CEST 2012


On Apr 30, 2012, at 20:27 , Saint wrote:

> Trying to do a regression for four variables. I get information only for two.
> The rest is marked "NA". Why? And what does NA mean? 

Your design matrix is singular since p is constant and p+Sweden.infl.dev=Sweden.infl, so two coefficients are set to missing -- effectively, the corresponding predictors are removed from the model.

You may have to read up on the basics of multiple regression.

> 
> Thanks!
> 
> 
>> Sweden.infl.dev <- c(0.2, 0.6, -1, -0.2, -1, -1.5, -0.7, 0.7, -0.1, 0.3)
> 
>> Sweden.GDP.gap <- c(-0.024662769, -0.01519859, -0.027251109, -0.027129556,
>> -0.014561961, 0.007291667, 0.02695406, 0.01179481, 0.008348032,
>> 0.000000000683083)
> 
>> Sweden.nom.int.rate <- c(7.6, 8.91, 4.1, 4.35, 3.4, 3.25, 4, 3.75, 3.75,
>> 2.75)
> 
>> Sweden.infl <- c(2.2, 2.6, 1, 1.8, 1, 0.5, 1.3, 2.7, 1.9, 2.3)
> 
>> p <- c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2)
> 
>> Sweden.Taylor.nom.p.infl <-  lm(Sweden.nom.int.rate ~ Sweden.infl.dev +
>> Sweden.GDP.gap + p + Sweden.infl)
> 
> Call:
> lm(formula = Sweden.nom.int.rate ~ Sweden.infl.dev + Sweden.GDP.gap + 
>    p + Sweden.infl)
> 
> Coefficients:
>    (Intercept)  Sweden.infl.dev   Sweden.GDP.gap                p  
>          4.675            1.212          -43.695               NA  
>    Sweden.infl  
>             NA  
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Regression-tp4598984.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.

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list