compak_fitpmf.Rd
The function estimates the p.m.f. using the Conway-Maxwell-Poisson associated kernels (compak) smoother. Bandwidth can be specified as h
or nu
where nu
= 1/h
. If none is specified, one can be provided by using cross-validation or minimising Kullback-Leibler divergence.
compak_fitpmf( a.sample, x = NULL, h = NULL, nu = NULL, workers = 1L, bandwidth_optim = "KL", ... )
a.sample | numeric vector: the data sample from which estimate is to be computed. |
---|---|
x | Either |
h, nu | numeric: the bandwidth or smoothing parameter. Only one is needed and they are related by |
workers | numeric; a positive integer to represent the number of cores used for parallel processing to evaluate the kde |
bandwidth_optim | character; the type of bandwidth selection to be used. Possible values are "KL" (Kullback-Leibler divergence) and "CV" (cross-validation). |
... | other arguments passed to bandwidth selection, such as |
An object class 'compak' is a list containing the following components:
the estimated p.m.f. values
The data - same as input a.sample
The bandwidth used to compute the density estimate
The dispersion used to compute the density estimate
The coordinates of the points where the density is estimated
the type of bandwidth selection used - same as input
a list that contains the estimated kernel at each grid point
### Huang et, al (2020) Page 10 data(days) fit.compak2 <- compak_fitpmf(days, 10:40, bandwidth_optim = "CV") fit.compak2#> #> Call: compak_fitpmf(a.sample = days, x = 10:40, bandwidth_optim = "CV") #> #> Data: days #> Bandwidth: 0.0251 #> Bandwidth selection: cross-validation #> Kernel: Conway-Maxwell-Poisson #> Range: [10, 40] #> #> Parameter estimates #> nu: 39.8985### Huang et, al (2020) Page 9 # \donttest{ data(somites) fit.compak <- compak_fitpmf(somites, 60:180, bandwidth_optim = "CV") # }