Dear Stata users,


I need to use NLS to estimate the following equation describing the so-called Bass diffusion model:

yt = m * [ ((1 - exp (-(p+q) * t)) / (1 + q/p * exp (-(p+q) * t))) - ((1 - exp (-(p+q) * (t-1))) / (1 + q/p * exp (-(p+q) * (t-1)))) ] + ut

where m,p, and q are parameters and t indicates time. As initial values for these parameters, I am to use those obtained with OLS applied to:

yt = β0 + β1 x1, t-1 + β2 x2, t-1 + ϵt

where β0 = m * p
β1 = q - p
β2= - q/m

Note that m = 41302528
p = 0.024
q = 0.194


To perform this NLS estimation, I tried to follow the example that was given in the Stata forum (https://www.stata.com/features/overv...ar-regression/) in order to create a program that defines my function.Then, I used the nl command and specified the initial values.

When I run the command, I get the following message:

verify that nlces is a function evaluator program
r(198);

Would you please help me figure out what the problem is? I am a beginner in Stata software.
Thanks in advance.