








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!









1
Logistic regression regresses a dichotomous dependent variable on a set of independent variables. Several methods are implemented for selecting the independent variables.
The following notation is used throughout this chapter unless otherwise stated: n (^) The number of observed cases p (^) The number of parameters y (^) n ô 1 vector with element yi , the observed value of the i th case of the dichotomous dependent variable X (^) n ô p matrix with element xij , the observed value of the i th case of the j th parameter β p ô 1 vector with element β (^) j , the coefficient for the j th parameter w (^) n ô 1 vector with element wi , the weight for the i th case l (^) Likelihood function L Log likelihood function I Information matrix
The linear logistic model assumes a dichotomous dependent variable Y with probability
π
η i η
i i
exp exp
1 6 (^1) 1 6
or
ln ’ π π
i η i 1 - i^ i
=^ =^ X^ β
Hence, the likelihood function l for n observations y (^) 1 , K , y (^) n , with probabilities π 1 , K, π n and case weights w 1 (^) , K, wn , can be written as
l (^) iw y i w y i
n = i^ i^ - i^ - i =
1 1
1 6 1 6
It follows that the logarithm of l is
L l w yi i i w (^) i yi i i
n = = + - - =
ln (^) 1 6 2 ln (^) 1 6 π 11 6 1ln 1 π 67 1
and the derivative of L with respect to β (^) j is
X w^ y^ x j
i i i ij i
n j
=
∂β
1 π 6 1
The maximum likelihood estimates for β satisfy the following equations
wi y (^) i i xij i
n
1 p^ $ 6 0 1
, for the j th parameter
where xi 0 = 1 for i = 1, K, n.
Note the following: (1) A Newton-Raphson type algorithm is used to obtain the MLEs. Convergence can be based on (a) Absolute difference for the parameter estimates between the iterations (b) Percent difference in the log-likelihood function between successive iterations (c) Maximum number of iterations specified
S (^) i = 4 L * (^) γ i 9 B i
2 22,
if γ (^) i is not a categorical variable. If γ (^) i is a categorical variable with m categories,
it is converted to a 1 m − 16 -dimension dummy vector. Denote these new m − 1
variables as γ~^ i , K,^ ~γ i + m - 2. The score statistic for^ γ^ i is then
S (^) i = L B (^) i L
where L^ ~γ^ ~^ , , ~*
á = 4 L (^) γ i K L γ i + m - 29 and the 1 m − (^1) 6 1 × m − 16 matrix B 22, i is
1 , i =^ , i −^ , i , i
− − 4 9
with
11
12
22
α α
α γ
γ γ
∼
’ ~
,
’ ~ (^) ~
, ’ ~ ~
i i
i ii i
in which α∼ is the design matrix for variables α 1 , K, α r 1 and γ~ (^) i is the design
matrix for dummy variables γ~ (^) i , K , γ~ i + m - 2. Note that α∼ contains a column of ones
unless the constant term is excluded from η. Based on the MLEs for the
parameters in the model, V is estimated by V $^ = Diag (^) = π $^1 11 - π$^16 , K , π$^ n 11 - π$ n (^6) B.
The asymptotic distribution of the score statistic is a chi-square with degrees of
freedom equal to the number of variables involved.
Note the following:
(1) If the model is through the origin and there are no variables in the model,
B 22, i is defined by A 22 −^1 , i and V $ is equal to 14 I n.
(2) If B 22, i is not positive definite, the score statistic and residual chi-square
statistic are set to be zero.
Wald Statistic
The Wald statistic is calculated for the variables in the model to determine whether a variable should be removed. If the i th variable is not categorical, the Wald statistic is defined by
Wald (^) i i i
β σ β
2 2
If it is a categorical variable, the Wald statistic is computed as follows:
Let β$ i be the vector of maximum likelihood estimates associated with the m − 1 dummy variables, and C the asymptotic covariance matrix for β$ i. The Wald statistic is
Wald (^) i = β^ $^ i á C -^1 β$ i
The asymptotic distribution of the Wald statistic is chi-square with degrees of freedom equal to the number of parameters estimated.
Likelihood Ratio (LR) Statistic
The LR statistic is defined as two times the log of the ratio of the likelihood functions of two models evaluated at their MLEs. The LR statistic is used to determine if a variable should be removed from the model. Assume that there are r 1 variables in the current model which is referred to as a full model. Based on the MLEs of the full model, l ( full ) is calculated. For each of the variables removed from the full model one at a time, MLEs are computed and the likelihood function l ( reduced ) is calculated. The LR statistic is then defined as
l reduced l full
= − L reduced L full
^
^
2 ln = − 2 −
1 6 1 6
2 1 6 1 67
LR is asymptotically chi-square distributed with degrees of freedom equal to the difference between the numbers of parameters estimated in the two models.
Conditional Statistic
The conditional statistic is also computed for every variable in the model. The formula for the conditional statistic is the same as the LR statistic except that the
the current model with the variable deleted is the same as a previous model, stop FSTEP; otherwise, go to the next step. (7) Modify the current model by removing the variable with the largest significance from the previous model. Estimate the parameters for the modified model and go back to step 5.
Backward Stepwise (BSTEP)
(1) Estimate the parameters for the full model which includes the final model from previous method and all eligible variables. Only variables listed on the BSTEP variable list are eligible for entry and removal. Let the current model be the full model. (2) Based on the MLEs of the current model, calculate the LR or Wald statistic or conditional statistic for every variable in the model and find its significance. (3) Choose the variable with the largest significance. If that significance is less than the probability for a variable removal, then go to step 5; otherwise, if the current model without the variable with the largest significance is the same as the previous model, stop BSTEP; otherwise, go to the next step. (4) Modify the current model by removing the variable with the largest significance from the model. Estimate the parameters for the modified model and go back to step 2. (5) Check to see any eligible variable is not in the model. If there is none, stop BSTEP; otherwise, go to the next step. (6) Based on the MLEs of the current model, calculate the score statistic for every variable not in the model and find its significance. (7) Choose the variable with the smallest significance. If that significance is less than the probability for variable entry, then go to the next step; otherwise, stop BSTEP. (8) Add the variable with the smallest significance to the current model. If the model is not the same as any previous models, estimate the parameters for the new model and go back to step 2; otherwise, stop BSTEP.
Initial Model Information
If β 0 is not included in the model, the predicted probability is estimated to be 0. for all cases and the log likelihood function L (^) 1 6 0 is
L (^) 1 6 0 = W ln1 6 0 5. = -0 6931472. W
with W wi i
= 1
. If β 0 is included in the model, the predicted probability is estimated as
π^ $ 0 = =^1
w y
W
i i i
n
and β 0 is estimated by
$ (^) ln $ $ β
π (^0) π
0 (^10)
^
with asymptotic standard error estimated by
σ (^) $ π π β (^0)
W (^) 1 - 6
The log likelihood function is
0
1 6 =^1
^
^
!
"
$
$ (^) ln
π ln $^.
π π
π
l l CS
2 W
2
1
( β$^ )
where l (^) 4 9 β$ is the likelihood of the current model and l (0) is the likelihood of the initial model; that is, l (^) 1 6 0 = W log1 6 0 5. if the constant is not included in the model; l (^) 1 6 0 = W π$^ o log= π$^ o / 11 - π$^ o (^6) B + log 1 1 - π$ (^) o 6 if the constant is included in the
model, where π$^ o i i / i
n = w y W.
(g) Nagelkerke’s R^2 (Nagelkerke, 1981)
R (^) N^2 = R (^) CS^2 / max 4 RCS^29
where max
/ R (^) CS l 2 2 W 4 9 =^1 -^ <^ 1 6^0 A.
Hosmer-Lemeshow Goodness-of-Fit Statistic
The test statistic is obtained by applying a chi-square test on a 2 × g contingency table. The contingency table is constructed by cross-classifying the dichotomous dependent variable with a grouping variable (with g groups) in which groups are formed by partitioning the predicted probabilities using the percentiles of the predicted event probability. In the calculation, approximately 10 groups are used ( g = 10 ). The corresponding groups are often referred to as the “deciles of risk” (Hosmer and Lemeshow , 1989). If the values of independent variables for observation i and i’ are the same, observation i and i ' are said to be in the same block. When one or more blocks occur within the same decile, the blocks are assigned to this same group. Moreover, observations in the same block are not divided when they are placed into groups. This strategy may result in fewer than 10 groups (that is, g ≤ 10 ) and consequently, fewer degrees of freedom. Suppose that there are Q blocks, and the q th block has m (^) q number of observations, q = 1, K, Q. Moreover, suppose that the k th group ( k = 1, K, g ) is composed of the q 1 th, …, q kth blocks of observations. Then the total number of observations in the k th group is s (^) k mj q
q (^) k = (^) ∑ 1
. The total observed frequency of
events (that is, Y = 1 ) in the k th group, call it O 1 k , is the total number of observations in the k th group with Y = 1. Let E 1 k be the total expected frequency of
the event (that is, Y = 1 ) in the k th group; then E 1 k is given by E 1 (^) k = sk ξ (^) k, where ξ (^) k is the average predicted event probability for the k th group.
ξ k j π j k q
q m s
k = (^) ∑ $^ / 1
The Hosmer-Lemeshow goodness-of-fit statistic is computed as
χ HL ξ
k k k k^ k
g O E E
2 1 1
2
=
∑
The p value is given by Pr 4 χ 2 ≥ χ^2 HL 9 where χ 2 is the chi-square statistic distributed with degrees of freedom 0 g − 25.
Information for the Variables Not in the Equation
For each of the variables not in the equation, the score statistic is calculated along with the associated degrees of freedom, significance and partial R. Let X (^) i be a variable not currently in the model and Si the score statistic. The partial R is defined by
Partial R
S df L initial
i (^) S (^) i df
_ =
%
&
K K
'
K K
1 6
if
otherwise
where df is the degrees of freedom associated with Si , and L initial 1 6 is the log likelihood function for the initial model. The residual Chi-Square printed for the variables not in the equation is defined as
where L^ *^ γ^ =^ L *^^ L *^ r
á (^4) γ 1 ,^ K, γ 29.
V^ $^ = Diag π$^ - π$^ , , π$^ - π$ = 1 11 16 K^ n^11 n^6 B
(c) Studentized Residual
h i
i i
(d) Logit Residual
e e i
i i i
π 11 - π 6
where ei = yi - π$ (^) i.
(e) Standardized Residual
z
e i i i i
π$^11 - π$ 6
(f) Cook’s Distance
z h i (^) h
i i i
2
1
(g) DFBETA
Let D β (^) i be the change of the coefficient estimates from the deletion of case i. It is computed as
D β (^) i
i i i
e h
á á
4^ X CVX $^ 9 X
1
(h) Predicted Group
If π$^ i ò 0 5. , predicted group = group in which y = 1.
Note the following: For the unselected cases with nonmissing values for the independent variables in the analysis, the leverage
4 9^ hi is computed as
h h (^) $
V h V h
i i i i i i
2
1
where
h (^) i = Vi i ′ ′ (^) i
X (^) 4 X CVX (^) 9 X
1
For the unselected cases, the Cook’s distance and DFBETA are calculated based on ~ hi.