riskreg | R Documentation |
Risk regression with binary exposure and nuisance model for the odds-product.
Let A be the binary exposure, V the set of covariates, and Y the binary response variable, and define pa(v) = P(Y=1|A=a,V=v), a=0,1.
The target parameter is either the relative risk
RR(v) = p1(v)/p0(v)
or the risk difference
RD(v)=p1(v)-p0(v)
We assume a target parameter model given by either
log[RR(v)] = a'v
or
arctanh[RD(v)] = a'v
and similarly a working linear nuisance model for the odds-product
log[p0(v)p1(v)/{(1-p0(v))(1-p1(v))}] = b'v
.
A propensity model for E(A=1|V) is also fitted using a logistic regression working model
logit[E(A=1|V=v)] = c'v.
If both the odds-product model and the propensity model are correct the estimator is efficient. Further, the estimator is consistent in the union model, i.e., the estimator is double-robust in the sense that only one of the two models needs to be correctly specified to get a consistent estimate.
riskreg( formula, target = NULL, nuisance = NULL, propensity = nuisance, data, weights, type = "rr", optimal = TRUE, std.err = TRUE, start = NULL, mle = FALSE, ... )
formula |
formula (see details below) |
target |
(optional) target model (formula) |
nuisance |
nuisance model (formula) |
propensity |
propensity model (formula) |
data |
data.frame |
weights |
optional weights |
type |
type of association measure (rd og rr) |
optimal |
If TRUE optimal weights are calculated |
std.err |
If TRUE standard errors are calculated |
start |
optional starting values |
mle |
Semi-parametric (double-robust) estimate or MLE (TRUE gives MLE) |
... |
additional arguments to unconstrained optimization routine (nlminb) |
The 'formula' argument should be given as
response ~ exposure | target-formula | nuisance-formula
or
response ~ exposure | target | nuisance | propensity
E.g., riskreg(y ~ a | 1 | x+z | x+z, data=...)
Alternatively, the model can specifed using the target, nuisance and propensity arguments:
riskreg(y ~ a, target=~1, nuisance=~x+z, ...)
The riskreg_fit
function can be used with matrix inputs rather than formulas.
An object of class 'riskreg.targeted
' is returned. See targeted-class
for more details about this class and its generic functions.
Klaus K. Holst
Richardson, T. S., Robins, J. M., & Wang, L. (2017). On modeling and estimation for the relative risk and risk difference. Journal of the American Statistical Association, 112(519), 1121–1130. http://dx.doi.org/10.1080/01621459.2016.1192546
m <- lvm(a[-2] ~ x, lp.target[1] ~ 1, lp.nuisance[-1] ~ 2*x) distribution(m,~a) <- binomial.lvm("logit") m <- binomial.rr(m, "y","a","lp.target","lp.nuisance") d <- sim(m,5e2,seed=1) I <- model.matrix(~1, d) X <- model.matrix(~1+x, d) with(d, riskreg_mle(y, a, I, X, type="rr")) with(d, riskreg_fit(y, a, nuisance=X, propensity=I, type="rr")) riskreg(y ~ a | 1 | x , data=d, type="rr") ## Model with same design matrix for nuisance and propensity model: with(d, riskreg_fit(y, a, nuisance=X, type="rr")) a <- riskreg(y ~ a, nuisance=~x, data=d, type="rr") a riskreg(y ~ a, nuisance=~x, data=d, type="rr", mle=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.