predict.sisVIVE {sisVIVE} | R Documentation |
Estimates set of invalid instruments or the causal effect of exposure on outcome from a sisVIVE object
Description
predict.sisVIVE can estimate a set of invalid instruments or the causal effect of exposure on outcome for any particular lambda(s)
Usage
## S3 method for class 'sisVIVE'
predict(object, lambda, type = c("coefficients", "instruments"), ...)
Arguments
object |
A fitted sisVIVE object |
lambda |
A numerical vector of lambda(s) to obtain estimates. The length of this vector can be one. |
type |
If type="coefficients", predict returns estimated alpha and betas (i.e. the causal effect of exposure on outcome) for supplied lambda(s). If type = "instruments", predict returns estimated set of invalid instruments for supplied lambda(s) |
... |
Any other argument for predict.lars |
Details
predict() estimates the alphas and betas for given sequence of lambda(s) or set of invalid instrument.
Value
lambda |
Sequence of lambda(s) supplied by the user |
alpha |
If type="coefficients", alpha is the estimated direct effect of the instruments on the outcome. Each row refers to an estimated alpha for one lambda value and each column refers to the corresponding column in Z |
beta |
If type="coefficients", beta is the estimated causal effect of exposure on outcome. Each entry refers to an estimated beta for one lambda value |
instruments |
If type="instruments",provides a character vector of invalid instruments. Each entry refers to column indices of Z that are estimated to be invalid. |
Author(s)
Hyunseung Kang
See Also
summary, and cv.sisVIVE
Examples
library(MASS)
library(lars)
n = 1000; L = 10; s= 3;
Z <- matrix(rnorm(n*L),n,L)
error <- mvrnorm(n,rep(0,2),matrix(c(1,0.8,0.8,1),2,2))
intD = rnorm(1); ZtoD = rnorm(L,0,1); ZtoY = c(rnorm(s),rep(0,L-s)); DtoY = 1; intY = rnorm(1)
D = intD + Z %*% ZtoD + error[,1]
Y = intY + Z %*% ZtoY + D * DtoY + error[,2]
result = sisVIVE(Y,D,Z)
estCoef1 = predict(result,lambda = 10,type="coefficients")
estCoef2 = predict(result,lambda = seq(1,100,10),type="coefficients")
estInst1 = predict(result,lambda = 10,type="instruments")
estInst2 = predict(result,lambda = seq(1,100,10),type="instruments")