I have two periods of panel data and I am trying to see if coefficients change over time. I would like to control for individual-level heterogeneity, but not sure how to do it with a complex design object and svyglm function:
# Libraries
library(survey)
# complex survey design
des <- svydesign(
~ secu , # stratum half-sample code
strata = ~stratum , # std error stratum
weights = ~wtresp , # weights
nest = TRUE ,
data = long
)
secu
is "the stratum half-sample code for analysis of sampling error using the BRR method or approximate 'two-per-stratum' Taylor Series method (Kish and Hess, 1959). Within the SR sampling error strata, the half sample units are created by dividing sample cases into random halves, HALF SAMPLE CODE = 1 and HALF SAMPLE CODE = 2" (taken from here https://hrs.isr.umich.edu/sites/default/files/biblio/surveydesign.pdf).
In the regression below the outcome variable is the retirement status. The regressors are dummy variables for sex, education, race, self-reported health, age, income. In order to see if the effect of these variables becomes stronger in the second period, I include a time dummy variable which equals to 1 if the respondent's interview is from the 2nd time period, (and 0 if from the 1st). I also include dummy variables for month and year when the interview was collected.
summary(svyglm(
retired ~ time*(female + college + factor(race) + age + Rshlt +
log(iearn + 1) + factor(month) + factor(year)),
design = des
))
I have tried using plm()
with weights, but not sure if it is an appropriate method for complex survey samples.
svdesign(ids = ~ secu + individual_id)
$\endgroup$