TreeMat: Create the tree matrix - Single Sample approach

Description Usage Arguments Examples

View source: R/TreeMat.R

Description

This function generates the tree structure as a matrix, using the LTfunction for a single sample approach

Usage

1
TreeMat(orig.LT, orig.Y, orig.X)

Arguments

orig.LT

Tree list

orig.Y

original response vector

orig.X

original covariate matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
N<-2000
numx <- 5
alpha <-0.8
theta<-0.8
beta<- c(1,.8,.6,.4,.2)
gamma <- 1
Z <- rep(c(0, 1), each = N/2)
sigma <- diag(numx)
X.i <- mvrnorm(N,mu=rep(0,numx),Sigma=sigma)
W <- Z * ifelse(X.i[,1] > 0, 1, 0)
mu <- alpha + theta*Z + X.i %*% beta + W * gamma
Y <- rnorm(N, mean=mu)
matched2_orig <- MatchForTree(Y=Y, Z=as.logical(Z), X=X.i, version="prognostic")
LT <- LTfunction(Y, Z, X.i, X.i)
TreeMat(LT, matched2_orig$ymatch, as.matrix(matched2_orig$xmatch))

AshwiniKV/TEHTree documentation built on Sept. 15, 2021, 11:21 p.m.