Please how can one go about this one? I don't know how to go about it.
MLE Estimation of Gamma Distribution Parameters for data with 'zeros'
6 messages · Nyasha, Bert Gunter, Peter Dalgaard +3 more
3 days later
Is this homework? This list has a no-homework policy. -- Bert
On Tue, Jan 10, 2023 at 8:13 AM Nyasha <kahuninyasha13296 at gmail.com> wrote:
Please how can one go about this one? I don't know how to go about it.
[[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.
8 days later
Not necessarily homework, Bert. There's a generic issue with MLE and rounded data, in that gamma densities may be 0 at the boundary but small numbers are represented as 0, making the log-likelihood -Inf. The cleanest way out is to switch to a discretized distribution in the likelihood, so that instead of log(dgamma(0,...)) you use log(pgamma(.005,..) - pgamma(0,...)) == pgamma(.005,..., log=TRUE). (For data rounded to nearest .01, that is). Cruder techniques would be to just add, like, .0025 to all the zeros. -pd
On 10 Jan 2023, at 18:42 , Bert Gunter <bgunter.4567 at gmail.com> wrote: Is this homework? This list has a no-homework policy. -- Bert On Tue, Jan 10, 2023 at 8:13 AM Nyasha <kahuninyasha13296 at gmail.com> wrote:
Please how can one go about this one? I don't know how to go about it.
[[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.
______________________________________________ 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.
Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Beware of adding a constant... the magnitude of the constant used can have an outsized impact on the answer obtained. See e.g. https://gist.github.com/jdnewmil/99301a88de702ad2fcbaef33326b08b4
On January 19, 2023 3:49:29 AM PST, peter dalgaard <pdalgd at gmail.com> wrote:
Not necessarily homework, Bert. There's a generic issue with MLE and rounded data, in that gamma densities may be 0 at the boundary but small numbers are represented as 0, making the log-likelihood -Inf. The cleanest way out is to switch to a discretized distribution in the likelihood, so that instead of log(dgamma(0,...)) you use log(pgamma(.005,..) - pgamma(0,...)) == pgamma(.005,..., log=TRUE). (For data rounded to nearest .01, that is). Cruder techniques would be to just add, like, .0025 to all the zeros. -pd
On 10 Jan 2023, at 18:42 , Bert Gunter <bgunter.4567 at gmail.com> wrote: Is this homework? This list has a no-homework policy. -- Bert On Tue, Jan 10, 2023 at 8:13 AM Nyasha <kahuninyasha13296 at gmail.com> wrote:
Please how can one go about this one? I don't know how to go about it.
[[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.
______________________________________________ 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.
Sent from my phone. Please excuse my brevity.
There's at least one package that can do zero-inflated gamma regression (Rfast2::zigamma). I'm not sure it's ML, though. On Thu, Jan 19, 2023 at 10:17 AM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
Beware of adding a constant... the magnitude of the constant used can have an outsized impact on the answer obtained. See e.g. https://gist.github.com/jdnewmil/99301a88de702ad2fcbaef33326b08b4 On January 19, 2023 3:49:29 AM PST, peter dalgaard <pdalgd at gmail.com> wrote:
Not necessarily homework, Bert. There's a generic issue with MLE and
rounded data, in that gamma densities may be 0 at the boundary but small numbers are represented as 0, making the log-likelihood -Inf.
The cleanest way out is to switch to a discretized distribution in the
likelihood, so that instead of log(dgamma(0,...)) you use log(pgamma(.005,..) - pgamma(0,...)) == pgamma(.005,..., log=TRUE). (For data rounded to nearest .01, that is). Cruder techniques would be to just add, like, .0025 to all the zeros.
-pd
On 10 Jan 2023, at 18:42 , Bert Gunter <bgunter.4567 at gmail.com> wrote: Is this homework? This list has a no-homework policy. -- Bert On Tue, Jan 10, 2023 at 8:13 AM Nyasha <kahuninyasha13296 at gmail.com>
wrote:
Please how can one go about this one? I don't know how to go about it.
[[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. ______________________________________________ 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. -- Sent from my phone. Please excuse my brevity. ______________________________________________ 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.
Another situation for the presence of 0 is about dosage when concentration is below the detection limit. It is not necessary to discretize the data. We propose a method here: Salvat-Leal I, Cort?s-G?mez AA, Romero D, Girondot M (2022) New method for imputation of unquanti?able values using Bayesian statistics for a mixture of censored or truncated distributions: Application to trace elements measured in blood of olive ridley sea turtles from mexico. Animals 2022: 2919 doi 10.3390/ani12212919 with R code. If the data has "true" 0, the gamma distribution is not the best choice as 0 is impossible with gamma distribution. Marc Le 19/01/2023 ? 12:49, peter dalgaard a ?crit?:
Not necessarily homework, Bert. There's a generic issue with MLE and rounded data, in that gamma densities may be 0 at the boundary but small numbers are represented as 0, making the log-likelihood -Inf. The cleanest way out is to switch to a discretized distribution in the likelihood, so that instead of log(dgamma(0,...)) you use log(pgamma(.005,..) - pgamma(0,...)) == pgamma(.005,..., log=TRUE). (For data rounded to nearest .01, that is). Cruder techniques would be to just add, like, .0025 to all the zeros. -pd
On 10 Jan 2023, at 18:42 , Bert Gunter <bgunter.4567 at gmail.com> wrote: Is this homework? This list has a no-homework policy. -- Bert On Tue, Jan 10, 2023 at 8:13 AM Nyasha <kahuninyasha13296 at gmail.com> wrote:
Please how can one go about this one? I don't know how to go about it.
[[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.
______________________________________________ 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.