[R] Obtaining predicted values for glm() function
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Fri Aug 15 08:22:49 CEST 2014
Please don't repeat post. In fact, you should definitely read the Posting Guide mentioned at the bottom if this or any other post from the list and follow its advice.
The usual way to predict output of a model in R is to use the predict function appropriate to your model object class. You might find reading the help file ?predict.glm helpful. If not, then you might be needing to study some more basic use cases of R so you can interpret the help files.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
On August 14, 2014 10:54:17 PM PDT, DHIMAN BHADRA <dhimanbhadra at gmail.com> wrote:
>Dear all.
>
>I am trying to relate daily deaths in a given city with air pollution
>values. The model I am using is as follows:
>
>model <- glm(deaths ~ pollution + ns(time, 13) + ns(temp, 7) + ns(rh,
>5) +
>dow + holiday, family=quasipoisson, data=city)
>
>Where -
>deaths: daily number of deaths
>pollution: daily measured levels of air pollution
>ns(time, 13): smooth function (i.e. cubic spline) of time with 13
>degrees
>of freedom
>ns(temp, 7): smooth function (i.e. cubic spline) of temperature with 7
>degrees of freedom
>ns(rh, 5): smooth function (i.e. cubic spline) of humidity with 5
>degrees
>of freedom
>dow: day of the week
>holiday: dummy variable to indicate public holidays
>
>Having run this model, how do I obtain predicted values of deaths for
>any
>given set of pollution values? Any suggestions will be much
>appreciated.
>
>Thanks in advance,
>Dhiman Bhadra
>Assistant professor.
>IIM Ahmedabad.
>
> [[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