View source: R/TSDT_scoring_functions.R
quantile_response | R Documentation |
Return the specified quantile of the response distribution.
quantile_response(data, scoring_function_parameters = NULL)
data |
data.frame containing response data |
scoring_function_parameters |
named list of scoring function control parameters |
This function returns the response quantiles associated with a specified percentile. The default behavior is to return the median – i.e. 50th-percentile.
A quantile of the response variable.
TSDT, diff_quantile_response, quantile
## 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.