# NOT RUN {
# Create example from Ye et al., 2009
# Provide reference sample
ye <- tibble::tribble(
~HHNR, ~PNR, ~APER, ~HH_VAR, ~P_VAR,
1, 1, 3, 1, 1,
1, 2, 3, 1, 2,
1, 3, 3, 1, 3,
2, 4, 2, 1, 1,
2, 5, 2, 1, 3,
3, 6, 3, 1, 1,
3, 7, 3, 1, 1,
3, 8, 3, 1, 2,
4, 9, 3, 2, 1,
4, 10, 3, 2, 3,
4, 11, 3, 2, 3,
5, 12, 3, 2, 2,
5, 13, 3, 2, 2,
5, 14, 3, 2, 3,
6, 15, 2, 2, 1,
6, 16, 2, 2, 2,
7, 17, 5, 2, 1,
7, 18, 5, 2, 1,
7, 19, 5, 2, 2,
7, 20, 5, 2, 3,
7, 21, 5, 2, 3,
8, 22, 2, 2, 1,
8, 23, 2, 2, 2
)
ye
# Specify control at household level
ye_hh <- tibble::tribble(
~HH_VAR, ~N,
1, 35,
2, 65
)
ye_hh
# Specify control at person level
ye_ind <- tibble::tribble(
~P_VAR, ~N,
1, 91,
2, 65,
3, 104
)
ye_ind
ye_problem <- ml_problem(
ref_sample = ye,
field_names = special_field_names(
groupId = "HHNR", individualId = "PNR", count = "N"
),
group_controls = list(ye_hh),
individual_controls = list(ye_ind)
)
ye_problem
fit <- ml_fit_dss(ye_problem)
fit$weights
# }
Run the code above in your browser using DataLab