View source: R/powerTransform.R

testTransform | R Documentation |

`testTransform`

computes likelihood ratio tests for particular values of the power parameter
based on `powerTransform`

objects.

testTransform(object, lambda) ## S3 method for class 'powerTransform' testTransform(object, lambda=rep(1, dim(object$y)[2])) ## S3 method for class 'lmerModpowerTransform' testTransform(object, lambda=1) ## S3 method for class 'bcnPowerTransformlmer' testTransform(object, lambda=1)

`object` |
An object created by a call to |

`lambda` |
A vector of powers of length equal to the number of variables transformed. |

The function `powerTransform`

is used to estimate a power
transformation for a univariate or multivariate sample or multiple linear
regression problem, using the method of Box and Cox (1964). It is usual to
round the estimates to nearby convenient values, and this function is use to
compulte a likelihood ratio test for values of the transformation parameter
other than the ml-type estimate.

For one-parameter families of transformations, namely the Box-Cox power family `bcPower`

and the Yeo-Johnson power family `yjPower`

, this function computes a test based on twice the difference in the log-likelihood between the maximum likelihood-like estimate and the log-likelihood evaluated at the value of `lambda`

specified.

For the `bcnPower`

Box-Cox power with negatives allowed, the test is based on the profile loglikelihood maximizing over the location (or `gamma`

) parameter(s). Thus, `gamma`

is treated as a nusiance parameter.

A data frame with one row giving the value of the test statistic, its degrees of freedom, and a p-value. The test is the likelihood ratio test, comparing the value of the log-likelihood at the hypothesized value to the value of the log-likelihood at the maximum likelihood estimate.

Sanford Weisberg, <sandy@umn.edu>

Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. *Journal
of the Royal Statisistical Society, Series B*. 26 211-46.

Cook, R. D. and Weisberg, S. (1999) *Applied Regression Including Computing
and Graphics*. Wiley.

Fox, J. and Weisberg, S. (2019)
*An R Companion to Applied Regression*, Third Edition, Sage.

Weisberg, S. (2014) *Applied Linear Regression*, Fourth Edition, Wiley.

`powerTransform`

and `bcnPower`

for examples of the use of this function and other tests that might be of interest in some circumstances.

summary(a3 <- powerTransform(cbind(len, adt, trks, sigs1) ~ htype, Highway1)) # test lambda = (0 0 0 -1) testTransform(a3, c(0, 0, 0, -1)) summary(q1 <- powerTransform(lm(cbind(LoBD$I1L2, LoBD$I1L1) ~ pool, LoBD), family="bcnPower")) testTransform(q1, c(.3, .8))

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.