normalMean: Compute mean of truncated normal

Description Usage Arguments Details Value Author(s) Examples

View source: R/normalMean.R

Description

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

Usage

1
normalMean(cutoff, mean = 0, sd = 1)

Arguments

cutoff

The cutoff value for the truncated normal

mean

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

sd

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

Details

The mean of a pdf (f(x)) is computed by integrating the function x*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 mean of the tuncated normal distribution

Author(s)

Dustin Fife

Examples

1
2
3
4
5
### compute mean of a distribution cutoff at mean
normalMean(0, 0, 1)
### compare to simulated data
x = rnorm(1000000, 0, 1)
mean(x[x>0])


selection documentation built on May 20, 2017, 3:14 a.m.
Search within the selection package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.