[R] arrange data for simple regression analysis
Petr Pikal
petr.pikal at precheza.cz
Mon Apr 24 12:05:27 CEST 2006
Hi
not sure what do you want to do but what about
y<-colMeans(your.data)
x<-c(0,30,60,120)
fit<-lm(y~x)
Is this what you want?
Better to use advice suggested in posting guide and to show some
reproducible example.
HTH
Petr
On 24 Apr 2006 at 5:15, Tomás Revilla wrote:
Date sent: Mon, 24 Apr 2006 05:15:58 -0400
From: "Tomás Revilla" <tomlists at gmail.com>
To: r-help at stat.math.ethz.ch
Subject: [R] arrange data for simple regression analysis
> Hello, I want to arrange data from a table to perform a simple
> regression. All the examples I saw deal with paired data, e.g. 'x' and
> 'y' have the same dimensions (e.g. 5 values for x and 5 for y).
>
> But I have more than one 'y' for each 'x' value, e.g. the data file
> has a x = 0, 30, 60, and 120 columns. And for each of them I have
> several replicate responses (e.g. individuals), not allways the same
> number. After I read the data with read.table(), ending with 4
> columns, what is next? how can I regress this against c(0, 30, 60,
> 120)?
>
> 0 --> n1 y values
> 30 --> n2 y values
> 60 --> n3 y values
> 120 --> n4 y values
>
> Thanks,
>
> Tomas
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
Petr Pikal
petr.pikal at precheza.cz
More information about the R-help
mailing list