logistic growth model

4 messages
Open this post in threaded view
|
Report Content as Inappropriate

logistic growth model

 I want to Fit a logistic growth model for y = k *eb0+b1(age)/1 + eb0+b1(age), can some one help on how to get the initial coefficients b0 and b1? I need to estimate in order to do the regression analysis. When I run using b0=0.5 and b1=3.4818, I get the following error 397443.8 :  0.5 3.4818 Error in nls(Height ~ k * exp(b1 + b2 * Age)/(1 + exp(b1 + b2 * Age)),  :    singular gradient "please tell me what is wrong with my initials values, and how to get the initial values" ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|
Report Content as Inappropriate

Re: logistic growth model

 Write the growth formula in an R script. Define initial par values. Input the size and age data. Plot the size and age data as points. Plot the growth model with the initial par values as a line. Play with the initial par values until you see a good agreement between the model (the line) and the data (the points). Optimise. Re-plot. Plot a residual histogram. Plot a residual scatterplot. Plot a Q-Q residual plot. HTH Rubén ____________________________________________________________________________________ Dr. Rubén Roa-Ureta AZTI - Tecnalia / Marine Research Unit Txatxarramendi Ugartea z/g 48395 Sukarrieta (Bizkaia) SPAIN > -----Mensaje original----- > De: [hidden email] > [mailto:[hidden email]] En nombre de Renalda > Enviado el: sábado, 04 de junio de 2011 6:17 > Para: [hidden email] > Asunto: [R] logistic growth model > > I want to Fit a logistic growth model for y = k > *eb0+b1(age)/1 + eb0+b1(age), can some one help on how to get > the initial coefficients b0 and b1? I need to estimate in > order to do the regression analysis. When I run using b0=0.5 > and b1=3.4818, I get the following error > > 397443.8 :  0.5 3.4818 > Error in nls(Height ~ k * exp(b1 + b2 * Age)/(1 + exp(b1 + b2 > * Age)),  : >    singular gradient > "please tell me what is wrong with my initials values, and > how to get the initial values" > > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|
Report Content as Inappropriate

Re: logistic growth model

 If you use RStudio (www.rstudio.org) you can find good initial start values by interactive plot using manipulate() function. Look the simple code below. age <- 1:20 k <- 3; b0 <- -5; b1 <- .5 y <-  k*exp(b0+b1*age)/(1+exp(b0+b1*age))+rnorm(age,0,0.1) plot(y~age) start <- list() require(manipulate) manipulate(            {              plot(y~age)              k <- kk; b0 <- b00; b1 <- b10              curve(k*exp(b0+b1*x)/(1+exp(b0+b1*x)), add=TRUE)              start <<- list(k=k, b0=b0, b1=b1)            },            kk=slider(0,5,step=0.1,initial=2.7),            b00=slider(-5,0,step=0.1,initial=-2.5),            b10=slider(0,1,step=0.1,initial=0.5)) start n0 <- nls(y~k*exp(b0+b1*age)/(1+exp(b0+b1*age)), start=start) summary(n0) If you don't use RStudio you can follow the procedures in this blog (that uses gWidgetsRGtk2). http://ridiculas.wordpress.com/2011/04/09/metodo-grafico-interativo-para-valores-iniciais-em-regressao-nao-linear/Bests. Walmes. ========================================================================== Walmes Marques Zeviani LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W) Departamento de Estatística - Universidade Federal do Paraná fone: (+55) 41 3361 3573 VoIP: (3361 3600) 1053 1173 e-mail: [hidden email] twitter: @walmeszeviani homepage: http://www.leg.ufpr.br/~walmeslinux user number: 531218 ========================================================================== On Mon, Jun 6, 2011 at 4:20 AM, Rubén Roa <[hidden email]> wrote: > > Write the growth formula in an R script. > Define initial par values. > Input the size and age data. > Plot the size and age data as points. > Plot the growth model with the initial par values as a line. > Play with the initial par values until you see a good agreement between the > model (the line) and the data (the points). > Optimise. > Re-plot. > Plot a residual histogram. > Plot a residual scatterplot. > Plot a Q-Q residual plot. > > HTH > > Rubén > > ____________________________________________________________________________________ > > Dr. Rubén Roa-Ureta > AZTI - Tecnalia / Marine Research Unit > Txatxarramendi Ugartea z/g > 48395 Sukarrieta (Bizkaia) > SPAIN > > > > > -----Mensaje original----- > > De: [hidden email] > > [mailto:[hidden email]] En nombre de Renalda > > Enviado el: sábado, 04 de junio de 2011 6:17 > > Para: [hidden email] > > Asunto: [R] logistic growth model > > > > I want to Fit a logistic growth model for y = k > > *eb0+b1(age)/1 + eb0+b1(age), can some one help on how to get > > the initial coefficients b0 and b1? I need to estimate in > > order to do the regression analysis. When I run using b0=0.5 > > and b1=3.4818, I get the following error > > > > 397443.8 :  0.5 3.4818 > > Error in nls(Height ~ k * exp(b1 + b2 * Age)/(1 + exp(b1 + b2 > > * Age)),  : > >    singular gradient > > "please tell me what is wrong with my initials values, and > > how to get the initial values" > > > > ______________________________________________ > > [hidden email] 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. > > > > ______________________________________________ > [hidden email] 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. >         [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.