[R] lm() function to get coefficients doesn`t work
Kenneth Cabrera
krcabrer at epm.net.co
Mon Jun 17 01:39:35 CEST 2002
Frithjof Weinert wrote:
> Hi,
>
>to get the residuals and coefficients I did the following:
>
>kurse <- read.table("kurse.txt" header=T)
>
>the data:
>
> index bmw mru rwe vow kar sie bas
>1 159,70 74,18 338,21 89,03 110,30 141,23 178,53 67,97
>2 160,76 73,46 343,66 89,38 110,30 142,66 180,45 68,30
>3 162,45 74,18 349,12 91,54 108,54 146,22 183,12 68,85
>4 162,18 72,74 349,12 92,20 106,43 144,80 181,75 68,52
>5 161,64 72,98 340,93 91,43 101,87 144,08 181,41 68,30
>
Modify the data base "kurse.txt", change "," for ".", R is taking each
variable
as a factor (character variable).
Use" ." (dot) for decimal separation, not "," (comma)
>
>
>lm(index ~ bmw + mru + rwe + vow + kar + sie + bas,
>data=kurse)
>
>But instead of getting the coefficients R is giving me this:
>
>(Intercept) kurse$bmw68,92 kurse$bmw69,39 kurse$bmw69,54
> 2.00 3.00 4.75 1.00
>kurse$bmw69,63 kurse$bmw69,87 kurse$bmw70,11 kurse$bmw70,35
> 8.00 14.00 10.00 7.50
>...... and so on
>
>Warning message:
>"-" not meaningful for factors in: Ops.factor(y, z$residuals)
>
>Please help. The function is maybe important for my exam.
>
>cu
>Frithjof
>
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
>Send "info", "help", or "[un]subscribe"
>(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list