Re: [R] Linear Model Prediction

2012-07-24 Thread arun
a=dat2) #The code below is to replace the NA values with predicted. #dat1<-within(dat1,{Dischargenew<-ifelse(is.na(Discharge)==T,fit,Discharge)}) #dat1new<-dat1[,c(1:2,4)] A.K. - Original Message - From: cm To: r-help@r-project.org Cc: Sent: Tuesday, July 24, 2012 2:20 P

Re: [R] Linear Model Prediction

2012-07-24 Thread R. Michael Weylandt
On Tue, Jul 24, 2012 at 2:06 PM, wrote: > Yes, why wouldn't I? It's a linear model between two sets of data: x and y. Conventionally, one predicts y based on x -- which is specified y ~ x, not x ~ y. (Predictors on the RHS, predicted on the LHS) > > Also, what would the new data be if i want to

Re: [R] Linear Model Prediction

2012-07-24 Thread cm
Yes, why wouldn't I? It's a linear model between two sets of data: x and y. Also, what would the new data be if i want to predict into the future? So, for example, the data goes from a month ago to today. I want to predict what tomorrow's data would be. So what is "newdata"? -- View this mes

Re: [R] Linear Model Prediction

2012-07-24 Thread R. Michael Weylandt
On Jul 24, 2012, at 1:38 PM, cm wrote: > How do I set it up? Because when I do predict(model) I get a ton of points, > not just one. You need to supply newdata= . predict() without new data gives predicted values for the predictors you for the model to. Incidentally, repeating Uwe -- are

Re: [R] Linear Model Prediction

2012-07-24 Thread cm
How do I set it up? Because when I do predict(model) I get a ton of points, not just one. - Original Message - From: "Uwe Ligges-3 [via R]" Date: Tuesday, July 24, 2012 2:28 pm Subject: Re: Linear Model Prediction To: cm > > > > > On 24.07.2012 20:20, cm wrote: > > I have data X a

Re: [R] Linear Model Prediction

2012-07-24 Thread Uwe Ligges
On 24.07.2012 20:20, cm wrote: I have data X and Y, and I want to predict what the very next point would be based off the model. This is what I have: model=lm(x~y) Hmmm, are you sure about the above code? I think I want to use the predict function, but I'm not exactly sure what to do. Y

[R] Linear Model Prediction

2012-07-24 Thread cm
I have data X and Y, and I want to predict what the very next point would be based off the model. This is what I have: >model=lm(x~y) I think I want to use the predict function, but I'm not exactly sure what to do. Thank you! -- View this message in context: http://r.789695.n4.nabble.com/Line