evepan: Calculate expected value of censored variable

Description Usage Arguments Value Examples

Description

This function calculates the expected value of a random censored epanechnikov-distributed variable with a given censoring point. The inverse of this function is cepan.

Usage

1
evepan(c = 0, mu = 0, r = 5^0.5, side_censored = "left")

Arguments

c

censoring point.

mu

mean of distribution prior to censoring.

r

half the range of the distribution, ie the distance from the mean to the smallest/largest value supported by the distribution. r=5^.5 corresponds to a standard deviation of 1.

side_censored

indicates whether the variable is left or right censored. Default is side_censored='left'

Value

the expected value associated with c, mu and r.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#Expected value of an epan-distributed variable left-censored at 100 (given mu=100 and r=10):
evepan(c=100,mu=100,r=10)

#Expected value as a function of censoring point, epanechnikov distribution:
curve(evepan(c=x),col='blue',xlim=c(-sqrt(5),sqrt(5)),yaxs='i',xaxs='i',
main='Expected value as a function of censoring point',xlab='Censoring point',ylab='Expected value')

#Expected value as a function of censoring point, normal distribution:
curve(dnorm(x)+pnorm(x)*x,col='green',add=TRUE)

#Expected value as a function of censoring point, no uncertainty:
curve(1*x,col='grey',add=TRUE)

#Legend
legend(x=-sqrt(5),y=sqrt(5),legend=c('Epanechnikov','Normal distribution','No uncertainty'),
lty=c(1,1),col=c('blue','green','grey'))

epandist documentation built on May 2, 2019, 4:55 a.m.