> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of wayne.w.jo...@shell.com
> Sent: 22 October 2013 18:52
> To: R-help@r-project.org
> Subject: [R] nls model definition help
> 
> Hi fellow R users,
> 
> I'm trying to fit a model using nls with the following model
> definition:
> 
> y(t+1)=(th1*x1 + R1*x2) * exp(a1*x3) + (1-th1*x1 + R1*x2)*y(t)
> 
> ...
>
> Any ideas if this is achievable and if not any ideas on how to fit this
> model?
I'm thinking not, as you have that (t+1) back-reference in there which makes 
the calculated y(t) part of the expression. Pretty sure nlm won't handle that 
in the formula interface. 

However, you could use nlm or optim if you write a function to predict y and 
then wrap that in a function to calculate the residual sum of squares (taking 
the parameter vector and y[obs] as parameters), then minimise the residual SS. 
The hessian from either can then be used to estimate standard errors using the 
usual least-squares formulae.

S Ellison


*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}

______________________________________________
R-help@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.

Reply via email to