# Using the nls of R, how to define the individual formulas / constraints of the coefficients?

I've got a model to be estimated through the non-linear least squares method. The model is specified in such a way that I have a main formula having 5 coefficients which in turn have their own formulas dependent on total of four coefficients. The first formula itself is linear, it is the inclusion of the coefficients' individual formulae that makes the model nonlinear.

The R's nls function asks for a formula without the coefficients. I have no idea how to define them then.

To make things crystal clear, I'll post the concrete formulas below. I'll use '_' for index and "{}" brackets for the content of such index if it involves any algebra. Syntax is very much TEX-like, variable names are just single characters, so I didn't bother placing "*" everywhere where multiplication occurs.

p_t = β_1p_{t-1} + β_2p_{t-2} + β_3d_{t-1} + β_4d_{t-2} + β_5d_{t-3} + γ

β_1 = 2 - b - c
β_2 = -(1-c)(1-b)
β_3 = cδ + bα
β_4 = -cδ(1-b) - bα(2-c)
β_5 = bα(1-c)



What do you mean by "The R's nls function asks for a formula without the coefficients"! In R, the coefficients will be estimated by the nls. I think you can still do this by using nls. Write your formula in terms of b, c, $\alpha$, $\delta$ with some starting points for them using list.