[R-SIG-Mac] Dependent variable of left and right hand sides

Thor Jensen thor.jsn at gmail.com
Mon May 9 15:56:15 CEST 2011


Hello all,

An R squared novice with a trouble regression.  Some brief background:
I am looking for a relationship between energy efficiency (based on
certification level) against various independent variables - including
heating and cooling days, region (11 Canadian provinces), and soon
energy prices.

Writing out all the variables into my equation using "monkey$Level" or
renaming them all using "Level=monkey$Level" seemed too much so I just
represented the equation side using "lm(monkey$Level~."  The trouble
is my dependent variable  is listed among the other independent
variables on the right hand side.  Is this because I am using
"monkey$level~." instead of renaming the variables via Y=monkey$Level
and then writing Y~X1..Xn?

> summary(fm<-lm(monkey$Level~., data=df))   # monkey is a csv2 read file, and df is my data frame with ten dummy variables and two ordinary integer variables
Call:
lm(formula = monkey$Level ~ ., data = df)

Residuals:
       Min         1Q     Median         3Q        Max
-1.514e-14 -1.048e-15 -1.660e-16  2.960e-16  3.118e-13

Coefficients:
               Estimate Std. Error    t value Pr(>|t|)
(Intercept)   3.040e-14  1.170e-14  2.599e+00  0.00951 **
monkey.Level  1.000e+00  4.571e-16  2.188e+15  < 2e-16 ***
monkey.AB     3.785e-15  1.876e-15  2.018e+00  0.04394 *
monkey.BC    -2.550e-15  3.669e-15 -6.950e-01  0.48733
monkey.MB     1.708e-15  2.937e-15  5.820e-01  0.56095
monkey.NL     1.476e-15  5.022e-15  2.940e-01  0.76887
monkey.NS     1.214e-16  2.843e-15  4.300e-02  0.96596
monkey.NT     6.692e-15  1.155e-14  5.790e-01  0.56247
monkey.ON    -9.637e-16  1.160e-15 -8.310e-01  0.40637
monkey.PE     1.818e-16  6.240e-15  2.900e-02  0.97677
monkey.SK     2.087e-15  2.539e-15  8.220e-01  0.41130
monkey.HDD   -1.487e-18  1.657e-18 -8.980e-01  0.36958
monkey.CDD    2.572e-18  4.551e-18  5.650e-01  0.57206
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.057e-14 on 882 degrees of freedom
Multiple R-squared:     1,	Adjusted R-squared:     1
F-statistic: 4.637e+29 on 12 and 882 DF,  p-value: < 2.2e-16

I hope this wasn't too much information, thanks for any help or tips
how to do this more effectively.

Best regards,

Thor Jensen



More information about the R-SIG-Mac mailing list