Last chance! 50% off unlimited learning
Sale ends in
Functions related with the Box-Cox family of transformations.
Density and random generation for the Box-Cox transformed normal
distribution with mean
equal to mean
and standard deviation equal to sd
, in the normal scale.
rboxcox(n, lambda, lambda2 = NULL, mean = 0, sd = 1)dboxcox(x, lambda, lambda2 = NULL, mean = 0, sd = 1)
The functions returns the following results:
a vector of random deviates.
a vector of densities.
numerical value(s) for the transformation parameter
logical or numerical value(s) of the additional transformation
(see DETAILS below). Defaults to NULL
.
number of observations to be generated.
a vector of quantiles (dboxcox
) or an output of
boxcoxfit
(print
, plot
, lines
).
a vector of mean values at the normal scale.
a vector of standard deviations at the normal scale.
Paulo Justiniano Ribeiro Jr. paulojus@leg.ufpr.br,
Peter J. Diggle p.diggle@lancaster.ac.uk.
Denote
An additional shifting parameter
The function rboxcox
samples rnorm
and backtransform the values according to the
equations above to obtain values of
Box, G.E.P. and Cox, D.R.(1964) An analysis of transformations. JRSS B 26:211--246.
The parameter estimation function is boxcoxfit
.
Other packages has BoxCox related functions such as boxcox
in the package MASS and
the function box.cox
in the package car.
## Simulating data
simul <- rboxcox(100, lambda=0.5, mean=10, sd=2)
##
## Comparing models with different lambdas,
## zero means and unit variances
curve(dboxcox(x, lambda=-1), 0, 8)
for(lambda in seq(-.5, 1.5, by=0.5))
curve(dboxcox(x, lambda), 0, 8, add = TRUE)
Run the code above in your browser using DataLab