[R] Linear Model Prediction

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Tue Jul 24 20:55:17 CEST 2012



On Jul 24, 2012, at 1:38 PM, cm <bunnylover23 at optonline.net> 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 you sure you want x~y ?

Michael

> 
> ----- 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 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.
>> 
>> Yes, use predict().
>> 
>> Is this homework?
>> 
>> 
>> Uwe Ligges
>> 
>> 
>>> 
>>> Thank you!
>>> 
>>> 
>>> 
>>> --
>>> View this message in context: 
>> http://r.789695.n4.nabble.com/Linear-Model-Prediction-tp4637644.html
>>> Sent from the R help mailing list archive at Nabble.com.
>>> 
>>> ______________________________________________
>>> R-help at 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.
>>> 
>> 
>> ______________________________________________
>> R-help at 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.
>> 
>> 
>> 
>> 
>> _______________________________________________
>> If you reply to this email, your message will be added to the 
>> discussion below:
>> http://r.789695.n4.nabble.com/Linear-Model-Prediction-
>> tp4637644p4637650.html
>> To unsubscribe from Linear Model Prediction, visit 
>> http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4637644&code=YnVubnlsb3ZlcjIzQG9wdG9ubGluZS5uZXR8NDYzNzY0NHwtMzcyMDM3NjIw
> 
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Linear-Model-Prediction-tp4637644p4637654.html
> Sent from the R help mailing list archive at Nabble.com.
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list