***

*

PAGE RETIRED: Click here for the new StatsDirect help system.

*

OR YOU WILL BE REDIRECTED IN 5 SECONDS

*

***

Logistic regression

 

Menu location: Analysis_Regression & Correlation_Logistic.

 

This function fits and analyses logistic models for binary outcome/response data with one or more predictors.

 

Binomial distributions are used for handling the errors associated with regression models for binary/dichotomous responses (i.e. yes/no, dead/alive) in the same way that the standard normal distribution is used in general linear regression. Other, less commonly used binomial models include normit/probit and complimentary log-log. The logistic model is widely used and has many desirable properties (Hosmer and Lemeshow, 1989; Armitage and Berry, 1994; Altman 1991; McCullagh and Nelder, 1989; Cox and Snell, 1989; Pregibon, 1981).

 

Odds = p/(1- p)

[p = proportional response, i.e. r out of n responded so p = r/n]

Logit = log odds = log(p /(1- p))

 

When a logistic regression model has been fitted, estimates of p are marked with a hat symbol above the Greek letter pi to denote that the proportion is estimated from the fitted regression model. Fitted proportional responses are often referred to as event probabilities (i.e. p hat n events out of n trials).

 

The following information about the difference between two logits demonstrates one of the important uses of logistic regression models:

image\STAT0252_wmf.gif

 

Logistic models provide important information about the relationship between response/outcome and exposure. It makes no difference to logistic models, whether outcomes have been sampled prospectively or retrospectively, this is not the case with other binomial models.

 

The general form of a logistic regression is:

image\STAT0253_wmf.gif

- where p hat is the expected proportional response for the logistic model with regression coefficients b1 to k and intercept b0 when the values for the predictor variables are x1 to k.

 

Classifier predictors

If one of the predictors in a regression model classifies observations into more than two classes (e.g. blood group) then you should consider splitting it into separate dichotomous variables as described under dummy variables.

 

Data preparation

For individual responses that are dichotomous (e.g. yes/no), enter the total number as 1 and the response as 1 or 0 for each observation (usually 1 for yes and 0 for no).

 

For responses that are proportional, either enter the total number then the number responding or enter the total number as 1 and then a proportional response (r/n).

 

Rows with missing data are left out of the model. If missing data are encountered you are warned that missing data can cause bias.

 

Deviance and model analysis

Deviance is minus twice the log of the likelihood ratio for models fitted by maximum likelihood (Hosmer and Lemeshow, 1989; Cox and Snell, 1989; Pregibon, 1981). Log likelihood and deviance are given under the model analysis option of logistic regression in StatsDirect.

 

The value of adding parameter to a logistic model can be tested by subtracting the deviance of the model with the new parameter from the deviance of the model without the new parameter, this difference is then tested against a chi-square distribution with degrees of freedom equal to the difference between the degrees of freedom of the old and new models. The model analysis option tests the model you specify against a model with only one parameter, the intercept; this tests the combined value of the specified predictors/covariates in the model.

 

Some statistical packages offer stepwise logistic regression that performs systematic tests for different combinations of predictors/covariates. Automatic model building procedures such as these can be erroneous as they do not consider the real world importance of each predictor, for this reason StatsDirect does not include stepwise selection.

 

Three goodness of fit tests are given for the overall fit of a model: Pearson, deviance and Hosmer-Lemeshow (Hosmer and Lemeshow, 1989). Note that the Hosmer-Lemeshow (decile of risk) test is only applicable when the number of observations tied at any one covariate pattern is small in comparison with the total number of observations, and when all predictors are continuous variables.

 

Influential data and odds ratios

The following are provided under the fits & residuals option for the purpose of identifying influential data:

 

Approximate confidence intervals are given for the odds ratios derived from the covariates.

 

Bootstrap estimates

A bootstrap procedure may be used to cross-validate confidence intervals calculated for odds ratios derived from fitted logistic models (Efron and Tibshirani, 1997; Gong, 1986). The bootstrap confidence intervals used here are the 'bias-corrected' type.

 

