[R] predict.glm - how to?
Hi I have a little R problem. I have created a GLM model in R and now I want to predict some values outside the values I have in the model (extrapolate). I have this code: fitted.model4 - glm(Yval ~ time, family=gaussian, data=Fuel) The question is - How do I predict a value of Yval ie with a value of time = 340 and also get confidence/prediction intervals for Yvar? I have tried the predict.glm but cannot make it work - any suggestions how to do this using predict.glm? Yval are 312 fuel prices ranging from 60 to 140 and time is a sequence from 1 to 312. The GLM summary output is as follows: Deviance Residuals: Min 1Q Median 3Q Max -24.978 -4.033 -0.3914.747 15.323 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 79.698229 0.871830 91.42 2e-16 *** seq(1:312) 0.180127 0.004828 37.31 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for gaussian family taken to be 59.00219) Null deviance: 100408 on 311 degrees of freedom Residual deviance: 18291 on 310 degrees of freedom AIC: 2161.6 Number of Fisher Scoring iterations: 2 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] predict.glm - how to?
On 3/2/06, Laurits Søgaard Nielsen [EMAIL PROTECTED] wrote: Hi I have a little R problem. I have created a GLM model in R and now I want to predict some values outside the values I have in the model (extrapolate). myglm - glm( some stuff here) whatever - some-new-hypothetical-data-you-create predict (myglm, newdata=whatever, type=response) I have hints on this in Rtips http://pj.freefaculty.org/R/Rtips.html#7.5 -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] predict.glm and continous variables
Hello. I am using the predict function to transform logit values from a glm to probabilities, (predict(model,type=response,se=T)).. Everything is going very well for the categorical variables where I get one value for the slope of each level and one value for standard error for each level. The problem occurs when I whant to do the same for my continous variables. Instead of getting one value for the slope and and one value of SE for each variable (like what pops up in the summary in a univariate glm) I get a slope and SE value for every datapoint in the variable. I hope someone knows the solution to my problem. Regards, Line. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] predict.glm
Hi All, Sorry for this is a very naive question. I am trying to do binary classification (male vs female) using glm using following data: X1X2X3Class 2.34.52.1Male 0.93.2 1.6 Male 1.71.82.6Feamle I am trying to use predict.glm for prediction with type=respose which gives the predicted probabilities as per documentation. My question is: which of the two classes does this probability corresponds to? My understanding is that it is the probability of the class that each of the new data has. Is that correct? Thanks. Raj [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] predict.glm
Dear Raj, I'm not sure that I'm interpreting your question properly, but I'll give it a shot: When you use a two-level factor as the response variable in a binomial GLM, the first level is taken to represent failure and the second success. See ?glm for details. The default order of levels is alphabetical, so unless you did something to order the levels differently, Male would correspond to success and Female to failure. Thus the fitted probability would be the probability of Male. Is that what you wanted to know? John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rajdeep Das Sent: Wednesday, December 29, 2004 1:33 PM To: R Help Mailing List Subject: [R] predict.glm Hi All, Sorry for this is a very naive question. I am trying to do binary classification (male vs female) using glm using following data: X1X2X3Class 2.34.52.1Male 0.93.2 1.6 Male 1.71.82.6Feamle I am trying to use predict.glm for prediction with type=respose which gives the predicted probabilities as per documentation. My question is: which of the two classes does this probability corresponds to? My understanding is that it is the probability of the class that each of the new data has. Is that correct? Thanks. Raj [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] predict.glm(glm.ob,type=terms)
hello pgeo-predict.glm(glm.ob,type=resp) works fine. But I need to get predictions values in terms of each factor variables. pgeo-predict.glm(glm.ob,type=terms) gives Error in rep(1/n,n) %*% model.matrix(object): non conformable arguments Could anyone tell me why ? Ahmet Temiz Turkey __ __ The views and opinions expressed in this e-mail message are the ... {{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help