Dear Statalist experts,
I think this is sort of basic question (looked it up here before posting but could not find the answer, perhaps I used wrong search terms, if so, my apologies).
Summary of my case: I have stored estimates from two negative binomial regression models for which I would like to estimate the difference and 95% CI using delta method.
Details:
I'm running two negative binomial regression models on a time-series data. The models are adjusted for seasonality (using sin/cos function) and sex. I am trying to predict the outcome (incidence rate for a certain disease) under two different scenarios (out-of-sample prediction?). I managed to store these predictions from the two different models, for certain time points, using prvalue command in a loop. Below are the steps used.
First, running the first model on a specific segment in time series:
n is the count outcome of interest, t is the time since beginning of study, and tin specifies the time segment (from beginning to December 2009) that I am using to get the predicted rates in another time segment that starts from t=91 and ends at t=144 (from January 2011 to the end of the study), as shown below:
so now I've stored the predicted rates and corresponding delta-based 95% CI as est, est_lo and est_hi.
Now to the second model (only change is the model running on different time segment, therefore yielding the counterfactual scenario):
And the predictions from this model:
The predicted rates and corresponding delta-based 95% CI are now stored as exp, exp_lo and exp_hi.
To my question: I would like to estimate the difference between est and exp values, and the delta-based 95% CI for this difference. I could not figure out the way to do that.
Your advice is much appreciated.
Omar
I think this is sort of basic question (looked it up here before posting but could not find the answer, perhaps I used wrong search terms, if so, my apologies).
Summary of my case: I have stored estimates from two negative binomial regression models for which I would like to estimate the difference and 95% CI using delta method.
Details:
I'm running two negative binomial regression models on a time-series data. The models are adjusted for seasonality (using sin/cos function) and sex. I am trying to predict the outcome (incidence rate for a certain disease) under two different scenarios (out-of-sample prediction?). I managed to store these predictions from the two different models, for certain time points, using prvalue command in a loop. Below are the steps used.
First, running the first model on a specific segment in time series:
Code:
nbreg n t sex cos* sin* if tin( ,2009m12), vce(robust) offset(logcohort) irr
Code:
foreach i of num 91/144 { qui prvalue, x(t=`i') rest(mean) level(95) delta replace est=r(mu) if t==`i' replace est_hi=r(mu_hi) if t==`i' replace est_lo=r(mu_lo) if t==`i' }
Now to the second model (only change is the model running on different time segment, therefore yielding the counterfactual scenario):
Code:
est clear nbreg n t sex cos* sin* if tin(2011m1, ), vce(robust) offset(logcohort) irr
Code:
foreach i of num 91/144 { qui prvalue if tin(2011m1, ), x(t=`i') rest(mean) level(95) delta replace exp=r(mu) if t==`i' replace exp_hi=r(mu_hi) if t==`i' replace exp_lo=r(mu_lo) if t==`i' } *
To my question: I would like to estimate the difference between est and exp values, and the delta-based 95% CI for this difference. I could not figure out the way to do that.
Your advice is much appreciated.
Omar
Comment