Description Usage Arguments Value Class Attributes Class Methods Details Examples
Conduct Box-Cox Transformation. This can be used as
an estimation process where data are fitted to the linear regression model of the transformed variable; or
a transformer that transforms dependent variable
Transformation parameters can be fixed by users, or estimated by the maximum likelihood.
1 2 | box_cox_transform(lambda = 1, lambda2 = NULL,
skipfit = FALSE, tol = 1e-5)
|
initial value for lambda parameter
initial value for lambda2 parameter or logical that indicates if lambda2 should be estimated. If NULL
or FALSE
, then lambda2 is fixed to 0
logical. If TRUE, fit
method does nothing and the parameters are fixed to the initial values.
lambda smaller than this level is regarded as 0 and log function is applied
BoxCoxTransform
class object
regression coefficients
fit(x = NULL, y)
if skipfit
is FALSE
, then estimate the lambda parameter(s) by the maximum likelihood, otherwise, the parameters are fixed. In either case, regression coeffients beta are estimated by the least squares
transform(x = NULL, y)
transform y
and returns list of x
and y
inv_transform(x = NULL, y)
inverse transform y
and returns list of x
and y
predict(x, ...)
return predicted values of y
in the pre-transfom scale
incr_fit(x, y)
not available
uses boxcoxfit
as the backend paramter estimator
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | simul <- geoR::rboxcox(100, lambda=0.5, mean=10, sd=2)
b <- box_cox_transform()
b$fit(y=simul)
cat(b$lambda, '\n')
b <- box_cox_transform(lambda2=TRUE)
b$fit(y=seq(-1, 1, 1/20))
cat(b$lambda, b$lambda2, '\n')
data(trees)
b <- box_cox_transform()
x <- trees[,1:2]
y <- trees[,3]
b$fit(x, y)
pred <- b$predict(x)$y
cor(y, pred)
## Not run:
plot(y, pred)
## End(Not run)
b <- box_cox_transform(lambda=0, skipfit=TRUE)
b$fit(y=1:10)
cat(b$lambda, b$beta, '\n')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.