span.select: A method to select the span of the sequence of lambda's for...

Description Usage Arguments Author(s) References See Also Examples

View source: R/NPsimex.R

Description

To compute the optimal span of the sequence of lambda's for the case of homoscedastic error.

Usage

1
 span.select(W, msigma, span=c(2,4,6,8,10,12,25), from=min(W), to=max(W), n.user=128, n.lambda=50, lambda="SJ", bw="SJ", adjust=1, na.rm = FALSE, ...)

Arguments

W

The observed data. It is a vector of length at least 10.

msigma

The standard deviation σ of measurement error. It is a single positive numeric value.

span

span is a vector of user-defined grids for spans.

from

the starting point where the PDF is to be evaluated.

to

the starting point where the PDF is to be evaluated.

n.user

number of points where the PDF is to be evaluated.

n.lambda

number of points of lambda's.

lambda

Specifies the first lambda. It can be a single numeric value which has been pre-determined; or computed with the specific density bandwidth selector: 'nrd0', 'nrd', 'ucv', 'bcv', 'SJ'.

bw

Specifies the bandwidth of 'W'. It can be a single numeric value which has been pre-determined; or computed with the specific density bandwidth selector: 'nrd0', 'nrd', 'ucv', 'bcv', 'SJ'.

adjust

adjust the range there the PDF is to be evaluated. By default, adjust=1.

na.rm

is set to FALSE by default: no NA value is allowed.

...

control

Author(s)

X.F. Wang wangx6@ccf.org

References

Wang, X.F., Sun, J. and Fan, Z. (2011). Deconvolution density estimation with heteroscedastic errors using SIMEX.

See Also

simex.density.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
############### Homoscadestic error
N <- 1000
set.seed(123); X <- c(rnorm(N/2, mean=-2), rnorm(N/2,mean=2)); U <- rnorm(N,sd=1)
msigma <- 0.5
W <- X + msigma*U

plot.simex.density <- function(X.simex,X,...){
	plot(X.simex$x, X.simex$y, type="l", xlab="x", ylab="density", lwd=3, lty=2, col=2,...)
	lines(density(X, bw="SJ"), lwd=3)
	}

#---- Select the optimal lambda span
par(mfrow=c(1,2))
spans <- span.select(W, msigma)
plot(spans$span, spans$ISE, type="o", xlab="span", ylab="ISE") 

X.simex <- simex.density(W, msigma=msigma, adjust=1, n.lambda=50, span=spans$span[order(spans$ISE)[1]])
plot.simex.density(X.simex, X, ylim=c(0,0.25))

NPsimex documentation built on May 1, 2019, 6:32 p.m.

Related to span.select in NPsimex...