normalVar: Compute variance of truncated normal

Description Usage Arguments Details Value Author(s) Examples

View source: R/normalVar.R

Description

Given a particular cutoff (x), what is the variance of the new truncated normal?

Usage

1
normalVar(cutoff, truncMean = NULL, mean = 0, sd = 1)

Arguments

cutoff

The cutoff value for the truncated normal

truncMean

The mean of the truncated normal. If left NULL, it will be estimated.

mean

The mean of the non-truncated distribution (defaults to zero)

sd

The sd of the non-truncated distribution (defaults to 1)

Details

The variance of a pdf (f(x)) is computed by integrating the function x^2*f(x) from -Inf to Inf. To compute a truncated normal, the function remains the same, but the limits change (from -Inf to cutoff).

Value

the variance of the tuncated normal distribution

Author(s)

Dustin Fife

Examples

1
2
3
4
5
### compute variance of a distribution cutoff at zero
normalVar(1)
### compare to simulated data
x = rnorm(10000000, 0, 1)
var(x[x>1])

selection documentation built on May 30, 2017, 5:27 a.m.