| Kfind.boxcox | R Documentation | 
A grid search over the parameter K, to set the best number of
mass-points.
Kfind.boxcox(
  formula,
  groups = 1,
  data,
  lambda = 1,
  EMdev.change = 1e-04,
  steps = 500,
  find.k = c(2, 10),
  model.selection = "aic",
  start = "gq",
  find.tol = c(0, 1.5),
  steps.tol = 15,
  ...
)
formula | 
 a formula describing the transformed response and the fixed effect model (e.g. y ~ x).  | 
groups | 
 the random effects. To fit overdispersion models , set   | 
data | 
 a data frame containing variables used in the fixed and random effect models.  | 
lambda | 
 a transformation parameter, setting   | 
EMdev.change | 
 a small scalar, with default 0.0001, used to determine when to stop EM algorithm.  | 
steps | 
 maximum number of iterations for the EM algorithm.  | 
find.k | 
 search in a range of   | 
model.selection | 
 Set   | 
start | 
 a description of the initial values to be used in the fitted model, Quantile-based version "quantile" or Gaussian Quadrature "gq" can be set.  | 
find.tol | 
 search in a range of   | 
steps.tol | 
 number of points in the grid search of   | 
... | 
 extra arguments will be ignored.  | 
Not only the shape of the distribution causes the skewness it may due to the use of an 
insufficient number of classes, K. For this, the Kfind.boxcox() function 
was created to search over a selected range of K and find the best. For each number
of classes, a grid search over tol is performed and the tol with the lowest 
aic or bic value is considered as the optimal. Having the minimal aic or bic values for a whole range of
K that have been specified beforehand, the Kfind.boxcox() function can find 
the best number of the component as the one with the smallest value. It also plots the aic or bic values against
the selected range of K, including a vertical line indicating the best value of K
that minimizes the model selection criteria. The full range of 
classes and their corresponding optimal tol can be printed off from the Kfind.boxcox()'s
output and used with other boxcoxmix functions as starting points.
List with class boxcoxmix containing:
MinDisparity | 
 the minimum disparity found.  | 
Best.K | 
 the
value of   | 
AllMinDisparities | 
 a vector containing all minimum disparities calculated on the grid.  | 
AllMintol | 
 list of   | 
All.K | 
 list of   | 
All.aic | 
 the Akaike information criterion of all fitted regression models.  | 
All.bic | 
 the Bayesian information criterion of all fitted regression models.  | 
Amani Almohaimeed and Jochen Einbeck
tolfind.boxcox.
# Fabric data
data(fabric, package = "npmlreg")
teststr<-Kfind.boxcox(y ~ x, data = fabric,  start = "gq", groups=1, 
find.k = c(2, 3), model.selection = "aic", steps.tol=5)
# Minimal AIC: 202.2114 at K= 2 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.