data(eusilc)
set.seed(1)
data <- data.table(rbind(eusilc, eusilc),
year=c(rep(2010, nrow(eusilc)),
rep(2011, nrow(eusilc))),
country=c(rep("AT", nrow(eusilc)),
rep("AT", nrow(eusilc))))
data[age<0, age:=0]
PSU <- data[,.N, keyby="db030"]
PSU[, N:=NULL]
PSU[, PSU:=trunc(runif(nrow(PSU), 0, 100))]
PSU$inc <- runif(nrow(PSU), 20, 100000)
data <- merge(data, PSU, all=TRUE, by="db030")
PSU <- eusilc <- NULL
data[, strata:=c("XXXX")]
data[, strata:=as.character(strata)]
data$pl085 <- 12*trunc(runif(nrow(data),0,2))
data$month_at_work <- 12*trunc(runif(nrow(data),0,2))
result <- vardcrospoor(Y="inc", age="age",
pl085="pl085",
month_at_work="month_at_work",
Y_den="inc", Y_thres="inc",
wght_thres="rb050",
H="strata", PSU="PSU",
w_final="rb050", id=NULL,
Dom = c("rb090", "db040"),
country="country", periods="year",
sort=NULL,
gender = NULL,
percentage=60,
order_quant=50,
alpha = 20,
dataset = data,
confidence=0.95,
type="linrmpg")
result2 <- vardcrospoor(Y="inc", age="age",
pl085="pl085",
month_at_work="month_at_work",
Y_den="inc", Y_thres="inc",
wght_thres="rb050",
H="strata", PSU="PSU",
w_final="rb050", id=NULL,
Dom = c("rb090", "db040"),
country="country", periods="year",
sort=NULL,
gender = NULL,
percentage=60,
order_quant=50,
alpha = 20,
dataset = data,
confidence=0.95,
type="linrmpg")
Run the code above in your browser using DataLab