-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
@dtkaplan, how does this look?
example(mod_effect)
##
## md_ffc> mod1 <- lm(wage ~ age * sex * educ + sector, data = mosaicData::CPS85)
##
## md_ffc> mod_effect(mod1, ~ sex)
## # A tibble: 1 x 6
## change sex to_sex age educ sector
## <dbl> <fct> <fct> <dbl> <dbl> <fct>
## 1 -1.88 M F 35 12 prof
##
## md_ffc> mod_effect(mod1, ~ sector)
## # A tibble: 1 x 6
## change sector to_sector age sex educ
## <dbl> <fct> <fct> <dbl> <fct> <dbl>
## 1 -2.23 prof clerical 35 M 12
##
## md_ffc> mod_effect(mod1, ~ age, sex = "M", educ = c(10, 12, 16), age = c(30, 40))
## # A tibble: 6 x 7
## change slope age to_age sex educ sector
## <dbl> <dbl> <dbl> <dbl> <fct> <dbl> <fct>
## 1 1.18 0.118 30 40 M 10 prof
## 2 1.18 0.118 40 50 M 10 prof
## 3 1.38 0.138 30 40 M 12 prof
## 4 1.38 0.138 40 50 M 12 prof
## 5 1.78 0.178 30 40 M 16 prof
## 6 1.78 0.178 40 50 M 16 prof
##
## md_ffc> mod_effect(mod1, ~ age, sex = "F", age = 34, step = 1)
## # A tibble: 1 x 7
## change slope age to_age sex educ sector
## <dbl> <dbl> <dbl> <dbl> <fct> <dbl> <fct>
## 1 0.0549 0.0549 34 35 F 12 prof
##
## md_ffc> mod_effect(mod1, ~ sex, age = 35, sex = "M", to = "F" )
## # A tibble: 1 x 6
## change sex to_sex age educ sector
## <dbl> <fct> <fct> <dbl> <dbl> <fct>
## 1 -1.88 M F 35 12 prof
##
## md_ffc> # For classifiers, the change in *probability* of a level is reported.
## md_ffc> mod2 <- rpart::rpart(sector ~ age + sex + educ + wage, data = mosaicData::CPS85)
##
## md_ffc> mod_effect(mod2, ~ educ)
## # A tibble: 1 x 7
## change_clerical slope educ to_educ age sex wage
## <dbl> <dbl> <dbl> <dbl> <dbl> <fct> <dbl>
## 1 0 0 12 14 35 M 7.8
##
## md_ffc> mod_effect(mod2, ~ educ, class_level = "manag")
## # A tibble: 1 x 7
## change_manag slope educ to_educ age sex wage
## <dbl> <dbl> <dbl> <dbl> <dbl> <fct> <dbl>
## 1 0 0 12 14 35 M 7.8Metadata
Metadata
Assignees
Labels
No labels