[R] Please, problem using bcPower

John Fox jfox at mcmaster.ca
Thu Jan 31 14:26:07 CET 2013


Dear Beatriz,

There are several problems that combine to make the computation unstable: the small size of the numbers, the small ratio of the largest to the smallest value, the extreme negative skew of the data, and the outliers at the low end. Because of the small ratio of max(x) to min(x), power transformations are ineffective and an extreme power is required:

> max(x)/min(x)
[1] 1.129898

> powerTransform(1e7*x)
Estimated transformation parameters 
1e+07 * x 
 31.77628 

You can use a negative start to produce a more sensible result:

> powerTransform(1e7*(x - .99*(min(x))))
Estimated transformation parameters 
1e+07 * (x - 0.99 * (min(x))) 
                     2.774309 

I was slightly surprised that the magnitude of the numbers is an issue.

I hope this helps,
 John

------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
	
On Thu, 31 Jan 2013 00:38:23 -0500
 Beatriz González <aguitatierra at hotmail.com> wrote:
> Hello,
> 
> I would like to perform a Box-Cox (“bcPower�) transformation on my data. For this, I am determining lambda using the “powerTransform� function. However, with one of my variables I get the following 
> 
> Warning Message:
> In estimateTransform(x, y, NULL, ...) :
>   Convergence failure: return code = 52 My variable is: 
> > x
>  [1] 0.0001031130 0.0001029480 0.0001040010 0.0001037940 0.0001046280 0.0000927650 0.0000942960
>  [8] 0.0000950250 0.0000949780 0.0000988210 0.0000975860 0.0000962850 0.0001015800 0.0001009190
> [15] 0.0001035350 0.0001033210 0.0001028420 0.0001023150 0.0001033000 0.0001036910 0.0001026890
> [22] 0.0001032480 0.0001012160 0.0001031270 0.0001034390 0.0001028180 0.0001034820 0.0001022700
> [29] 0.0001042640 0.0001046720 0.0001045860 0.0001045160 0.0001045850 0.0001038040 0.0001037020
> [36] 0.0001034050 0.0001048150 0.0001017180 0.0001017920 0.0001032730 0.0001029420 0.0001025220
> [43] 0.0001031490 0.0001036995 0.0001039735 0.0001014877 0.0001027960 And my code is:dlambda <- powerTransform(x) #It is here where I get the warning message
> x_BCx <- bcPower(x, lambda= dlambda$lambda, jacobian.adjusted= FALSE)
>  Does anyone know why I may be getting this Warning Message?  If you require more details please get in touch.
> 
> Many thanks in advance!
> 
> Bea
> 	[[alternative HTML version deleted]]
>



More information about the R-help mailing list