Finding the Best Lambda to Convert Box-Cox to R

I am trying to convert data to a vector in R.

This is not for linear regression, so I do not have a predictor-response relationship. I just use a model that will improve accuracy by normalizing my data. (therefore, I cannot use the boxcox function since it only works with linear models).

The data I'm trying to convert:

vect
 [1]  99.64  49.71 246.84  96.17  16.67 352.00 421.25  81.77 105.00  37.85

I looked at this post .

It is not clear what is being done and how the optimization function is used, but I managed to change the function to create a function that I would like to minimize.

xskew <- function(data,par) {
abs(skewness((data^par-1)/par)) }

I would like to introduce a sequence of values ​​for lambda (possibly between 0.5 and 1 with jumps of 0.01) and find which of these values ​​minimizes xskew for my data set.

, , , . ?

edit: - :

 x <- seq(0.51,0.99,by=0.01)
 which(xskew(vect,x) < 0.05)

, , . , , .

+7
2

, y~1 R, boxcox MASS:

tmp <- exp(rnorm(10))
out <- boxcox(lm(tmp~1))
range(out$x[out$y > max(out$y)-qchisq(0.95,1)/2])

, , "" , , , , . "" 0,41, 0,5, , , 0,41 0,5?

+13

r:

library(forecast)
# to find optimal lambda
lambda = BoxCox.lambda( vector )
# now to transform vector
trans.vector = BoxCox( vector, lambda)
+11

All Articles