Retrieve the column names of the dependent variable (y
) and independent
variable (x
) of an object of class DEFM.
get_Y_names(m)
get_X_names(m)
An object of class DEFM.
A character vector.
A character vector with the names of the dependent or independent variables.
#' Using Valente's SNS data
data(valentesnsList)
# Creating the DEFM object
mymodel <- new_defm(
id = valentesnsList$id,
X = valentesnsList$X,
Y = valentesnsList$Y,
order = 0
)
# Getting the names
get_X_names(mymodel)
#> [1] "Hispanic" "year" "exposure_smoke"
#> [4] "exposure_drink" "exposure_mj" "sibsmoke"
#> [7] "Grades" "adultdrink" "has_sib"
#> [10] "Female" "I(as.factor(X[, 2]))2" "I(as.factor(X[, 2]))3"
#> [13] "I(as.factor(X[, 2]))4"
get_Y_names(mymodel)
#> [1] "alcohol" "tobacco" "mj"