The mechanism that StatsDirect uses is to draw a specified number of random samples (with replacement, i.e. some observations are drawn once only, others more than once and some not at all) from your data. These 're-samples' are fed back into the logistic regression and bootstrap' estimates of confidence intervals for the model parameters are made by examining the model parameters calculated at each cycle of the process. The bias statistic shows how much each mean model parameter from the bootstrap distribution deviates from observed model parameters.

 

Classification and ROC curve

The confidence interval given with the likelihood ratios in the classification option is constructed using the robust approximation given by Koopman (1984) for ratios of binomial proportions. The 'near' cut-off in the classification option is the rounding cut-off that gives the maximum sum of sensitivity and specificity. This value should be the shoulder at the top left of the ROC (receiver operating characteristic curve).

 

Prediction and adjusted means

The prediction option allows you to calculate values of the outcome (as response proportion) using your fitted logistic model coefficients with a specified set of values for the predictors (X1…p). A confidence interval is given for each prediction.

 

The default X values shown are those required to calculate the overall regression mean for the model, which is the mean of Y adjusted for all X. For continuous predictors the mean of X is used. For categorical predictors you should use X as 1/k, where k is the number of categories. StatsDirect attempts to identify categorical variables but you should check the values against these rules if you are using categorical predictors in this way.

 

For example, if a model of Y = logit(proportion of population who are hypertensive), X1 = sex, X2 = age was fitted, and you wanted to know the age and sex adjusted prevalence of hypertension in the population that you sampled, you could use the prediction function to give the regression mean as the answer, i.e. with X1 as 0.5 and X2 as mean age. If you wanted to know the age-adjusted prevalence of hypertension for males in your population then you would set X1 to 1 (if male sex is coded as 1 in your data).

 

Further methods

GLIM provides many generalised linear models with link functions including binomial (see non-linear models). SAS provides an extension of logistic regression to ordinal responses, this is known as ordered logistic regression. Exploratory regression modelling should be attempted only under the expert guidance of a Statistician.

Technical validation

The logits of the response data are fitted using an iteratively re-weighted least squares method to find maximum likelihood estimates of the parameters in the logistic model (McCullagh and Nelder, 1989; Cox and Snell, 1989; Pregibon, 1981).

 

Residuals and case-wise diagnostic statistics are calculated as follows (Hosmer and Lemeshow, 1989):

 

Leverages are the diagonal elements of the logistic equivalent of the hat matrix in general linear regression (where leverages are proportional to the distances of the jth covariate pattern from the mean of the data). The jth diagonal element of the logistic equivalent of the hat matrix is calculated as:

image\STAT0254_wmf.gif

- where mj is the number of trials with the jth covariate pattern, p hat is the expected proportional response, xj is the jth covariate pattern, X is the design matrix containing all covariates (first column as 1 if intercept calculated) and V is a matrix with the general element p hat(1- p hat).

 

Deviance residuals are used to detect ill-fitting covariate patterns, and they are calculated as:

image\STAT0255_wmf.gif

- where mj is the number of trials with the jth covariate pattern, p hat is the expected proportional response and yj is the number of successes with the jth covariate pattern.

 

Pearson residuals are used to detect ill-fitting covariate patterns, and they are calculated as:

image\STAT0256_wmf.gif

- where mj is the number of trials with the jth covariate pattern, p hat is the expected proportional response and yj is the number of successes with the jth covariate pattern.

 

Standardized Pearson residuals are used to detect ill-fitting covariate patterns, and they are calculated as:

image\STAT0257_wmf.gif

- where rj is the Pearson residual for the jth covariate pattern and hj is the leverage for the jth covariate pattern.

 

Deletion displacement (delta beta) measures the change caused by deleting all observations with the jth covariate pattern. The statistic is used to detect observations that have a strong influence upon the regression estimates. This change in regression coefficients is calculated as:

image\STAT0258_wmf.gif

- where rj is the Pearson residual for the jth covariate pattern and hj is the leverage for the jth covariate pattern.

 

