treatment_effect: treatment_effect

Description Usage Arguments Details Value See Also Examples

View source: R/TSDT_scoring_functions.R

Description

Compute treatment effect as mean( treatment response ) - mean( control response )

Usage

1
treatment_effect(data, scoring_function_parameters = NULL)

Arguments

data

data.frame containing response data

scoring_function_parameters

named list of scoring function control parameters

Details

This function will compute the treatment for the response. The treatment effect is computed as the difference in means between the non-control treatment arm and the control treatment arm. The user must provide the treatment variable as well as the control value.

Value

The difference in mean response across treatment arms.

See Also

TSDT, mean_response

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
N <- 100

df <- data.frame( continuous_response = numeric(N),
                  trt = integer(N) )

df$continuous_response <- runif( min = 0, max = 20, n = N )
df$trt <- sample( c(0,1), size = N, prob = c(0.4,0.6), replace = TRUE )

# Compute the treatment effect
treatment_effect( df, list( y_var = 'continuous_response', trt_control = 0 ) )

# Function return value should match this value
mean( df$continuous_response[df$trt == 1] ) - mean( df$continuous_response[df$trt == 0] )

TSDT documentation built on May 2, 2019, 6:40 a.m.