# effCont-helper: Helper functions for continuous effectiveness distributions In julian-urbano/simIReff: Stochastic Simulation for Information Retrieval Evaluation: Effectiveness Scores

## Description

These are functions to help in the creation and use of continuous effectiveness distributions.

## Usage

 ```1 2 3 4 5 6 7``` ```cap(x, xmin = 1e-06, xmax = 1 - xmin) effContMean(qfun, abs.tol = 1e-06, subdivisions = 500) effContVar(qfun, mu, abs.tol = 1e-06, subdivisions = 500) effContTrunc(dfun, pfun, qfun, ...) ```

## Arguments

 `x` a sample of effectiveness scores. `xmin` lowest value to cap scores. `xmax` highest value to cap scores. `qfun` a quantile function. `abs.tol` absolute accuracy requested, passed to `integrate`. `subdivisions` the maximum number of subintervals, passed to `integrate`. `mu` the expected value of the distribution (see `effContMean`). `dfun` a density function. `pfun` a distribution function. `...` additional arguments passed to other functions, if any.

## Details

`cap` caps (censor) a variable from below and above.

`effContMean` computes the expected value of a distribution by numerical integration of the given quantile function.

`effContVar` computes the variance of a distribution by numerical integration of the given quantile function.

`effContTrun` computes the density, distribution and quantile functions of the distribution resulting from truncating a given distribution between 0 and 1.

## Value

`cap`: the original vector, but censored.

`effContMean`: the estimate of the expected value.

`effContVar`: the estimate of the variance.

`effContTrunc`: a list with components:

 `td` the truncated density function. `tp` the truncated distribution function. `tq` the truncated quantile function.

`eff.cont`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```cap(c(0, .5, 1)) effContMean(function(p) qnorm(p, mean = 4)) effContMean(function(p) qbeta(p, 1, 2)) effContVar(function(p) qnorm(p, mean = 2, sd = 4), 2) effContVar(function(p) qbeta(p, 1, 2), 1/3) tr <- effContTrunc(dnorm, pnorm, qnorm, mean = .8, sd = .3) x01 <- seq(0, 1, .01) plot(x01, tr\$d(x01), type = "l") plot(x01, tr\$p(x01), type = "l") plot(x01, tr\$q(x01), type = "l") ```