diff_test: Diff_test for testing causal effect among time-varying...

Description Usage Arguments Value Examples

View source: R/diff_test.R

Description

Diff_test for testing causal effect among time-varying Exposure.

Usage

1
2
3
4
5
6
7
8
diff_test(
  data = data,
  expo_name1 = "x1",
  expo_name2 = "x2",
  expo_name3 = "x3",
  continuous = T,
  boot_no = 1000
)

Arguments

data

an optional data frame containing the variables in the model.

x1_name

the name of pre-outcome exposure

x3_name

the name of post-outcome exposure

x2_name

the name of exposure between pre-outcome exposure and post-outcome exposure

boots_no

the number of bootstrap

Value

diff_test the result of Diff and its 95

Examples

1
2
3
4
5
6
7
8
9
a <- rnorm(1000,0,1)
b <- a+rnorm(1000,0,1)
c <- b+rnorm(1000,0,1)
hhh <- data.frame(a,b,c)
hhh$x1 <- ifelse(a<(-0.5),0,ifelse(a>0.5,2,1))
hhh$x2 <- ifelse(b<(-0.5),0,ifelse(b>0.5,2,1))
hhh$x3 <- ifelse(c<(-0.5),0,ifelse(c>0.5,2,1))
con_result <- diff_test (data = hhh, expo_name1 =  'x1', expo_name2 =  'x2',
expo_name3 =  'x3', continuous = F, boot_no =1000)

yuyy-shandong/NCETS documentation built on May 19, 2021, 10:32 p.m.