I was hoping someone may be able to help with the following. I fit the model below using the pscl package. I am modelling catch data (about 17,000 entry points) so lots of zero's fit.hurdle.bin = hurdle(Catch ~ Beach + Region + Year+ Decade + Month + Season + Whale+ Sex + Size+ meantemp + meanviz + offset(log(Length.nets..km.)), dist="poisson",zero.dist="binomial",link="logit",trace=T) The model output tells me that: Warning message: In sqrt(diag(object$vcov)) : NaNs produced (against year) I then use hurdle control with "L-BFGS-B" to set some parameter controls to solve this issue, but get the warning message: L-BFGS-B needs finite values of 'fn' In addition: Warning message: In optim(fn = countDist, gr = countGrad, par = c(start$count, if (dist == : method L-BFGS-B uses 'factr' (and 'pgtol') instead of 'reltol' and 'abstol' How do I write the script for Hurdle control to solve these issues? Any help would be really appreciated All the best Matt Dr. Matt Dicken Senior Scientist Telephone: 0315660400 | Fax: 0315660493 | Email: matt at shark.co.za Physical Address: 1a Herrwood Drive, Umhlanga Rocks, 4320 | www.shark.co.za [http://www.shark.co.za/ImageHandler.ashx?fguid=2c107195-209c-4fb2-aae5-31e45ce5de1a] Connect with us on social media: [KZNSB Facebook] <https://www.facebook.com/kznsb> [KZNSB Twitter] <https://twitter.com/KznSharks?lang=en> [[alternative HTML version deleted]]
Please refrain from cross-posting. The same request was sent to the author of hurdle(), R-help, and StackOverflow (where it was already answered). Also, do provide self-contained and reproducible code as would be appropriate in any of the three cases. On Mon, 17 Aug 2015, Matt Dicken wrote:> > I was hoping someone may be able to help with the following. > > I fit the model below using the pscl package. I am modelling catch data (about 17,000 entry points) so lots of zero's > > fit.hurdle.bin = hurdle(Catch ~ Beach + Region + Year+ > Decade + Month + Season + Whale+ Sex + Size+ meantemp + > meanviz + offset(log(Length.nets..km.)), > dist="poisson",zero.dist="binomial",link="logit",trace=T) > > The model output tells me that: > Warning message: In sqrt(diag(object$vcov)) : NaNs produced (against year) > > I then use hurdle control with "L-BFGS-B" to set some parameter controls to solve this issue, but get the warning message: > L-BFGS-B needs finite values of 'fn' > In addition: Warning message: > In optim(fn = countDist, gr = countGrad, par = c(start$count, if (dist == : > method L-BFGS-B uses 'factr' (and 'pgtol') instead of 'reltol' and 'abstol' > > How do I write the script for Hurdle control to solve these issues? > Any help would be really appreciated > All the best > Matt > > > > > > Dr. Matt Dicken > Senior Scientist > Telephone: 0315660400 | Fax: 0315660493 | Email: matt at shark.co.za > Physical Address: 1a Herrwood Drive, Umhlanga Rocks, 4320 | www.shark.co.za > > [http://www.shark.co.za/ImageHandler.ashx?fguid=2c107195-209c-4fb2-aae5-31e45ce5de1a] > > Connect with us on social media: [KZNSB Facebook] <https://www.facebook.com/kznsb> [KZNSB Twitter] <https://twitter.com/KznSharks?lang=en> > > [[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 > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Dear Achim, Apologies for the cross posting and confusion. I really appreciate the help All the best Matt -----Original Message----- From: Achim Zeileis [mailto:Achim.Zeileis at R-project.org] Sent: 17 August, 2015 10:06 PM To: Matt Dicken <matt at shark.co.za> Cc: r-help at r-project.org Subject: Re: [R] hurdle control and optim Please refrain from cross-posting. The same request was sent to the author of hurdle(), R-help, and StackOverflow (where it was already answered). Also, do provide self-contained and reproducible code as would be appropriate in any of the three cases. On Mon, 17 Aug 2015, Matt Dicken wrote:> > I was hoping someone may be able to help with the following. > > I fit the model below using the pscl package. I am modelling catch > data (about 17,000 entry points) so lots of zero's > > fit.hurdle.bin = hurdle(Catch ~ Beach + Region + Year+ > Decade + Month + Season + Whale+ Sex + Size+ meantemp + > meanviz + offset(log(Length.nets..km.)), > > dist="poisson",zero.dist="binomial",link="logit",trace=T) > > The model output tells me that: > Warning message: In sqrt(diag(object$vcov)) : NaNs produced (against > year) > > I then use hurdle control with "L-BFGS-B" to set some parameter controls to solve this issue, but get the warning message: > L-BFGS-B needs finite values of 'fn' > In addition: Warning message: > In optim(fn = countDist, gr = countGrad, par = c(start$count, if (dist == : > method L-BFGS-B uses 'factr' (and 'pgtol') instead of 'reltol' and 'abstol' > > How do I write the script for Hurdle control to solve these issues? > Any help would be really appreciated > All the best > Matt > > > > > > Dr. Matt Dicken > Senior Scientist > Telephone: 0315660400 | Fax: 0315660493 | Email: matt at shark.co.za > Physical Address: 1a Herrwood Drive, Umhlanga Rocks, 4320 | > www.shark.co.za > > [http://www.shark.co.za/ImageHandler.ashx?fguid=2c107195-209c-4fb2-aae > 5-31e45ce5de1a] > > Connect with us on social media: [KZNSB Facebook] > <https://www.facebook.com/kznsb> [KZNSB Twitter] > <https://twitter.com/KznSharks?lang=en> > > [[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 > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >