# A method to select the span of the sequence of lambda's for the case of homoscedastic error

### Description

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

### Usage

1 |

### Arguments

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

`msigma` |
The standard deviation |

`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, |

`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))
``` |