[R] How to plot confidence bands for nls
Bert Gunter
gunter.berton at gene.com
Tue Jul 6 22:08:43 CEST 2010
?predict.nls
Bert Gunter
Genentech Nonclinical Biostatistics
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Claudia Penaloza
Sent: Tuesday, July 06, 2010 12:55 PM
To: r-help at r-project.org
Subject: [R] How to plot confidence bands for nls
I adjusted an exponential regression to the following data and wish to plot
confidence bands as well. Is this possible?
Any help greatly appreciated.
Claudia
x <- c(1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
2002,2003,2004,2005,2006,2007,2008,2009)
y <- c(987,937,810,749,1087,807,1050,1294,1455,1022,927,403,698,1191,1078,
1176,1125,936,1263,647,868)
dat <- data.frame(x,y)
f <- function(x,a,b){a*exp(b*x)}
fems <- nls(y ~ f(x,a,b), data = dat, start = c(a=100, b=0))
plot(y~x, xlim=c(1989,2010), ylab="Nesting Females", xlab="Year")
curve(f(x, a=co[1], b=co[2]), add=T)
[[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