| Title: | Maximum Kernel Likelihood Estimation |
|---|---|
| Description: | Package for fast computation of the maximum kernel likelihood estimator (mkle). |
| Authors: | Thomas Jaki |
| Maintainer: | Thomas Jaki <[email protected]> |
| License: | GPL |
| Version: | 1.0.1 |
| Built: | 2026-05-12 08:52:29 UTC |
| Source: | https://github.com/cran/MKLE |
Computes the maximum kernel likelihood estimator using fast fourier transforms.
| Package: | MKLE |
| Type: | Package |
| Version: | 1.01 |
| Date: | 2023-08-21 |
| License: | GPL |
The maximum kernel likelihood estimator is defined to be the value that maximizes the estimated kernel likelihood based on the general location model,
This model assumes that the mean associated with $f_0$ is zero which of course implies that the mean of
is . The kernel likelihood is the estimated likelihood based on the above model using a kernel density estimate, , and is defined as
The resulting estimator therefore is an estimator of the mean of .
Thomas Jaki
Maintainer: Thomas Jaki <[email protected]>
Jaki T., West R. W. (2008) Maximum kernel likelihood estimation. Journal of Computational and Graphical Statistics Vol. 17(No 4), 976-993.
Silverman, B. W. (1986), Density Estimation for Statistics and Data Analysis, Chapman & Hall, 2nd ed.
data(state) mkle(state$CRIME)data(state) mkle(state$CRIME)
The function computes the kernel log likelihood for a given .
klik(delta , data, kde, grid, min)klik(delta , data, kde, grid, min)
delta |
the difference of the parameter theta for which the kernel log likelihood will be computed and the sample mean. |
data |
the data for which the kernel log likelihood will be computed. |
kde |
an object of the class "density". |
grid |
the stepsize between the x-values in kde. |
min |
the smallest x-value in kde. |
This function is intended to be called through the function mkle and is optimized for fast computation.
The log likelihood based on the shifted kernel density estimator.
Thomas Jaki
Jaki T., West R. W. (2008) Maximum kernel likelihood estimation. Journal of Computational and Graphical Statistics Vol. 17(No 4), 976-993.
data(state) attach(state) bw<-2*sd(CRIME) kdensity<-density(CRIME,bw=bw,kernel="biweight", from=min(CRIME)-2*bw,to=max(CRIME)+2*bw,n=2^12) min<-kdensity$x[1] grid<-kdensity$x[2]-min # finds the kernel log likelihood at the sample mean klik(0,CRIME, kdensity, grid, min)data(state) attach(state) bw<-2*sd(CRIME) kdensity<-density(CRIME,bw=bw,kernel="biweight", from=min(CRIME)-2*bw,to=max(CRIME)+2*bw,n=2^12) min<-kdensity$x[1] grid<-kdensity$x[2]-min # finds the kernel log likelihood at the sample mean klik(0,CRIME, kdensity, grid, min)
Computes the maximum kernel likelihood estimator for a given dataset and bandwidth.
mkle(data,bw=2*sd(data),kernel=c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"),gridsize=2^14)mkle(data,bw=2*sd(data),kernel=c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"),gridsize=2^14)
data |
the data for which the estimator should be found. |
bw |
the smoothing bandwidth to be used. |
kernel |
a character string giving the smoothing kernel to be used. This must be one of '"gaussian"', '"rectangular"', '"triangular"', '"epanechnikov"', '"biweight"', '"cosine"' or '"optcosine"', with default '"gaussian"'. May be abbreviated to a unique prefix (single letter). |
gridsize |
the number of points at which the kernel density estimator is to be evaluated with |
The default for the bandwidth is , which is the near-optimal value if a Gaussian kernel is used. If the bandwidth is zero, the sample mean will be returned.
Larger gridsize results in more acurate estimates but also longer computation times. The use of gridsizes between and is recommended.
The maximum kernel likelihood estimator.
optimize is used for the optimization and density is used to estimate the kernel density.
Thomas Jaki
Jaki T., West R. W. (2008) Maximum kernel likelihood estimation. Journal of Computational and Graphical Statistics Vol. 17(No 4), 976-993.
data(state) plot(density(state$CRIME)) abline(v=mean(state$CRIME),col='red') abline(v=mkle(state$CRIME),col='blue')data(state) plot(density(state$CRIME)) abline(v=mean(state$CRIME),col='red') abline(v=mkle(state$CRIME),col='blue')
Computes different confidence intervals for the maximum kernel likelihood estimator for a given dataset and bandwidth.
mkle.ci(data, bw=2*sd(data), alpha=0.1, kernel=c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"), method=c("percentile", "wald","boott"), B=1000, gridsize=2^14)mkle.ci(data, bw=2*sd(data), alpha=0.1, kernel=c("gaussian", "epanechnikov", "rectangular", "triangular", "biweight", "cosine", "optcosine"), method=c("percentile", "wald","boott"), B=1000, gridsize=2^14)
data |
the data for which the confidence interval should be found. |
bw |
the smoothing bandwidth to be used. |
alpha |
the significance level. |
kernel |
a character string giving the smoothing kernel to be used. This must be one of '"gaussian"', '"rectangular"', '"triangular"', '"epanechnikov"', '"biweight"', '"cosine"' or '"optcosine"', with default '"gaussian"', and may be abbreviated to a unique prefix (single letter). |
method |
a character string giving the type of interval to be used. This must be one of '"percentile"', '"wald"' or '"boott"'. |
B |
number of resamples used to estimate the mean squared error with 1000 as the default. |
gridsize |
the number of points at which the kernel density estimator is to be evaluated with |
The method can be a vector of strings containing the possible choices.
The bootstrap-t-interval can be very slow for large datasets and a large number of resamples as a two layered resampling is necessary.
A dataframe with the requested intervals.
Thomas Jaki
Jaki T., West R. W. (2008) Maximum kernel likelihood estimation. Journal of Computational and Graphical Statistics Vol. 17(No 4), 976-993.
Davison, A. C. and Hinkley, D. V. (1997), Bootstrap Methods and their Applications, Cambridge Series in Statistical and Probabilistic Mathematics, Cambridge University Press.
data(state) mkle.ci(state$CRIME,method=c('wald','percentile'),B=100,gridsize=2^11)data(state) mkle.ci(state$CRIME,method=c('wald','percentile'),B=100,gridsize=2^11)
Estimates the optimal bandwidth for the maximum kernel likelihood estimator using a Gaussian kernel for a given dataset using the bootstrap.
opt.bw(data, bws=c(sd(data),4*sd(data)), B=1000, gridsize=2^14)opt.bw(data, bws=c(sd(data),4*sd(data)), B=1000, gridsize=2^14)
data |
the data for which the optimal bandwidth should be found. |
bws |
a vector with the upper and lower bound for the bandwidth. |
B |
number of resamples used to estimate the mean squared error with 1000 as the default. |
gridsize |
the number of points at which the kernel density estimator is to be evaluated with |
The bandwidth considered fall between one and 4 standard deviations. In addition the mse of the mkle for a bandwidth of zero will also be included.
The estimation of the optimal bandwidth might take several minutes depending on the number of bootstrap resamples and the gridsize used.
The estimated optimal bandwidth.
The optimize is used for the optimization.
Thomas Jaki
Jaki T., West R. W. (2008) Maximum kernel likelihood estimation. Submitted to Journal of Computational and Graphical Statistics Vol. 17(No 4), 976-993.
Davison, A. C. and Hinkley, D. V. (1997), Bootstrap Methods and their Applications, Cambridge Series in Statistical and Probabilistic Mathematics, Cambridge University Press.
data(state) opt.bw(state$CRIME,B=10)data(state) opt.bw(state$CRIME,B=10)
The dataset gives the number of violent death per 100,000 population per state
data(state)data(state)
A data frame with 50 observations on the following 2 variables.
STATEa factor with levels AK AL AR AZ CA CO CT DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY
CRIMEa numeric vector
Shapiro, Robert~J. 1998. Statistical Abstract of the United States. 118 edn. U.S. Bureau of the Census.
data(state) hist(state$CRIME) mkle(state$CRIME)data(state) hist(state$CRIME) mkle(state$CRIME)