Syela,

If you want to constrain parameter "a" to be positive, you can rewrite the
equation replacing "a" with "exp(theta)".  Then when you get the estimate
for "theta", simply convert it back to "a".

Jean

On Mon, Oct 3, 2016 at 12:23 PM, Syela Mohd Noor <syelamohdn...@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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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