Fit "within-between" and several other regression variants for panel data via generalized estimating equations.
Usage
asym_gee(
formula,
data,
id = NULL,
wave = NULL,
cor.str = c("ar1", "exchangeable", "unstructured"),
use.wave = FALSE,
wave.factor = FALSE,
min.waves = 1,
family = gaussian,
weights = NULL,
offset = NULL,
...
)
Arguments
- formula
Model formula. See details for crucial info on
panelr
's formula syntax.- data
The data, either a
panel_data
object ordata.frame
.- id
If
data
is not apanel_data
object, then the name of the individual id column as a string. Otherwise, leave as NULL, the default.- wave
If
data
is not apanel_data
object, then the name of the panel wave column as a string. Otherwise, leave as NULL, the default.- cor.str
Any correlation structure accepted by
geepack::geeglm()
. Default is "ar1", most useful alternative is "exchangeable". "unstructured" may cause problems due to its computational complexity.- use.wave
Should the wave be included as a predictor? Default is FALSE.
- wave.factor
Should the wave variable be treated as an unordered factor instead of continuous? Default is FALSE.
- min.waves
What is the minimum number of waves an individual must have participated in to be included in the analysis? Default is
2
and any valid number is accepted."all"
is also acceptable if you want to include only complete panelists.- family
Use this to specify GLM link families. Default is
gaussian
, the linear model.- weights
If using weights, either the name of the column in the data that contains the weights or a vector of the weights.
- offset
this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be
NULL
or a numeric vector of length equal to the number of cases. One or moreoffset
terms can be included in the formula instead or as well, and if more than one is specified their sum is used. Seemodel.offset
.- ...
Additional arguments provided to
geepack::geeglm()
.
Details
See the documentation for wbm()
for many details on formula syntax and
other arguments.
References
Allison, P. D. (2019). Asymmetric fixed-effects models for panel data. Socius, 5, 1-12. https://doi.org/10.1177/2378023119826441
McNeish, D. (2019). Effect partitioning in cross-sectionally clustered data without multilevel models. Multivariate Behavioral Research, Advance online publication. https://doi.org/10.1080/00273171.2019.1602504
McNeish, D., Stapleton, L. M., & Silverman, R. D. (2016). On the unnecessary ubiquity of hierarchical linear modeling. Psychological Methods, 22, 114-140. https://doi.org/10.1037/met0000078
Examples
if (requireNamespace("geepack")) {
data("WageData")
wages <- panel_data(WageData, id = id, wave = t)
model <- asym_gee(lwage ~ lag(union) + wks, data = wages)
summary(model)
}
#> Loading required namespace: geepack
#> Registered S3 methods overwritten by 'broom':
#> method from
#> tidy.glht jtools
#> tidy.summary.glht jtools
#> Loading required namespace: car
#> MODEL INFO:
#> Entities: 595
#> Time periods: 3-7
#> Dependent variable: lwage
#> Model family: Linear
#> Variance: ar1 (alpha = -0.3)
#> Specification: Asymmetric effects (via GEE)
#>
#> MODEL FIT:
#> QIC = 121.63, QICu = 117.85, CIC = 6.89
#>
#> ------------------------------------------------
#> Est. S.E. z val. p
#> ----------------- ------- ------ -------- ------
#> (Intercept) 0.10 0.00 39.46 0.00
#> +lag(union) 0.02 0.02 1.13 0.26
#> -lag(union) -0.00 0.02 -0.08 0.94
#> +wks -0.00 0.00 -0.45 0.65
#> -wks -0.00 0.00 -0.49 0.63
#> ------------------------------------------------
#>
#> Tests of asymmetric effects:
#> -------------------------------
#> chi^2 p
#> ---------------- ------- ------
#> lag(union) 0.66 0.42
#> wks 1.10 0.29
#> -------------------------------