I have a syvglm code that would work in R3.6.3, but not R4.0.2 (which gives the error messages of:
for svylgm:
Error: Must subset elements with a valid subscript vector. x Subscript has the wrong type
omit
. i It must be logical, numeric, or character. Backtrace:
- survey::svyglm(...)
- survey:::svyglm.survey.design(...)
- survey:::
[.survey.design2
(design, -nas, )- base::
[.data.frame
(x$variables, i, ..1, drop = FALSE)- vctrs:::
[.vctrs_vctr
(xj, i)- vctrs:::vec_index(x, i, ...)
- vctrs::vec_slice(x, i)
For interactions package:
Error: <labelled> - is not permitted Backtrace:
- interactions::probe_interaction(...)
- interactions::sim_slopes(...)
- interactions:::center_ss(...)
- interactions:::center_ss_survey(...)
- jtools::gscale(vars = ndfvars, data = design, center.only = TRUE) ...
- vctrs:::
-.vctrs_vctr
(left, right)- haven:::vec_arith.haven_labelled.default("-", e1, e2)
- vctrs::stop_incompatible_op(op, x, y)
- vctrs:::stop_incompatible(...)
- vctrs:::stop_vctrs(...)
My code is:
design <-
svydesign(
id = ~I_i ,
data = sm ,
weights = ~w ,
)
fit <- svyglm(sc ~ sex + school +sex*school, design)
summary(fit)
probe_interaction(fit, pred = school, modx = sex)
I wish to continue with R4.0.2 as downgrading R create a lot of problems with other R packages. The probe_Interaction part did not work on older version of R (PC computer) either. Any clue what went wrong?
Data:
structure(list(I_i = structure(c(-54, 1000987, 1000166), label = "ID institution", format.spss = "F39.0", display_width = 39L, labels = c(Filtered = -99, Don't know = -98, Refused = -97, Not in list = -96, Implausible value = -95, Not reached = -94, Does not apply = -93, Question erroneously not asked = -92, Survey aborted = -91, Unspecific missing = -90, Not participated = -56, Not determinable = -55, Missing by design = -54, Anonymized = -53, Implausible value removed = -52, No estimate in check module = -51 ), class = c("haven_labelled", "vctrs_vctr", "double")), w = c(0.197917401820921, 0.186422150045312, 0.275986837527898),sc = c(NA, 7.66666666666667, 8.66666666666667 ), sex = structure(c(1, 1, 0), label = "Gender", format.spss = "F3.0", display_width = 9L, labels = c(Implausible value = -95, Unspecific missing = -90, Missing by design = -54, <U+0085> male? = 1, <U+0085> female? = 2), class = c("haven_labelled", "vctrs_vctr", "double")), school = c(NA, 1L, 1L)), row.names = c(NA, 3L), class = "data.frame")