Re: [R] gam - Y axis probability scale with confidence/error lines

2012-03-15 Thread ONKELINX, Thierry
-project.org [mailto:r-help-boun...@r-project.org] Namens Ben quant Verzonden: woensdag 14 maart 2012 19:48 Aan: Patrick Breheny CC: r-help@r-project.org Onderwerp: Re: [R] gam - Y axis probability scale with confidence/error lines Thank you. The binomial()$linkinv() is good to know. Ben On Wed

[R] gam - Y axis probability scale with confidence/error lines

2012-03-14 Thread Ben quant
Hello, How do I plot a gam fit object on probability (Y axis) vs raw values (X axis) axis and include the confidence plot lines? Details... I'm using the gam function like this: l_yx[,2] = log(l_yx[,2] + .0004) fit - gam(y~s(x),data=as.data.frame(l_yx),family=binomial) And I want to plot it so

Re: [R] gam - Y axis probability scale with confidence/error lines

2012-03-14 Thread Patrick Breheny
The predict() function has an option 'se.fit' that returns what you are asking for. If you set this equal to TRUE in your code: pred - predict(fit,data.frame(x=xx),type=response,se.fit=TRUE) will return a list with two elements, 'fit' and 'se.fit'. The pointwise confidence intervals will

Re: [R] gam - Y axis probability scale with confidence/error lines

2012-03-14 Thread Ben quant
That was embarrassingly easy. Thanks again Patrick! Just correcting a little typo to his reply. this is probably what he meant: pred = predict(fit,data.frame(x=xx),type=response,se.fit=TRUE) upper = pred$fit + 1.96 * pred$se.fit lower = pred$fit - 1.96 * pred$se.fit # For people who are

Re: [R] gam - Y axis probability scale with confidence/error lines

2012-03-14 Thread Patrick Breheny
Actually, I responded a bit too quickly last time, without really reading through your example carefully. You're fitting a logistic regression model and plotting the results on the probability scale. The better way to do what you propose is to obtain the confidence interval on the scale of

Re: [R] gam - Y axis probability scale with confidence/error lines

2012-03-14 Thread Ben quant
Thank you. The binomial()$linkinv() is good to know. Ben On Wed, Mar 14, 2012 at 12:23 PM, Patrick Breheny patrick.breh...@uky.eduwrote: Actually, I responded a bit too quickly last time, without really reading through your example carefully. You're fitting a logistic regression model and