Re: [R] help with a regression problem

2012-08-01 Thread Eik Vettorazzi
Hi, maybe working with a data.frame in long format is an option - then you can use e.g. lmList and so on up to mixed models, depending on your final goals of analyses (e.g. check for differential slopes). vmat<-matrix(c("X1","X2","X3","X4","Y1","Y2","Y3","Y4"),nrow=2,byrow=T) aa.l<-reshape(aa,idva

Re: [R] help with a regression problem

2012-08-01 Thread Jean V Adams
"R Heberto Ghezzo, Dr" wrote on 08/01/2012 08:06:30 AM: > > Hello, > I have a big data frame where consecutive time dates and > corresponding observed values for each subject (ID) are on a line. I > want to compute the linear slope for each subject. I would like to > use apply but I do > not k

Re: [R] help with a regression problem

2012-08-01 Thread Sarah Goslee
Hi, On Wed, Aug 1, 2012 at 9:06 AM, R Heberto Ghezzo, Dr wrote: > Hello, > I have a big data frame where consecutive time dates and corresponding > observed values for each subject (ID) are on a line. I want to compute the > linear slope for each subject. I would like to use apply but I do > no

[R] help with a regression problem

2012-08-01 Thread R Heberto Ghezzo, Dr
Hello, I have a big data frame where consecutive time dates and corresponding observed values for each subject (ID) are on a line. I want to compute the linear slope for each subject. I would like to use apply but I do not know how to express the corresponding function. An example using a loop f

Re: [R] help with a regression

2012-07-31 Thread arun
Heberto Ghezzo, Dr" To: "r-help@r-project.org" Cc: Sent: Tuesday, July 31, 2012 4:33 PM Subject: [R] help with a regression Hello, I have a data frame with the following variables: ID, X1,X2,X3,X4,X5,Y1,Y2,Y3,Y4,Y5 and some other that do not matter, some of the X and Y can be missing

Re: [R] help with a regression

2012-07-31 Thread Jean V Adams
Can you provide a small example data set? Does the number after the X and Y indicate the subject? Are you trying to come up with a single line of code to do this ... ? lm(Y1 ~ X1, data=DF) lm(Y2 ~ X2, data=DF) ... lm(Y5 ~ X5, data=DF) Jean "R Heberto Ghezzo, Dr" wrote on 07/

[R] help with a regression

2012-07-31 Thread R Heberto Ghezzo, Dr
Hello, I have a data frame with the following variables: ID, X1,X2,X3,X4,X5,Y1,Y2,Y3,Y4,Y5 and some other that do not matter, some of the X and Y can be missing (NA). I want to compute the slope of the linear regression Y ~ X for each subject, so using apply(DF,1,FUN,ra.rm=TRUE) now How do I de