[R] Graph showing fitted values obtained by binomial GLM
Simon Blomberg
s.blomberg1 at uq.edu.au
Fri Jul 6 06:58:06 CEST 2012
You have size as well as time in your model M2. So your newdata (MyData)
needs to have size in it too.
Cheers,
Simon.
On 06/07/12 13:55, linda.kate wrote:
> I have completed a binomial GLM in R (details attached (finalModel.docx)) and
> I am trying to create a graph of observed and fitted values using the
> following commands:
>
>> MyData<-data.frame(time=seq(from=0,to=1323,by=1))
>> Pred<-predict(M2,newdata=MyData,type="response")
>> plot(x=turtle$time,y=turtle$success)
>> lines(MyData$time,Pred)
>
> However, I get the following error when using the <predict> command:
>
>> Pred<-predict(M2,newdata=MyData,type="response")
> Error in eval(expr, envir, enclos) : object 'size' not found
>
>
> I'm not sure why I am getting this error. I have used the same commands on a
> similar dataset before and was able to produce the attached plot
> (plot.docx). I've also attached the data I've been using (final.csv).
>
> Any pointers would be greatly appreciated!!
>
> Thank you for your time,
> Linda Baker
> Student - James Cook University
>
> http://r.789695.n4.nabble.com/file/n4635573/finalModel.docx finalModel.docx
> http://r.789695.n4.nabble.com/file/n4635573/plot.docx plot.docx
> http://r.789695.n4.nabble.com/file/n4635573/final.csv final.csv
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Graph-showing-fitted-values-obtained-by-binomial-GLM-tp4635573.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.
--
Simon Blomberg, BSc (Hons), PhD, MAppStat, AStat.
Lecturer and Consultant Statistician
School of Biological Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au
http://www.uq.edu.au/~uqsblomb/
Policies:
1. I will NOT analyse your data for you.
2. Your deadline is your problem.
Statistics is the grammar of science - Karl Pearson.
More information about the R-help
mailing list