NPL.bands: Nonparametric likelihood confidence bands

Description Usage Arguments Value Author(s) Examples

View source: R/NPL.bands.R

Description

Computes the confidence bands for the empirical distribution function as described by Owen, A. (1997) JASA 90:516–521.

Usage

1
NPL.bands(x,conf.level)

Arguments

x

a numeric vector

conf.level

Either 0.95 (default) or 0.99

Value

x

The unique values of x

lower

The lower bound

upper

The upper bound

Author(s)

ross.darnell@csiro.au

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
### Empirical distribution of a gamma variable
### and comparing to a normal 
library(lattice)
y <- round(rgamma(100,shape=1.4,scale=20))
meany <- mean(y)
sdy <- sd(y)
print(xyplot(qnorm(lower)+qnorm(upper)~x,data=NPL.bands(y),
panel=function(x,y,...){
panel.xyplot(x,y,...)
panel.curve(qnorm(pnorm(x,mean=meany,sd=sdy)))}))
### and for a larger sample
yy <- round(rgamma(1000,shape=1.4,scale=20))
meanyy <- mean(yy)
sdyy <- sd(yy)
print(xyplot(qnorm(lower)+qnorm(upper)~x,data=NPL.bands(yy),
panel=function(x,y,...){
panel.xyplot(x,y,...)
panel.curve(qnorm(pnorm(x,mean=meanyy,sd=sdyy)))}))
###  and for a t-distributed variable with df=10
yyy <- round(rt(1000,df=10),1)
meanyyy <- mean(yyy)
sdyyy <- sd(yyy)
print(xyplot(qnorm(lower)+qnorm(upper)~x,data=NPL.bands(yyy),
panel=function(x,y,...){
panel.xyplot(x,y,...)
panel.curve(qnorm(pnorm(x,mean=meanyyy,sd=sdyyy)))}))
###  and for a mixture of t-distributed variables with df=5
yyyy <- round(c(rt(100,df=5)*5+20,rt(100,df=5)*5+40))
meanyyyy <- mean(yyyy)
sdyyyy <- sd(yyyy)
print(xyplot(qnorm(lower)+qnorm(upper)~x,data=NPL.bands(yyyy),
panel=function(x,y,...){
panel.xyplot(x,y,...)
panel.curve(qnorm(pnorm(x,mean=meanyyyy,sd=sdyyyy)))}))
#

SMIR documentation built on May 29, 2017, 10:39 a.m.

Related to NPL.bands in SMIR...