Description Usage Format Source Examples
Number of children of 4075 widows entitled to support from a certain pension fund from Thisted (1988).
1 |
A data frame with 4075 observations on 1 variable. Replicates are generated to reflect the number of children n that widows entitled to support have (n = 0, 1, ..., 6). As there are 3062 widows that have no children, 0 appears 3062 times in the data, as there are 587 widows that have one child, 1 appears 587 times in the data, etc.
Thisted, R. A. (1988). Elements of statistical computing: Numerical computation (Vol. 1). CRC Press.
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 | data(children)
# convert the data to vector:
children.obs <- unlist(children)
# explicit function giving the estimate for the j^th moment of the
# mixing distribution, needed for Hankel.method "explicit"
explicit.pois <- function(dat, j){
mat <- matrix(dat, nrow = length(dat), ncol = j) -
matrix(0:(j-1), nrow = length(dat), ncol = j, byrow = TRUE)
return(mean(apply(mat, 1, prod)))
}
# define the MLE function:
MLE.pois <- function(dat) mean(dat)
# construct a 'datMix' object:
children.dM <- datMix(children.obs, dist = "pois", discrete = TRUE,
Hankel.method = "explicit",
Hankel.function = explicit.pois,
theta.bound.list = list(lambda = c(0, Inf)),
MLE.function = MLE.pois)
# define the penalty:
pen <- function(j, n) j * log(n)
# complexity estimation:
set.seed(0)
det_sca_pen <- nonparamHankel(children.dM, j.max = 5, scaled = TRUE,
B = 1000, pen.function = pen)
plot(det_sca_pen, main = "Non-parametric Hankel method for Children dataset")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.