# NOT RUN {
data(ses)
require(data.table)
dati <- data.table(ID = paste0("V", 1 : nrow(ses)), ses)
setnames(dati, "sex", "sexf")
dati[sexf == "male", sex:= 1]
dati[sexf == "female", sex:= 2]
# Full population
gpgs1 <- lingpg(Y = "earningsHour", gender = "sex",
id = "ID", weight = "weights",
dataset = dati)
gpgs1$value
# }
# NOT RUN {
# Domains by education
gpgs2 <- lingpg(Y = "earningsHour", gender = "sex",
id = "ID", weight = "weights",
Dom = "education", dataset = dati)
gpgs2$value
# Sort variable
gpgs3 <- lingpg(Y = "earningsHour", gender = "sex",
id = "ID", weight = "weights",
sort = "ID", Dom = "education",
dataset = dati)
gpgs3$value
# Two survey periods
dati[, year := 2010]
dati2 <- copy(dati)
dati2[, year := 2011]
dati <- rbind(dati, dati2)
gpgs4 <- lingpg(Y = "earningsHour", gender = "sex",
id = "ID", weight = "weights",
sort = "ID", Dom = "education",
period = "year", dataset = dati)
gpgs4$value
names(gpgs4$lin)
# }
Run the code above in your browser using DataLab