simLBH: Simulate unit responses

Description Usage Arguments Value Examples

View source: R/simLBH.r

Description

Simulate responses given the model parameter and covariates under the unit level model of Lyu, Berg and Hofmann.

Usage

1
simLBH(fit, Xs, f_pos, f_zero = f_pos, f_area, link = "logit")

Arguments

fit

a list of model parameter estimates containing at least fixed effects coefficients and variance components (named as the return value of mleLBH).

Xs

covariates matrix or data frame containing the variables named in f_pos, f_zero and f_area.

f_pos

an object of class formula: a symbolic description of the fixed effect model to be fitted to the positive part.

f_zero

an object of class formula: a symbolic description of the fixed effect model to be fitted to the binary part. Default value is to using the same formula as the positive part (f_pos).

f_area

an object of class formula: a symbolic description of the area code to be fitted to both the positive part and the negative part.

link

a specification for the link function used to model the binary part. The accepted link functions are logit, probit, cauchit, log and cloglog. Default value is "logit".

Value

response vector

Examples

1
2
3
4
5
6
  erosion_2p <- as.2pdata(f_pos = RUSLE2~logR+logK+logS,
                          f_zero = ~logR+logS+crop2+crop3,
                          f_area = ~cty, data = erosion)
  fit <- mleLBH(erosion_2p)
  responses <- simLBH(fit, Xaux, f_pos = ~logR+logK+logS,
                      f_zero = ~logR+logS+crop2+crop3, f_area = ~cty)

XiaodanLyu/saezero documentation built on Sept. 20, 2020, 5:59 a.m.