Standardized deletion displacement (std delta beta) measures the change caused by deleting all observations with the jth covariate pattern. The statistic is used to detect observations that have a strong influence upon the regression estimates. This change in regression coefficients is calculated as:

image\STAT0259_wmf.gif

- where rsj is the standardized Pearson residual for the jth covariate pattern and hj is the leverage for the jth covariate pattern.

 

Deletion chi-square (delta chi-square) measures the change in the Pearson chi-square statistic (for the fit of the regression) caused by deleting all observations with the jth covariate pattern. The statistic is used to detect ill-fitting covariate patterns. This change in chi-square is calculated as:

image\STAT0260_wmf.gif

- where rj is the Pearson residual for the jth covariate pattern and hj is the leverage for the jth covariate pattern.

 

Example

From Altman (1991).

Test workbook (Regression worksheet: Men, Hypertensive, Smoking, Obesity, Snoring).

 

Smoking, obesity and snoring were related to hypertension in 433 men aged 40 or over.

 

Men

Hypertensive

Smoking

Obesity

Snoring

60

5

0

0

0

17

2

1

0

0

8

1

0

1

0

2

0

1

1

0

187

35

0

0

1

85

13

1

0

1

51

15

0

1

1

23

8

1

1

1

 

To analyse these data using StatsDirect you must first enter them into five columns of a workbook. Alternatively, open the test workbook using the file open function of the file menu. Then select Logistic from the Regression and Correlation section of the analysis menu. Choose the option to enter grouped data when prompted. Select the column marked "Men" when asked for total number and select "Hypertensives" when asked for response. Click on the cancel button when asked about weights, i.e. you select an unweighted analysis. Then select "Smoking", "Obesity" and "Snoring" in one action when you are asked for predictors. Click on Yes when you are asked about an intercept.

 

For this example:

 

Logistic regression

 

Deviance (likelihood ratio) chi-square = 12.507498, df = 3 P = 0.0058

 

Intercept

b0 = -2.377661

z = -6.253967

P < .0001

Smoking

b1 = -0.067775

z = -0.243686

P = .8075

Obesity

b2 = 0.69531

z = 2.438954

P = .0147

Snoring

b3 = 0.871939

z = 2.193152

P = .0283

 

logit Hypertensive = -2.377661 -0.067775 Smoking +0.69531 Obesity +0.871939 Snoring

 

Logistic regression - model analysis

 

Accuracy = 1.00E-07

Log likelihood with all covariates = -199.4582

 

Deviance with all covariates = 1.618403, df = 4, rank = 4

Akaike = 9.618403

Schwartz = 12.01561

 

Deviance with no covariates = 14.1259

 

Deviance (likelihood ratio) chi-square = 12.507498, df = 3, P = 0.0058

 

Pearson chi-square goodness of fit = 1.364272, df = 4, P = 0.8504

Deviance goodness of fit = 1.618403, df = 4, P = 0.8055

Hosmer-Lemeshow type test = 0.551884, df = 3, P = 0.9074

 

Parameter

Coefficient

Standard Error

Constant

-2.377661

0.380185

Smoking

-0.067775

0.278124

Obesity

0.69531

0.285085

Snoring

0.871939

0.397574

 

We can infer that smoking has no association with hypertension from this evidence and drop it from our model. Remember that there may be important interactions between predictors. The fits & residuals option gives you the covariances. It would be prudent to seek statistical advice on the interpretation of covariance and influential data.

 

Parameter estimates can be used to obtain odds ratios for each covariate:

 

Logistic regression - odds ratios

 

Parameter

Estimate

Odds Ratio

95% CI

Constant

-2.377661

 

 

Smoking

-0.067775

0.934471

0.541784 to 1.611779

Obesity

0.69531

2.00433

1.146316 to 3.504564

Snoring

0.871939

2.391544

1.097143 to 5.213072

 

Thus with 95% confidence we can infer that the risk of hypertension in obese people is between 1.15 and 3.5 times greater than in non-obese people.

 

P values

confidence intervals