ods <- SD2011[, c(1, 4, 5, 6, 2, 10, 11)]
table(ods[, c("placesize", "region")])
# Each `placesize_region` sublist:
# for each relevant level of `placesize` defined in the first element,
# the second element defines regions (variable `region`) that do not
# have places of that size.
struct.zero <- list(
placesize_region = list(placesize = "URBAN 500,000 AND OVER",
region = c(2, 4, 5, 8:13, 16)),
placesize_region = list(placesize = "URBAN 200,000-500,000",
region = c(3, 4, 10:11, 13)),
placesize_region = list(placesize = "URBAN 20,000-100,000",
region = c(1, 3, 5, 6, 8, 9, 14:15)))
# you could use the object struct.zero in the command below
# byt devtools checking did not like it so have added the list instead
synipf <- syn(ods, method = c(rep("ipf", 4), "ctree", "normrank", "ctree"),
ipf.gmargins = "twoway", ipf.othmargins = list(c(1, 2, 3)),
ipf.priorn = 2, ipf.structzero = list(
placesize_region = list(placesize = "URBAN 500,000 AND OVER",
region = c(2, 4, 5, 8:13, 16)),
placesize_region = list(placesize = "URBAN 200,000-500,000",
region = c(3, 4, 10:11, 13)),
placesize_region = list(placesize = "URBAN 20,000-100,000",
region = c(1, 3, 5, 6, 8, 9, 14:15))))
Run the code above in your browser using DataLab