[R] how to draw confidence interval lines of a fitted curve of polynominal regression

Eik Vettorazzi E.Vettorazzi at uke.de
Thu Feb 7 12:56:05 CET 2013


Hi Elaine
you can do all at one go using the ggplot2-package

library(ggplot2)
qplot(age,weight)+ geom_smooth(method="lm",formula=y~poly(x,2))

Have a look at ?geom_smooth when you want to incooperate customized
model predictions

cheers.

Am 07.02.2013 02:31, schrieb Elaine Kuo:
> Hello,
> 
> I drew a plot of weight and height of people and fitted it with a
> polynominal regression x^2.
> (using curve())
> 
> Now I would like to draw the confidence interval line for the fitted curve.
> Please kindly advise the code for the purpose.
> Thank you.
> 
> Elaine
> 
> 	[[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.
> 


-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790
--
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg

Vorstandsmitglieder: Prof. Dr. Martin Zeitz (Vorsitzender), Dr. Alexander Kirstein, Joachim Prölß, Prof. Dr. Dr. Uwe Koch-Gromus



More information about the R-help mailing list