




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















February 19, 2004
The joint probability of the data (the likelihood) is given by
∏^ n
i=
pYi(1 − p)^1 −Yi
= p
Pn i=1 Yi(1 − p)n−
Pn i=1 Yi.
For estimation, we will work with the log-likelihood
l = log(L) =
∑^ n
i=
Yi log(p) + (n −
∑^ n
i=
Yi)log(1 − p).
The maximum likelihood estimate (MLE) of p is that value that maximizes l (equivalent to maximizing L).
The first derivative of l with respect to p is
U (p) =
∂l ∂p
∑^ n
i=
Yi/p − (n −
∑^ n
i=
Yi)/(1 − p)
and is referred to as the score funcion. To calculate the MLE of p, we set the score function, U (p) equal to 0 and solve for p. In this case, we get an MLE of p that is
p ˆ =
∑^ n
i=
Yi/n.
We can estimate the information by substituting the MLE of p into I(p), yielding I(ˆp) = (^) p ˆ(1n−pˆ).
Our next interest may be in making inference about the parameter p. We can use the the inverse of the information evaluated at the MLE to estimate the variance of pˆ as
var̂ (ˆp) = I(ˆp)−^1 =
pˆ(1 − pˆ) n
For large n, pˆ is approximately normally distributed with mean p and variance p(1 − p)/n. Therefore, we can construct a 100 × (1 − α)% confidence interval for p as
p ˆ ± Z 1 −α/ 2 [ˆp(1 − pˆ)/n]^1 /^2.
For the binary outcome discussed above, if the hypothesis is H 0 : p = p 0 vs HA : p 6 = p 0 , then
l(H 0 ) =
∑^ n
i=
Yi log(p 0 ) + (n −
∑^ n
i=
Yi) log(1 − p 0 ),
l(M LE) =
∑^ n
i=
Yi log(ˆp) + (n −
∑^ n
i=
Yi) log(1 − pˆ)
and the LRT statistic is
[ (^) n ∑
i=
Yi log(p 0 /pˆ) + (n −
∑^ n
i=
Yi) log{(1 − p 0 )(1 − pˆ)}
where LR ∼ χ^21.
The Wald test statistic is a function of the difference in the MLE and the hypothesized value, normalized by an estimate of the standard deviation of the MLE. In our binary outcome example,
W =
(ˆp − p 0 )^2 p ˆ(1 − pˆ)/n
For large n, W ∼ χ^2 with 1 degree of freedom. In R, you will see
W ∼ N (0, 1) reported.
So far, we’ve learned how to estimate p and to test p in the one-sample bernoulli case. How can we use this with logistic regression.
Remember: E[Yi] = πi
and logit(πi) = β 0 + β 1 xi 1 + · · · + βpxip = x′ iβ,
where xi = (1, xi 1 ,... xip)′^ and β = (β 0 ,... , βp)′. Therefore
E[Yi] =
exp(x′ iβ) 1 + exp(x′ iβ)
The p + 1 score functions of β for the logistic regression model cannot be solved analytically. It is common to use a numerical algorithm, such as the Newton-Raphson algorithm, to obtain the MLEs.
The information in this case will be a (p + 1) × (p + 1) matrix of the partial second derivatives of l with respect to the parameters, β. The inverted information matrix is the covariance matrix for βˆ.
To test a single logistic regression coefficient, we will use the Wald test, βˆj − βj 0 se ˆ( βˆ)
where seˆ ( βˆ) is calculated by taking the inverse of the estimated information matrix. This value is given to you in the R output for βj 0 = 0. As in linear regression, this test is conditional on all other coefficients being in the model.
logit(πi) = β 0 + β 1 xi 1 + · · · + βpxip,
a (1 − α/2) × 100% confidence interval for βj, j = 1,... , p, can easily be calculated as
β^ ˆj ± Z 1 −α/ 2 seˆ( βˆj).
The (1 − α/2) × 100% confidence interval for the odds ratio over a one unit change in xj is [ exp( βˆj − Z 1 −α/ 2 seˆ( βˆj)), exp( βˆj + Z 1 −α/ 2 seˆ ( βˆj))
What about for a 10 unit change in xj?
logit(πi) = β 0 + β 1 cad.duri + β 2 genderi. Estimate Std. Error z value Pr(>|z|) (Intercept) −0.3203 0.0579 −5.53 0. cad.dur 0.0074 0.0008 9.30 0. sex −0.3913 0.1078 −3.63 0.
95% CI for a one-unit change in cad.dur:
e^0.^0058 , e^0.^0090
How can we construct a similar confidence interval for males vs. females?