Last chance! 50% off unlimited learning
Sale ends in
boxcox.fit(object, xmat, lambda, lambda2 = NULL, add.to.data = 0, ...)print.boxcox.fit(x, ...)
plot.boxcox.fit(x, hist = TRUE, data = eval(x$call$object), ...)
lines.boxcox.fit(x, data = eval(x$call$object), ...)
rep(1,
length(y))
.NULL
.
If TRUE
this parameter is also estimated and the initial
value is set to the absolute value of the minimum data.
boxcox.fit
.boxcox.fit
.boxcox.fit
.rboxcox
and dboxcox
for the
expression and more on the
Box-Cox transformation,
the minimization function optim
,
the function boxcox
in the package boxcox
in the package ## Simulating data
simul <- rboxcox(100, lambda=0.5, mean=10, sd=2)
## Finding the ML estimates
ml <- boxcox.fit(simul)
ml
## Ploting histogram and fitted model
plot(ml)
##
## 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)
##
## Another example, now estimating lambda2
##
simul <- rboxcox(100, lambda=0.5, mean=10, sd=2)
ml <- boxcox.fit(simul, lambda2 = TRUE)
ml
plot(ml)
##
## An example with a regression model
##
if(require(MASS)){
data(trees)
boxcox.fit(object = trees[,3], xmat = trees[,1:2])
}
Run the code above in your browser using DataLab