[R] CRAN and Multiple Linear Regression
Anja und Th. Sponsel
anjaspp at netscape.net
Wed May 14 00:54:50 CEST 2008
I just have read the guide and I can do some small steps with cran but
I still have no clue...
I have data like this:
X1 X2 X3 ... X21 Y
1 0 0 0 ... 18 -0,07254
2 1 0 0 ... 6 -0,14921
3 0 1 0 ... 12 -0,04165
4 0 0 0 ... 8 0,08359
5 ... ... ... ... ... ...
120 0 0 1 1 8 0,07928
My script is:
> require(stats); require(graphics)
> test = read.table("test.dat", header=T)
> x <- test[, 1:21]
> y <- test[, "Y"]
> lm(y ~ x)
The error may be an invalid type (list) for variable x (see below):
Fehler in model.frame.default(formula = y ~ x, drop.unused.levels =
TRUE) :
ungültiger Typ (list) für die Variable 'x'
Then I tried:
...
> lm(data=test)
Then I get a lot of coefficients, but I'm not sure. That cant be the
result.
Then I tried:
> summary(lm(data = wetter))
Call:
lm(data = wetter)
Residuals:
ALL 120 residuals are 0: no residual degrees of freedom!
Coefficients: (139 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.044747 NA NA NA
X2 0.660275 NA NA NA
X3 -0.097629 NA NA NA
X4 0.647851 NA NA NA
X5 -3.305631 NA NA NA
... 0.249788 NA NA NA
I am confused...
Best regards,
Thomas
More information about the R-help
mailing list