Good afternoon.
I do hope this one finds you well.
While challenging myself with the examples reported in the valuable https://www.stata.com/bookstore/flex...nalysis-stata/, I came across a -glm- option (-lnoffset-, that do the very same job of -exposure-) that does not seem to be documented in the Stata .pdf manual.
Code:
. use http://www.stata-press.com/data/r16/kva.dta
(Generator experiment)
. streg load, dist(exp) nohr
failure _d: 1 (meaning all fail)
analysis time _t: failtime
Iteration 0: log likelihood = -13.666193
Iteration 1: log likelihood = -12.349873
Iteration 2: log likelihood = -12.209674
Iteration 3: log likelihood = -12.20947
Iteration 4: log likelihood = -12.20947
Exponential PH regression
No. of subjects = 12 Number of obs = 12
No. of failures = 12
Time at risk = 896
LR chi2(1) = 2.91
Log likelihood = -12.20947 Prob > chi2 = 0.0878
------------------------------------------------------------------------------
_t | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
load | .0611146 .0353537 1.73 0.084 -.0081773 .1304065
_cons | -5.872291 1.014178 -5.79 0.000 -7.860043 -3.884539
------------------------------------------------------------------------------
. glm _d load, link(log) family(poisson) lnoffset(failtime)
Iteration 0: log likelihood = -12.211312
Iteration 1: log likelihood = -12.20947
Iteration 2: log likelihood = -12.20947
Generalized linear models Number of obs = 12
Optimization : ML Residual df = 10
Scale parameter = 1
Deviance = .4189406353 (1/df) Deviance = .0418941
Pearson = .4323557572 (1/df) Pearson = .0432356
Variance function: V(u) = u [Poisson]
Link function : g(u) = ln(u) [Log]
AIC = 2.368245
Log likelihood = -12.20947032 BIC = -24.43013
------------------------------------------------------------------------------
| OIM
_d | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
load | .0611146 .0353537 1.73 0.084 -.0081773 .1304065
_cons | -5.872291 1.014178 -5.79 0.000 -7.860043 -3.884539
ln(failtime) | 1 (exposure)
------------------------------------------------------------------------------
. glm _d load, link(log) family(poisson) exp(failtime)
Iteration 0: log likelihood = -12.211312
Iteration 1: log likelihood = -12.20947
Iteration 2: log likelihood = -12.20947
Generalized linear models Number of obs = 12
Optimization : ML Residual df = 10
Scale parameter = 1
Deviance = .4189406353 (1/df) Deviance = .0418941
Pearson = .4323557572 (1/df) Pearson = .0432356
Variance function: V(u) = u [Poisson]
Link function : g(u) = ln(u) [Log]
AIC = 2.368245
Log likelihood = -12.20947032 BIC = -24.43013
------------------------------------------------------------------------------
| OIM
_d | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
load | .0611146 .0353537 1.73 0.084 -.0081773 .1304065
_cons | -5.872291 1.014178 -5.79 0.000 -7.860043 -3.884539
ln(failtime) | 1 (exposure)
------------------------------------------------------------------------------
. help lnoffset
help for lnoffset not foundThanks.
0 Response to -lnoffset- and -exposure- options from -glm-
Post a Comment