KHB

Description

Compare two non-linear regression models using the KHB method

Usage

1
2
3
4
5
6
khb(reduced, full, corrected.se = FALSE, med.sandwich = NULL,
  glm.sandwich = FALSE, savefs = FALSE)

## S3 method for class 'khb'
print(x, type = "summary", keyvar = NULL,
  disentangle = FALSE, ...)

Arguments

reduced

The reduced model to compare (withought mediators variables). This must be a logistic or probit regression model fit using the glm command.

full

The full model to compare (including mediators variables). This must be a logistic or probit regression model fit using the glm command.

corrected.se

Logical. If TRUE, standard errors of the adjusted model are corrected to account for the uncertainty of the regressions on the mediators variables.

med.sandwich

Logical. If TRUE, sandwich standard errors are used for the regressions relating mediators and key variables. If NULL (default), sandwich standard errors are used only if at least one of the mediator is a binary (or categorical) variable.

glm.sandwich

Logical. If TRUE, sandwich standard errors are used for the glm models.

savefs

Logical. If TRUE, the SUR model is saved in the result.

x

A khb object

type

Character. The type of information printed (see details).

keyvar

A character vector or NULL (default). The list of variables of interest (for which the change between models are displayed). If NULL (default), all variables of the reduced models are considered as key variables.

disentangle

Logical. If FALSE (default), the contribution of each mediator is not printed.

...

Arguments passed to other methods.

Value

a khb object which is a list with the following elements:

  • sum_conf a summary table of the confounding and rescaling effects.

  • key a list of the confounding effect on each key variables (i.e. variable in the reduced model).

  • reduced the reduced model.

  • adjusted the adjusted model (with mediators residuals).

  • full the full model.

  • keyvar A character vector of the key variables (i.e. variable in the reduced model).

  • mediators A character vector of the mediators (i.e. the variable in the full model that are not in the reduced one).

References

Karlson KB, Holm A and Breen R (2012). Comparing Regression Coefficients Between Same-sample Nested Models Using Logit and Probit: A New Method. Sociological Methodology, 42(1), pp 286-313.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Example: transition to higher education in Northern Ireland
data(mvad, package="TraMineR")
## Build a binary covariate, TRUE if went to higher education
HE <- rowSums(mvad[, 17:86]=="HE")>0

## Our reduced models including Father unemployement (funemp)
## and type of compulsory school (Grammar)
red <- glm(HE~funemp+Grammar, data=mvad, family=binomial("logit"))
## In the full model, we add the results at the end of compulsory schooling
## (gcse5eq).
full <- glm(HE~Grammar+funemp+gcse5eq, data=mvad, family=binomial("logit"))
## Running the KHB method
k <- khb(red, full)

## Printing the results for the funemp covariates only
print(k, keyvar="funemp")
## Comparing the models
print(k, type="models")

## Several mediators
## Here, we only have one covariate in the reduced model
red <- glm(HE~funemp, data=mvad, family=binomial("logit"))
full <- glm(HE~Grammar+gcse5eq+funemp, data=mvad, family=binomial("logit"))
#' ## Running the KHB method
k <- khb(red, full)

## Printing the results and disentangle the effect of each mediator
print(k, disentangle=TRUE)
## Comparing the models
print(k, type="models")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.