quantile_response: quantile_response

View source: R/TSDT_scoring_functions.R

quantile_responseR Documentation

quantile_response

Description

Return the specified quantile of the response distribution.

Usage

quantile_response(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 returns the response quantiles associated with a specified percentile. The default behavior is to return the median – i.e. 50th-percentile.

Value

A quantile of the response variable.

See Also

TSDT, diff_quantile_response, quantile

Examples

## Generate example data containing response and treatment
N <- 100
y = runif( min = 0, max = 20, n = N )
df <- as.data.frame( y )
names( df )  <- "y"
df$trt <- sample( c('Control','Experimental'), size = N, prob = c(0.4,0.6),
                  replace = TRUE )

## Default behavior is to return the median
quantile_response( df )
median( df$y ) # should match previous result from quantile_response

## Get Q1 response
quantile_response( df, scoring_function_parameters = list( percentile = 0.25 ) )
quantile( df$y, 0.25 ) # should match previous result from quantile_response

## Get max response
quantile_response( df, scoring_function_parameters = list( percentile = 1 ) )
max( df$y ) # should match previous result from quantile_response

TSDT documentation built on April 7, 2022, 1:07 a.m.

Related to quantile_response in TSDT...