| Title: | Doubly Truncated Data Analysis, Non Iterative |
|---|---|
| Description: | Non-iterative estimator for the cumulative distribution of a doubly truncated variable. de Uña-Álvarez J. (2018) <doi:10.1007/978-3-319-73848-2_37>. |
| Authors: | Jacobo de Uña Álvarez [aut], José Carlos Soage González [cre] |
| Maintainer: | José Carlos Soage González <[email protected]> |
| License: | GPL-2 |
| Version: | 1.0 |
| Built: | 2026-05-12 06:34:48 UTC |
| Source: | https://github.com/sidoruvigo/dtda.ni |
Non-iterative estimator for the cumulative distribution of a doubly truncated variable, see de Uña-Álvarez (2018). Restricted to interval sampling.
Documentation for package ‘DTDA.ni’ version 1.0
Package: DTDA.ni
Version: 1.0
Maintainer: José Carlos Soage González [email protected]
License: GPL-2
DTDAni: Implements a non-iterative estimator for the cumulative distribution of a doubly truncated variable
plot.DTDAni: S3 method to plot a DTDAni object by using the generic plot function.
Jacobo de Uña-Álvarez was supported by Grant MTM2014-55966-P, Spanish Ministry of Economy and Competitiveness.
José Carlos Soage was supported by Red Tecnológica de Matemática Industrial (Red TMATI), Cons. de Cultura, Educación e OU, Xunta de Galicia (ED341D R2016/051) and by Grupos de Referencia Competitiva, Consolidación y Estructuración de Unidades de Investigación Competitivas del SUG, Cons. de Cultura, Educación e OU, Xunta de Galicia (GRC ED431C 2016/040).
de Uña-Álvarez, Jacobo.
Soage González, José Carlos.
de Uña-Álvarez J. (2018) A Non-iterative Estimator for Interval Sampling and Doubly Truncated Data. In: Gil E., Gil E., Gil J., Gil M. (eds) The Mathematics of the Uncertain. Studies in Systems, Decision and Control, vol 142. Springer, Cham, pp. 387-400.
Useful links:
This function computes a non-iterative estimator for the cumulative distribution of a doubly truncated variable, see de Uña-Álvarez (2018). The function is restricted to interval sampling.
DTDAni(x, u, tau)DTDAni(x, u, tau)
x |
Numeric vector corresponding the variable of ultimate interest. |
u |
Numeric vector corresponding to the left truncation variable. |
tau |
Sampling interval width. The right truncation values will be internally calculated as v = u + tau. |
The function DTDAni is adapted to the presence of ties.
It can be used to compute the direct and the reverse estimators;
see the example below. Both curves are valid estimators for the cumulative
distribution (F) of the doubly truncated variable. Weighted estimators
with are valid too, the choice being
recommended in practice (de Uña-Álvarez, 2018).
A list containing:
x |
The distinct values of the variable of interest. |
nx |
The absloute frequency of each x value. |
cumprob |
The estimated cumulative probability for each x value. |
P |
The auxiliary Pi used in the calculation of the estimator. |
L |
The auxiliary Li used in the calculation of the estimator. |
Jacobo de Uña-Álvarez was supported by Grant MTM2014-55966-P, Spanish Ministry of Economy and Competitiveness.
José Carlos Soage was supported by Red Tecnológica de Matemática Industrial (Red TMATI), Cons. de Cultura, Educación e OU, Xunta de Galicia (ED341D R2016/051) and by Grupos de Referencia Competitiva, Consolidación y Estructuración de Unidades de Investigación Competitivas del SUG, Cons. de Cultura, Educación e OU, Xunta de Galicia (GRC ED431C 2016/040).
de Uña-Álvarez, Jacobo.
Soage González, José Carlos.
Maintainer: José Carlos Soage González. [email protected]
de Uña-Álvarez J. (2018) A Non-iterative Estimator for Interval Sampling and Doubly Truncated Data. In: Gil E., Gil E., Gil J., Gil M. (eds) The Mathematics of the Uncertain. Studies in Systems, Decision and Control, vol 142. Springer, Cham
## Not run: # Generating data which are doubly truncated: N <- 250 x0 <- runif(N) # Original data u0 <- runif(N, -0.25, 0.5) # Left-truncation times tau <- 0.75 # Interval width v0 <- u0 + tau x <- x0[u0 <= x0 & x0 <= v0] u <- u0[u0 <= x0 & x0 <= v0] v <- v0[u0 <= x0 & x0 <= v0] n <- length(x) # Final sample size after the interval sampling # Create an object with DTDAni function res <- DTDAni(x, u, tau) plot(res) abline(a = 0, b = 1, col = "green") #the true cumulative distribution # Calculating the reverse estimator: res2 <- DTDAni(-x, -u - tau, tau) lines(-res2$x, 1 - res2$cumprob, type = "s", col = "blue", lty = 2) # Weigthed estimator (recommended): w <- 1/2 k <- length(res$x) Fw <- w * res$cumprob + (1 - w) * (1 - res2$cumprob[k:1]) lines(res$x, Fw, type = "s", col = 2) # Using res$P and res$L to compute the estimator: k <- length(res$x) F <- rep(1, k) for (i in 2:k){ F[i] <- (F[i - 1] - res$P[i - 1]) / res$L[i - 1] + res$P[i - 1] } F0 <- F/max(F) # This is equal to res$cumprob ## End(Not run)## Not run: # Generating data which are doubly truncated: N <- 250 x0 <- runif(N) # Original data u0 <- runif(N, -0.25, 0.5) # Left-truncation times tau <- 0.75 # Interval width v0 <- u0 + tau x <- x0[u0 <= x0 & x0 <= v0] u <- u0[u0 <= x0 & x0 <= v0] v <- v0[u0 <= x0 & x0 <= v0] n <- length(x) # Final sample size after the interval sampling # Create an object with DTDAni function res <- DTDAni(x, u, tau) plot(res) abline(a = 0, b = 1, col = "green") #the true cumulative distribution # Calculating the reverse estimator: res2 <- DTDAni(-x, -u - tau, tau) lines(-res2$x, 1 - res2$cumprob, type = "s", col = "blue", lty = 2) # Weigthed estimator (recommended): w <- 1/2 k <- length(res$x) Fw <- w * res$cumprob + (1 - w) * (1 - res2$cumprob[k:1]) lines(res$x, Fw, type = "s", col = 2) # Using res$P and res$L to compute the estimator: k <- length(res$x) F <- rep(1, k) for (i in 2:k){ F[i] <- (F[i - 1] - res$P[i - 1]) / res$L[i - 1] + res$P[i - 1] } F0 <- F/max(F) # This is equal to res$cumprob ## End(Not run)
S3 method to plot a DTDAni object by using the generic plot function.
## S3 method for class 'DTDAni' plot(x, ecdf = FALSE, ...)## S3 method for class 'DTDAni' plot(x, ecdf = FALSE, ...)
x |
DTDAni object. |
ecdf |
Whether to display the ordinary empirical cumulative distribution function or not. Default = FALSE. |
... |
Aditional parameters. |
Jacobo de Uña-Álvarez was supported by Grant MTM2014-55966-P, Spanish Ministry of Economy and Competitiveness.
José Carlos Soage was supported by Red Tecnológica de Matemática Industrial (Red TMATI), Cons. de Cultura, Educación e OU, Xunta de Galicia (ED341D R2016/051) and by Grupos de Referencia Competitiva, Consolidación y Estructuración de Unidades de Investigación Competitivas del SUG, Cons. de Cultura, Educación e OU, Xunta de Galicia (GRC ED431C 2016/040).
de Uña-Álvarez, Jacobo.
Soage González, José Carlos.
Maintainer: José Carlos Soage González. [email protected]
de Uña-Álvarez J. (2018) A Non-iterative Estimator for Interval Sampling and Doubly Truncated Data. In: Gil E., Gil E., Gil J., Gil M. (eds) The Mathematics of the Uncertain. Studies in Systems, Decision and Control, vol 142. Springer, Cham, pp. 387-400.
## Not run: N <- 250 x0 <- runif(N) # Original data u0 <- runif(N, -0.25, 0.5) # Left-truncation times tau <- 0.75 # Interval width v0 <- u0 + tau x <- x0[u0 <= x0 & x0 <= v0] u <- u0[u0 <= x0 & x0 <= v0] v <- v0[u0 <= x0 & x0 <= v0] n <- length(x) # Final sample size after the interval sampling res <- DTDAni(x, u , tau) plot(res) plot(res, ecdf = TRUE) ## End(Not run)## Not run: N <- 250 x0 <- runif(N) # Original data u0 <- runif(N, -0.25, 0.5) # Left-truncation times tau <- 0.75 # Interval width v0 <- u0 + tau x <- x0[u0 <= x0 & x0 <= v0] u <- u0[u0 <= x0 & x0 <= v0] v <- v0[u0 <= x0 & x0 <= v0] n <- length(x) # Final sample size after the interval sampling res <- DTDAni(x, u , tau) plot(res) plot(res, ecdf = TRUE) ## End(Not run)