After imputing and matching, my IV of interest returns NAs.
I have a dataset that is mostly complete but for a couple of variables – coord1D
and cinc
. I used the following code to create my independent variable, treaty
:
air6_1 <- air6_1 %>%
mutate(treaty = case_when(hague >= 1 ~ 1,
geneva >= 1 ~ 1,
protocol >=1 ~ 1))
I used the following code to impute the missing data using mice
:
imputed.datasets <- mice(air6_1, m = 5)
and then the following code for nearest neighbor matching using matchthem
:
matched.datasets <- matchthem(air ~ coord1D + v2x_polyarchy + NATO + cinc,
datasets = imputed.datasets,
approach = 'within',
method = 'nearest',
caliper = 0.05,
ratio = 1)
From the survey library, I tried to run a logistic model across my imputed datasets with the following code:
matched.models <- with(matched.datasets,
glm(air ~ treaty + v2x_polyarchy + NATO + cinc, family = quasibinomial()),
cluster = TRUE)
The code runs smoothly, but when I enter summary(matched.models)
, my IV of interest – treaty
– returns ‘NA’ rather than a coefficient, as below:
term estimate std.error statistic p.value nobs
<chr> <dbl> <dbl> <dbl> <dbl> <int>
1 (Intercept) -0.0296 0.317 -0.0935 0.926 298
** 2 treaty NA NA NA NA 298**
3 v2x_polyarchy 0.00423 0.476 0.00889 0.993 298
4 NATO 0.0861 0.442 0.195 0.846 298
5 cinc 0.173 1.42 0.122 0.903 298
6 (Intercept) 0.0228 0.319 0.0714 0.943 298
** 7 treaty NA NA NA NA 298**
8 v2x_polyarchy -0.0608 0.480 -0.127 0.899 298
9 NATO -0.0655 0.427 -0.153 0.878 298
10 cinc 0.132 1.41 0.0939 0.925 298
I can’t figure out what I am doing wrong. Any help would be much appreciated. Forgive me if I am not posting correctly – I honestly don’t understand how to complete the dput
requirement with imputed datasets, even after watching a 10-minute YouTube video.
Dylan Irons is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.