mathr
2009-May-06 12:14 UTC
[R] Estimating parameters in a nonlinear model with observations
Hi, I have a problem. I want to estimate some parameters in a function. I already have an empirical function (made from 100 observations), which I want to estimate the parameters from. The function is f(x) = 1-((a+1)b^x)/(a+b^x) f(x) in [0,1], x in [0,1]. I want to estimate a and b. I tried to use least squares, where the code was (the dataset 'data' contains two columns: f.obs and x.obs) nls.emp <- nls(f.obs ~ 1-(a+1)*b^x.obs/(a+b^x.obs), data= data, start=list(a = -.9871731343, b = 51.78568669), trace=TRUE, algorithm = "port") But it just returns 0: 15.777046: -0.987173 51.7857 Error in numericDeriv(form[[3]], names(ind), env, ifelse(internalPars < : Missing value or an infinity produced when evaluating the model My initial values is calculated in maple in a nonlinear equation system. I used f(0.05) and f(0.5). Thanks, J
Apparently Analagous Threads
- Efficient way to determine if a data frame has missing observations
- Summary model with observations taken out and dummied back in - not working
- Problem with logarithmic nonlinear model using nls() from the `stats' package
- Covariates in NLS (Multiple nonlinear regression)
- question about rolling regressions