Hi Thomas,

Perhaps:

 test = read.table("test.dat", header=T, dec=',')
 x <- test[,1:21]
 y <- test[, "Y"]
 mymodel <- lm(y ~ x)

 # Coefficients and more information
 summary(mymodel)

 # Plots for the residuals
 plotspar(mfrow=c(2,2))
 plot(mymodel)


See also ?lm

HTH,

Jorge


On Tue, May 13, 2008 at 6:54 PM, Anja und Th. Sponsel <anjaspp@netscape.net>
wrote:

> 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
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]

