Gamma GLM - Derive prediction intervals for new x_iCan we make probabilistic statements with prediction...

Compelling story with the world as a villain

Are modern clipless shoes and pedals that much better than toe clips and straps?

Is there any practical application for performing a double Fourier transform? ...or an inverse Fourier transform on a time-domain input?

How to determine car loan length as a function of how long I plan to keep a car

Architectural feasibility of a tiered circular stone keep

How to estimate Scoville level of home-made pepper sauce??

Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?

Would the Republic of Ireland and Northern Ireland be interested in reuniting?

Why isn't "I've" a proper response?

Why do all fields in a QFT transform like *irreducible* representations of some group?

Did a flight controller ever answer Flight with a no-go?

Why does The Ancient One think differently about Doctor Strange in Endgame than the film Doctor Strange?

Is "The life is beautiful" incorrect or just very non-idiomatic?

French abbreviation for comparing two items ("vs")

Command in bash shell script to find path to that script?

Disambiguation of "nobis vobis" and "nobis nobis"

Who was president of the USA?

Nothing like a good ol' game of ModTen

What is this symbol: semicircles facing each other?

Is it possible to perform a regression where you have an unknown / unknowable feature variable?

Why do banks “park” their money at the European Central Bank?

Dataset human solutions for OR problems

How would you identify when an object in a Lissajous orbit needs station keeping?

Is immersion of utensils (tevila) valid before koshering (hagala)?



Gamma GLM - Derive prediction intervals for new x_i


Can we make probabilistic statements with prediction intervals?Does it make sense to generate prediction intervals for the estimates of a logistic regression?Credible/Confidence intervals for fitted valuesIs the canonical parameter (and therefore the canonical link function) for a Gamma not unique?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2












$begingroup$


In a Gamma GLM, the statistical model for each observation 𝑖 is assumed to be $Y_i sim Gamma(shape, scale)$, where $E(Y_i) = mu_i = f(X_ibeta)$, and $f$ is the link function.



I've used MLE to estimate $hat{beta}$ and $hat{scale}$, and wish to produce a 90% prediction interval on a new point $Y'$ given $X'$.



I can produce the confidence intervals on $E(Y|X') = mu'$ by using link function $f$ on the normally distributed confidence intervals for $Xhat{beta}$. Let's say $hat{mu'} = 10$ and 90% confidence intervals are [5, 30].



