# [R] Trouble with parameter estimation in nonlinear regression model

Jim Lemon drjimlemon at gmail.com
Tue Oct 4 00:25:52 CEST 2016

```Hi Syela,
Are the values in ASFR monotonically increasing with year?

Jim

On Tue, Oct 4, 2016 at 4:23 AM, Syela Mohd Noor <syelamohdnoor at gmail.com> wrote:
> Hi all, I had a problem with the parameter estimation of the Brass Gompertz
> model for my dissertation. I run the code for several times based on
> different years and it was fine until the seventh year onward where I got
> negative values for the parameter (a) which did not make sense since it
> represents the total fertility rate of a country.
> This is my code :
>
> gom.eq=function(a, b, c)
>
> {
>
>     age=c(17.5, 22.5, 27.5, 32.5, 37.5, 42.5 , 47.5)
>
>     k=(-(age-14)/b)
>
>     (a*((c/b)*(exp((k)-(c*(exp(k)))))))
>
> }
>
>
>
> varlist=list(
> ASFR\$Y1960,ASFR\$Y1965,ASFR\$Y1970,ASFR\$Y1975,ASFR\$Y1980,ASFR\$Y1985,
>
> ASFR\$Y1990,ASFR\$Y1995,ASFR\$Y2000,ASFR\$Y2005,ASFR\$Y2010,ASFR\$Y2013)
>
>
>
> gom.models=lapply(varlist, function(varlist)
>
> {
>
> nlsLM(varlist~gom.eq(a,b,c),data=ASFR,start=list(a=1 , b=1, c=1),trace=T)
>
> })
>
> summary(gom.models)
>
>
>
> gom.models[1:12]
>
>
>
>
> Any idea to solve the problem?
>
>
> Regards,
>
> Syela M.N.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help