Description Usage Arguments Details Value Author(s) References See Also Examples

This function provides the nonparametric kernel density estimation of a doubly truncated random variable. A bandwidth value is required.

1 |

`X` |
numeric vector with the values of the target variable. |

`U` |
numeric vector with the values of the left truncation variable. |

`V` |
numeric vector with the values of the rigth truncation variable. |

`bw` |
The smoothing bandwidth to be used, but can also be a character string giving a rule to choose the bandwidth. This must be one of |

`from` |
the left point of the grid at which the density is to be estimated. |

`to` |
the rigth point of the grid at which the density is to be estimated. |

`n` |
number of evaluation points on a equally spaced grid. |

`wg` |
Numeric vector of non-negative initial solution, with the same length as |

The nonparametric kernel density estimation for a variable which is observed under random double truncation is computed as proposed in Moreira and de Uña-Álvarez (2012). As usual in kernel smoothing, the estimator is obtained as a convolution between a kernel function and an appropriate estimator of the cumulative df. Gaussian kernel is used. The automatic bandwidth selection procedures for the kernel density estimator are those proposed in Moreira and Van Keilegom (2013). The automatic bandwidth selection alternatives are appropriate modifications, i.e, taking into account the double truncation issue, of the normal reference rule, two types of plug-in procedures, the least squares cross-validation and a bootstrap based method proposed in Cao et al. (1994) and Sheater and Jones (1991) for the complete data.

A list containing the following values:

`x ` |
the n coordinates of the points where the density is estimated. |

`y` |
the estimated density values. |

`bw` |
the bandwidth used. |

Carla Moreira, de de Uña-Álvarez and Rosa Crujeiras

Cao R, Cuevas A and González-Manteiga W (1994). A comparative study of several smoothing methods in density estimation. *Computational Statistics and Data
Analysis* **17**, 153-176.

Moreira C and de Uña-Álvarez J (2012) Kernel density estimation with doubly
truncated data. *Electronic Journal of Statistics* **6**, 501-521.

Moreira C and Van Keilegom I (2013) Bandwidth selection for kernel density estimation with
doubly truncated data. *Computational Statistics and Data Analysis* **61**, 107-123.

Sheather S and Jones M (1991) A reliable data-based bandwidth selection method for kernel density estimation. *Journal of the Royal Statistical Society: Series
B* **53**, 683-690.

Silverman BW (1986) Density Estimation. London: Chapman and Hall.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ```
n<-50
X <- runif(n, 0, 1)
U <- runif(n,-1/3, 1)
V <- U + 1/3
for (i in 1:n){
while (U[i] > X[i] | V[i] < X[i]){
X[i] <- runif(1, 0, 1)
U[i] <- runif(1, -1/3, 1)
V[i] <- U[i] + 1/3
}
}
vxDens1<-densityDT(X,U,V,bw="DPI1",0,1,500)
vxDens2<-densityDT(X,U,V,bw="DPI2",0,1,500)
vxDens3<-densityDT(X,U,V, bw=0.5,0,1,500)
vxDens4<-densityDT(X,U,V,bw="LSCV",0,1,500)
data(Quasars)
densityDT(Quasars[,1],Quasars[,2],Quasars[,3],bw="DPI1",-2.5,2.2,500)
densityDT(Quasars[,1],Quasars[,2],Quasars[,3], bw=0.5,-2.5,2.2,500)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.