However, we want the intervals from the distribution of $Y'$, not $mu'$. Intuitively, these intervals should be much wider than the confidence intervals for $mu'$ I think they should also be wider than the 5th and 95th percentile of a single Gamma distribution with $mu=hat{mu'}$, since the uncertainty around $hat{mu'}$ should translate into increased uncertainty around the final distribution, sort of like an vague prior on a bayesian posterior distribution.



What is the correct way to model prediction intervals on the new point $Y'$?



The below schema shows how uncertainty on $mu'$ translates into many possible gamma distributions and a wide prediction interval for $Y'$



schema of Y'



References:



https://www.rocscience.com/help/swedge/swedge/Gamma_Distribution.htm



https://www.statsmodels.org/stable/glm.html










share|cite|improve this question











$endgroup$














  • $begingroup$
    The interval you are asking for is called a prediction-interval. A confidence interval is something else.
    $endgroup$
    – whuber
    2 days ago










  • $begingroup$
    Thanks @whuber, fixed
    $endgroup$
    – Nelson
    2 days ago


















2












$begingroup$


In a Gamma GLM, the statistical model for each observation 𝑖 is assumed to be $Y_i sim Gamma(shape, scale)$, where $E(Y_i) = mu_i = f(X_ibeta)$, and $f$ is the link function.



I've used MLE to estimate $hat{beta}$ and $hat{scale}$, and wish to produce a 90% prediction interval on a new point $Y'$ given $X'$.



I can produce the confidence intervals on $E(Y|X') = mu'$ by using link function $f$ on the normally distributed confidence intervals for $Xhat{beta}$. Let's say $hat{mu'} = 10$ and 90% confidence intervals are [5, 30].



However, we want the intervals from the distribution of $Y'$, not $mu'$. Intuitively, these intervals should be much wider than the confidence intervals for $mu'$ I think they should also be wider than the 5th and 95th percentile of a single Gamma distribution with $mu=hat{mu'}$, since the uncertainty around $hat{mu'}$ should translate into increased uncertainty around the final distribution, sort of like an vague prior on a bayesian posterior distribution.



What is the correct way to model prediction intervals on the new point $Y'$?



The below schema shows how uncertainty on $mu'$ translates into many possible gamma distributions and a wide prediction interval for $Y'$



schema of Y'



References:



https://www.rocscience.com/help/swedge/swedge/Gamma_Distribution.htm



https://www.statsmodels.org/stable/glm.html










share|cite|improve this question











$endgroup$














  • $begingroup$
    The interval you are asking for is called a prediction-interval. A confidence interval is something else.
    $endgroup$
    – whuber
    2 days ago










  • $begingroup$
    Thanks @whuber, fixed
    $endgroup$
    – Nelson
    2 days ago














2












2








2





$begingroup$


In a Gamma GLM, the statistical model for each observation 𝑖 is assumed to be $Y_i sim Gamma(shape, scale)$, where $E(Y_i) = mu_i = f(X_ibeta)$, and $f$ is the link function.



I've used MLE to estimate $hat{beta}$ and $hat{scale}$, and wish to produce a 90% prediction interval on a new point $Y'$ given $X'$.



I can produce the confidence intervals on $E(Y|X') = mu'$ by using link function $f$ on the normally distributed confidence intervals for $Xhat{beta}$. Let's say $hat{mu'} = 10$ and 90% confidence intervals are [5, 30].



However, we want the intervals from the distribution of $Y'$, not $mu'$. Intuitively, these intervals should be much wider than the confidence intervals for $mu'$ I think they should also be wider than the 5th and 95th percentile of a single Gamma distribution with $mu=hat{mu'}$, since the uncertainty around $hat{mu'}$ should translate into increased uncertainty around the final distribution, sort of like an vague prior on a bayesian posterior distribution.



What is the correct way to model prediction intervals on the new point $Y'$?



The below schema shows how uncertainty on $mu'$ translates into many possible gamma distributions and a wide prediction interval for $Y'$



schema of Y'



References:



https://www.rocscience.com/help/swedge/swedge/Gamma_Distribution.htm



https://www.statsmodels.org/stable/glm.html










share|cite|improve this question











$endgroup$




In a Gamma GLM, the statistical model for each observation 𝑖 is assumed to be $Y_i sim Gamma(shape, scale)$, where $E(Y_i) = mu_i = f(X_ibeta)$, and $f$ is the link function.



I've used MLE to estimate $hat{beta}$ and $hat{scale}$, and wish to produce a 90% prediction interval on a new point $Y'$ given $X'$.



I can produce the confidence intervals on $E(Y|X') = mu'$ by using link function $f$ on the normally distributed confidence intervals for $Xhat{beta}$. Let's say $hat{mu'} = 10$ and 90% confidence intervals are [5, 30].



However, we want the intervals from the distribution of $Y'$, not $mu'$. Intuitively, these intervals should be much wider than the confidence intervals for $mu'$ I think they should also be wider than the 5th and 95th percentile of a single Gamma distribution with $mu=hat{mu'}$, since the uncertainty around $hat{mu'}$ should translate into increased uncertainty around the final distribution, sort of like an vague prior on a bayesian posterior distribution.



What is the correct way to model prediction intervals on the new point $Y'$?



The below schema shows how uncertainty on $mu'$ translates into many possible gamma distributions and a wide prediction interval for $Y'$



schema of Y'



References:



https://www.rocscience.com/help/swedge/swedge/Gamma_Distribution.htm



https://www.statsmodels.org/stable/glm.html







generalized-linear-model gamma-distribution prediction-interval statsmodels






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited 2 days ago







Nelson

















asked 2 days ago









NelsonNelson

1237 bronze badges




1237 bronze badges















  • $begingroup$
    The interval you are asking for is called a prediction-interval. A confidence interval is something else.
    $endgroup$
    – whuber
    2 days ago










  • $begingroup$
    Thanks @whuber, fixed
    $endgroup$
    – Nelson
    2 days ago


















  • $begingroup$
    The interval you are asking for is called a prediction-interval. A confidence interval is something else.
    $endgroup$
    – whuber
    2 days ago










  • $begingroup$
    Thanks @whuber, fixed
    $endgroup$
    – Nelson
    2 days ago
















$begingroup$
The interval you are asking for is called a prediction-interval. A confidence interval is something else.
$endgroup$
– whuber
2 days ago




$begingroup$
The interval you are asking for is called a prediction-interval. A confidence interval is something else.
$endgroup$
– whuber
2 days ago












$begingroup$
Thanks @whuber, fixed
$endgroup$
– Nelson
2 days ago




$begingroup$
Thanks @whuber, fixed
$endgroup$
– Nelson
2 days ago










1 Answer
1






active

oldest

votes


















4













$begingroup$

The prediction interval for a new observation depends on both the assumed inherent randomness in this case given by the gamma distribution, and the uncertainty coming from the parameters that are estimated and not assumed to be known.



In general there is no analytical or closed form expression for the combination of the two effects. The two main options are to ignore parameter uncertainty and to use simulation methods.



Ignoring parameter uncertainty: If we ignore that the parameters are estimated with some sampling uncertainty, the the distribution of a new observation is just given by the assumed gamma distribution. We can use the mean and scale estimates to compute the relevant prediction intervals using e.g. the distribution methods in scipy.stats. The parameterization might have to be transformed from the GLM parameterization to the scipy.stats parameterization.



Simulation Methods: One possibility is to use full bootstrap on the original sample to simulate new observations. The simpler method is to assume that the asymptotic normal distribution for the parameter estimates are appropriate and simulate the parameters of the gamma distribution from the mean and covariance of the parameter estimates. For each sampled parameter we can sample a new observation and compute a confidence interval from the simulated observations.
One problem with this is that GLM only estimates the mean parameters directly, the scale is estimated using deviance or pearson chi2. That is, GLM in statsmodels in other packages does not provide a joint covariance for mean and scale parameter.



Because of these problems, statsmodels currently provides prediction intervals for new observations that take parameter uncertainty into account only for the linear normal case, i.e. OLS.






share|cite|improve this answer









$endgroup$











  • 1




    $begingroup$
    Thanks @Josef. How about sampling the underlying data with replacement, fitting the full Gamma GLM on each new sample and predicting y_i, and then take the distribution of those y_i s ? That way, we get some natural variation in the scale parameter by differing deviances
    $endgroup$
    – Nelson
    2 days ago






  • 1




    $begingroup$
    Note that predicting y_i usually means to predict the mean or expected value and not an observation. You would need a draw from the predictive distribution for a new observation. Something like that is an option that includes all estimation uncertainty and what I meant with full bootstrap. The disadvantage is that it is costly to compute because the model has to be estimated for each draw of a bootstrap sample. Using the original parameter estimates as starting values will speed up the computations but there is still a large amount of overhead to compute.
    $endgroup$
    – Josef
    2 days ago














Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "65"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f423169%2fgamma-glm-derive-prediction-intervals-for-new-x-i%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4













$begingroup$

The prediction interval for a new observation depends on both the assumed inherent randomness in this case given by the gamma distribution, and the uncertainty coming from the parameters that are estimated and not assumed to be known.



In general there is no analytical or closed form expression for the combination of the two effects. The two main options are to ignore parameter uncertainty and to use simulation methods.



Ignoring parameter uncertainty: If we ignore that the parameters are estimated with some sampling uncertainty, the the distribution of a new observation is just given by the assumed gamma distribution. We can use the mean and scale estimates to compute the relevant prediction intervals using e.g. the distribution methods in scipy.stats. The parameterization might have to be transformed from the GLM parameterization to the scipy.stats parameterization.



Simulation Methods: One possibility is to use full bootstrap on the original sample to simulate new observations. The simpler method is to assume that the asymptotic normal distribution for the parameter estimates are appropriate and simulate the parameters of the gamma distribution from the mean and covariance of the parameter estimates. For each sampled parameter we can sample a new observation and compute a confidence interval from the simulated observations.
One problem with this is that GLM only estimates the mean parameters directly, the scale is estimated using deviance or pearson chi2. That is, GLM in statsmodels in other packages does not provide a joint covariance for mean and scale parameter.



Because of these problems, statsmodels currently provides prediction intervals for new observations that take parameter uncertainty into account only for the linear normal case, i.e. OLS.






share|cite|improve this answer









$endgroup$











  • 1




    $begingroup$
    Thanks @Josef. How about sampling the underlying data with replacement, fitting the full Gamma GLM on each new sample and predicting y_i, and then take the distribution of those y_i s ? That way, we get some natural variation in the scale parameter by differing deviances
    $endgroup$
    – Nelson
    2 days ago






  • 1




    $begingroup$
    Note that predicting y_i usually means to predict the mean or expected value and not an observation. You would need a draw from the predictive distribution for a new observation. Something like that is an option that includes all estimation uncertainty and what I meant with full bootstrap. The disadvantage is that it is costly to compute because the model has to be estimated for each draw of a bootstrap sample. Using the original parameter estimates as starting values will speed up the computations but there is still a large amount of overhead to compute.
    $endgroup$
    – Josef
    2 days ago
















4













$begingroup$

The prediction interval for a new observation depends on both the assumed inherent randomness in this case given by the gamma distribution, and the uncertainty coming from the parameters that are estimated and not assumed to be known.



In general there is no analytical or closed form expression for the combination of the two effects. The two main options are to ignore parameter uncertainty and to use simulation methods.



Ignoring parameter uncertainty: If we ignore that the parameters are estimated with some sampling uncertainty, the the distribution of a new observation is just given by the assumed gamma distribution. We can use the mean and scale estimates to compute the relevant prediction intervals using e.g. the distribution methods in scipy.stats. The parameterization might have to be transformed from the GLM parameterization to the scipy.stats parameterization.



Simulation Methods: One possibility is to use full bootstrap on the original sample to simulate new observations. The simpler method is to assume that the asymptotic normal distribution for the parameter estimates are appropriate and simulate the parameters of the gamma distribution from the mean and covariance of the parameter estimates. For each sampled parameter we can sample a new observation and compute a confidence interval from the simulated observations.
One problem with this is that GLM only estimates the mean parameters directly, the scale is estimated using deviance or pearson chi2. That is, GLM in statsmodels in other packages does not provide a joint covariance for mean and scale parameter.



Because of these problems, statsmodels currently provides prediction intervals for new observations that take parameter uncertainty into account only for the linear normal case, i.e. OLS.






share|cite|improve this answer









$endgroup$











  • 1




    $begingroup$
    Thanks @Josef. How about sampling the underlying data with replacement, fitting the full Gamma GLM on each new sample and predicting y_i, and then take the distribution of those y_i s ? That way, we get some natural variation in the scale parameter by differing deviances
    $endgroup$
    – Nelson
    2 days ago






  • 1




    $begingroup$
    Note that predicting y_i usually means to predict the mean or expected value and not an observation. You would need a draw from the predictive distribution for a new observation. Something like that is an option that includes all estimation uncertainty and what I meant with full bootstrap. The disadvantage is that it is costly to compute because the model has to be estimated for each draw of a bootstrap sample. Using the original parameter estimates as starting values will speed up the computations but there is still a large amount of overhead to compute.
    $endgroup$
    – Josef
    2 days ago














4














4










4







$begingroup$

The prediction interval for a new observation depends on both the assumed inherent randomness in this case given by the gamma distribution, and the uncertainty coming from the parameters that are estimated and not assumed to be known.



In general there is no analytical or closed form expression for the combination of the two effects. The two main options are to ignore parameter uncertainty and to use simulation methods.



Ignoring parameter uncertainty: If we ignore that the parameters are estimated with some sampling uncertainty, the the distribution of a new observation is just given by the assumed gamma distribution. We can use the mean and scale estimates to compute the relevant prediction intervals using e.g. the distribution methods in scipy.stats. The parameterization might have to be transformed from the GLM parameterization to the scipy.stats parameterization.



Simulation Methods: One possibility is to use full bootstrap on the original sample to simulate new observations. The simpler method is to assume that the asymptotic normal distribution for the parameter estimates are appropriate and simulate the parameters of the gamma distribution from the mean and covariance of the parameter estimates. For each sampled parameter we can sample a new observation and compute a confidence interval from the simulated observations.
One problem with this is that GLM only estimates the mean parameters directly, the scale is estimated using deviance or pearson chi2. That is, GLM in statsmodels in other packages does not provide a joint covariance for mean and scale parameter.



Because of these problems, statsmodels currently provides prediction intervals for new observations that take parameter uncertainty into account only for the linear normal case, i.e. OLS.






share|cite|improve this answer









$endgroup$



The prediction interval for a new observation depends on both the assumed inherent randomness in this case given by the gamma distribution, and the uncertainty coming from the parameters that are estimated and not assumed to be known.



In general there is no analytical or closed form expression for the combination of the two effects. The two main options are to ignore parameter uncertainty and to use simulation methods.



Ignoring parameter uncertainty: If we ignore that the parameters are estimated with some sampling uncertainty, the the distribution of a new observation is just given by the assumed gamma distribution. We can use the mean and scale estimates to compute the relevant prediction intervals using e.g. the distribution methods in scipy.stats. The parameterization might have to be transformed from the GLM parameterization to the scipy.stats parameterization.



Simulation Methods: One possibility is to use full bootstrap on the original sample to simulate new observations. The simpler method is to assume that the asymptotic normal distribution for the parameter estimates are appropriate and simulate the parameters of the gamma distribution from the mean and covariance of the parameter estimates. For each sampled parameter we can sample a new observation and compute a confidence interval from the simulated observations.
One problem with this is that GLM only estimates the mean parameters directly, the scale is estimated using deviance or pearson chi2. That is, GLM in statsmodels in other packages does not provide a joint covariance for mean and scale parameter.



Because of these problems, statsmodels currently provides prediction intervals for new observations that take parameter uncertainty into account only for the linear normal case, i.e. OLS.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered 2 days ago









JosefJosef

1,7431 gold badge10 silver badges12 bronze badges




1,7431 gold badge10 silver badges12 bronze badges











  • 1




    $begingroup$
    Thanks @Josef. How about sampling the underlying data with replacement, fitting the full Gamma GLM on each new sample and predicting y_i, and then take the distribution of those y_i s ? That way, we get some natural variation in the scale parameter by differing deviances
    $endgroup$
    – Nelson
    2 days ago






  • 1




    $begingroup$
    Note that predicting y_i usually means to predict the mean or expected value and not an observation. You would need a draw from the predictive distribution for a new observation. Something like that is an option that includes all estimation uncertainty and what I meant with full bootstrap. The disadvantage is that it is costly to compute because the model has to be estimated for each draw of a bootstrap sample. Using the original parameter estimates as starting values will speed up the computations but there is still a large amount of overhead to compute.
    $endgroup$
    – Josef
    2 days ago














  • 1




    $begingroup$
    Thanks @Josef. How about sampling the underlying data with replacement, fitting the full Gamma GLM on each new sample and predicting y_i, and then take the distribution of those y_i s ? That way, we get some natural variation in the scale parameter by differing deviances
    $endgroup$
    – Nelson
    2 days ago






  • 1




    $begingroup$
    Note that predicting y_i usually means to predict the mean or expected value and not an observation. You would need a draw from the predictive distribution for a new observation. Something like that is an option that includes all estimation uncertainty and what I meant with full bootstrap. The disadvantage is that it is costly to compute because the model has to be estimated for each draw of a bootstrap sample. Using the original parameter estimates as starting values will speed up the computations but there is still a large amount of overhead to compute.
    $endgroup$
    – Josef
    2 days ago








1




1




$begingroup$
Thanks @Josef. How about sampling the underlying data with replacement, fitting the full Gamma GLM on each new sample and predicting y_i, and then take the distribution of those y_i s ? That way, we get some natural variation in the scale parameter by differing deviances
$endgroup$
– Nelson
2 days ago




$begingroup$
Thanks @Josef. How about sampling the underlying data with replacement, fitting the full Gamma GLM on each new sample and predicting y_i, and then take the distribution of those y_i s ? That way, we get some natural variation in the scale parameter by differing deviances
$endgroup$
– Nelson
2 days ago




1




1




$begingroup$
Note that predicting y_i usually means to predict the mean or expected value and not an observation. You would need a draw from the predictive distribution for a new observation. Something like that is an option that includes all estimation uncertainty and what I meant with full bootstrap. The disadvantage is that it is costly to compute because the model has to be estimated for each draw of a bootstrap sample. Using the original parameter estimates as starting values will speed up the computations but there is still a large amount of overhead to compute.
$endgroup$
– Josef
2 days ago




$begingroup$
Note that predicting y_i usually means to predict the mean or expected value and not an observation. You would need a draw from the predictive distribution for a new observation. Something like that is an option that includes all estimation uncertainty and what I meant with full bootstrap. The disadvantage is that it is costly to compute because the model has to be estimated for each draw of a bootstrap sample. Using the original parameter estimates as starting values will speed up the computations but there is still a large amount of overhead to compute.
$endgroup$
– Josef
2 days ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Cross Validated!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f423169%2fgamma-glm-derive-prediction-intervals-for-new-x-i%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...