search for: expfun

Displaying 2 results from an estimated 2 matches for "expfun".

Did you mean: expfn
2007 Jul 24
1
Fwd: Re: Fitting exponential curve to data points
...out <- nls(Count~b0+b1*Year+b2*Year^2,data=dat, #polynomial > start=list(b0=0,b1=1,b2=1)) > lines(dat[,1],fitted(out),col=3) > > ## Optim > f <- function(.pars,.dat,.fun) sum((.dat[,2]-.fun(.pars,.dat[,1]))^2) > fitFun <- function(b,x) cbind(1,x,x^2)%*%b > expFun <- function(b,x) b[1]*exp(b[2]*x) > > plot(dat) > out <- optim(c(0,1,1),f,.dat=dat,.fun=fitFun) > lines(dat[,1],fitFun(out$par,dat[,1]),col=2) > out <- optim(c(1,1),f,.dat=dat,.fun=expFun) > lines(dat[,1],expFun(out$par,dat[,1]),col=3) ________________________...
2007 Jul 24
2
Fitting exponential curve to data points
Hi folks, I've looked through the list archives and online resources, but I haven't really found an answer to this -- it's pretty basic, but I'm (very much) not a statistician, and I just want to check that my solution is statistically sound. Basically, I have a data file containing two columns of data, call it data.tsv: year count 1999 3 2000 5 2001 9 2002 30 2003 62 2004 154