Eleni Rapsomaniki
2012-Jan-09 13:45 UTC
[R] Joint confidence interval for fractional polynomial terms
Dear R users, The package 'mfp' that fits fractional polynomial terms to predictors. Example: data(GBSG) f <- mfp(Surv(rfst, cens) ~ fp(age, df = 4, select = 0.05) + fp(prm, df = 4, select = 0.05), family = cox, data = GBSG) print(f) To describe the association between the original predictor, eg. age and risk for different values of age I can plot it the polynomials and fitted coefficients as: plot(0.407*I((age/100)^-2) + -4.96*I((age/100)^-0.5) ~ age, GBSG) But I can't work out how to get a 95% confidence interval for this curve... Any suggestions? I could bootstrap it, but is there a mathematical solution? Many thanks Eleni Rapsomaniki Medical Statistician UCL, London
Frank Harrell
2012-Jan-09 14:05 UTC
[R] Joint confidence interval for fractional polynomial terms
This does not exactly answer your question but if you were to use restricted cubic splines instead of FPs, an upcoming new release of the rms package allows one to easily obtain simultaneous confidence bands for any series of predictions. So for your case you would hold all covariates constant except for the one varying on the x-axis, and tell the Predict function to use conf.type='simultaneous'. I've also added pointwise bootstrap nonparametric confidence bands for this context. Simultaneous confidence bands handle the simultaneous uncertainty of all the terms making up the spline function that are "in play" for the range of predictions being requested, i.e., terms that are involved because of the knot locations and the Xs being requested. Note that with fractional polynomials, if you use any term selection, the pointwise confidence intervals are not even correct. Frank Eleni Rapsomaniki-3 wrote> > Dear R users, > > The package 'mfp' that fits fractional polynomial terms to predictors. > Example: > data(GBSG) > f <- mfp(Surv(rfst, cens) ~ fp(age, df = 4, select = 0.05) > + fp(prm, df = 4, select = 0.05), family = cox, data > GBSG) > print(f) > > To describe the association between the original predictor, eg. age and > risk for different values of age I can plot it the polynomials and fitted > coefficients as: > > plot(0.407*I((age/100)^-2) + -4.96*I((age/100)^-0.5) ~ age, GBSG) > > But I can't work out how to get a 95% confidence interval for this > curve... Any suggestions? I could bootstrap it, but is there a > mathematical solution? > > Many thanks > Eleni Rapsomaniki > Medical Statistician > UCL, London > > ______________________________________________ > R-help@ 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. >----- Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/Joint-confidence-interval-for-fractional-polynomial-terms-tp4278494p4278546.html Sent from the R help mailing list archive at Nabble.com.
Eleni Rapsomaniki
2012-Jan-09 14:40 UTC
[R] Joint confidence interval for fractional polynomial terms
Dear Professor Harrell, Once again thank you for your helpful reply. I could use rcs instead, so I look forward to your latest rms release (soon I hope?) Initially I favoured fractional polynomials thinking that the model would be easier to present, but now I see that with either method unless one plots the fitted function results are just as hard to interpret. That's why the simultaneous CI plot will be very useful. Eleni> On Jan 9, 2012, at 8:45 AM, "Eleni Rapsomaniki" <e.rapsomaniki at ucl.ac.uk> > wrote: > >> Dear R users, >> >> The package 'mfp' that fits fractional polynomial terms to predictors. >> Example: >> data(GBSG) >> f <- mfp(Surv(rfst, cens) ~ fp(age, df = 4, select = 0.05) >> + fp(prm, df = 4, select = 0.05), family = cox, data >> GBSG) >> print(f) >> >> To describe the association between the original predictor, eg. age and >> risk for different values of age I can plot it the polynomials and >> fitted >> coefficients as: >> >> plot(0.407*I((age/100)^-2) + -4.96*I((age/100)^-0.5) ~ age, GBSG) >> >> But I can't work out how to get a 95% confidence interval for this >> curve... Any suggestions? I could bootstrap it, but is there a >> mathematical solution? >> >> Many thanks >> Eleni Rapsomaniki >> Medical Statistician >> UCL, London >> >> ______________________________________________ >> 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. >