boxcoxmix (version 0.28)

tolfind.boxcox: Grid search over tol for NPPML estimation of random effect and variance component models

Description

A grid search over the parameter tol, to set the initial values of the EM algorithm.

Usage

tolfind.boxcox(
  formula,
  groups = 1,
  data,
  K = 3,
  lambda = 1,
  EMdev.change = 1e-04,
  plot.opt = 2,
  s = 15,
  steps = 500,
  find.in.range = c(0, 1.5),
  start = "gq",
  verbose = FALSE,
  noformat = FALSE,
  ...
)

Arguments

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 groups = 1.

data

a data frame containing variables used in the fixed and random effect models.

K

the number of mass points.

lambda

a transformation parameter, setting lambda=1 means 'no transformation'.

EMdev.change

a small scalar, with default 0.0001, used to determine when to stop EM algorithm.

plot.opt

Set plot.opt=2, to plot the EM trajectories and the development of the disparity over iteration number. And plot.opt=0, for none of them.

s

number of points in the grid search of tol.

steps

maximum number of iterations for the EM algorithm.

find.in.range

search in a range of tol, with default (0,1.5) in step of 0.1 .

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.

verbose

If set to FALSE, no printed output on progress.

noformat

Set noformat = TRUE, to change the formatting of the plots.

extra arguments will be ignored.

Value

MinDisparity

the minimum disparity found.

Mintol

the value of tol corresponding to MinDisparity.

AllDisparities

a vector containing all disparities calculated on the grid.

Alltol

list of tol values used in the grid.

AllEMconverged

1 is TRUE, means the EM algorithm converged.

aic

the Akaike information criterion of the fitted regression model.

bic

the Bayesian information criterion of the fitted regression model.

Details

A grid search over tol can be performed using tolfind.boxcox() function, which works for np.boxcoxmix() to find the optimal solution.

See Also

np.boxcoxmix.

Examples

Run this code
# NOT RUN {
# The Pennsylvanian Hospital Stay Data
data(hosp, package = "npmlreg")
test1 <- tolfind.boxcox(duration ~ age , data = hosp, K = 2, lambda = 0, 
           find.in.range = c(0, 2), s = 10,  start = "gq")
# Minimal Disparity: 137.8368 at tol= 2 
# Minimal Disparity with EM converged: 137.8368 at tol= 2

# Effect of Phenylbiguanide on Blood Pressure
# }
# NOT RUN {
data(PBG, package = "nlme")
test2 <- tolfind.boxcox(deltaBP ~ dose , groups = PBG$Rabbit, find.in.range = c(0, 2),
    data = PBG, K = 2, lambda = -1, s = 15,  start = "quantile", plot.opt = 0)
test2$Mintol
# [1] 1.6
test2$MinDisparity
# [1] 449.5876
# }
# NOT RUN {







# }

Run the code above in your browser using DataLab