| scoreYJpn | R Documentation |
The transformations for negative and positive responses were determined
by Yeo and Johnson (2000) by imposing the smoothness condition that the
second derivative of zYJ(lambda) with respect to y be smooth at y = 0. However,
some authors, for example Weisberg (2005), query the physical
interpretability of this constraint which is often violated in data
analysis. Accordingly, Atkinson et al (2019) and (2020) extend the
Yeo-Johnson transformation to allow two values of the transformations
parameter: lambda N for negative observations and lambda P for non-negative ones.
ScoreYJpn computes:
1) the t test associated with the constructed variable computed assuming a different transformation for positive observations keeping the value of the transformation parameter for negative observations fixed. In short, we call this test 'test for positive observations'.
2) the t test associated with the constructed variable computed assuming a different transformation for negative observations keeping the value of the transformation parameter for positive observations fixed. In short, we call this test 'test for negative observations'.
3) the F test for the joint presence of the two constructed variables described in points 1) and 2).
scoreYJpn(
x,
y,
intercept = TRUE,
la = c(-1, -0.5, 0, 0.5, 1),
nocheck = FALSE,
trace = FALSE,
...
)
x |
An Missing values (NA's) and infinite values (Inf's) are allowed, since observations (rows) with missing or infinite values will automatically be excluded from the computations. |
y |
Response variable. A vector with |
intercept |
wheather to use constant term (default is |
la |
values of the transformation parameter for which it is necessary
to compute the score test. Default value of lambda is
|
nocheck |
Whether to check input arguments. If |
trace |
Whether to print intermediate results. Default is |
... |
potential further arguments passed to lower level functions. |
An S3 object of class scoreYJpn.object will be returned which is basically a list
containing the following elements:
la: vector containing the values of lambda for which the test is computed
Score: Matrix of size length(lambda)-by-3 that contains the value
of the score test for each value of lambda specified in optional input parameter la.
The first column refers to the test for positive observations, the second column
refers to the test for negative observations and the third column refers to
the F test for the joint presence of the two constructed variables. If la
is not specified, the number of rows of the matrix Score is equal to 5
and will contain the values of the score test for the 5 most common values of lambda.
FSDA team, valentin.todorov@chello.at
Yeo, I.K. and Johnson, R. (2000), A new family of power transformations to improve normality or symmetry, "Biometrika", Vol. 87, pp. 954-959.
Atkinson, A.C. Riani, M., Corbellini A. (2019), The analysis of transformations for profit-and-loss data, Journal of the Royal Statistical Society, Series C, "Applied Statistics", https://doi.org/10.1111/rssc.12389
Atkinson, A.C. Riani, M. and Corbellini A. (2021), The Box–Cox Transformation: Review and Extensions, "Statistical Science", Vol. 36, pp. 239-255, https://doi.org/10.1214/20-STS778
## Not run:
## Example in which positive and negative observations require the same lambda
set.seed(1234)
n <- 100
y <- rnorm(n)
## Transform the value to find out if we can recover the true value of
## the transformation parameter.
la <- 0.5
ytra <- normYJ(y, la=la, inverse=TRUE)
## Start the analysis
X <- rep(1, n)
outSC <- scoreYJ(X, ytra, intercept=FALSE)
outSCpn <- scoreYJpn(X, ytra, intercept=FALSE)
la <- c(-1, -0.5, 0, 0.5, 1)
print(cbind(la, outSCpn$Score[,1], outSC$Score, outSCpn$Score[,2]))
## Comment: if we consider the 5 most common values of lambda,
## the value of the score test when lambda=0.5 is the only one which is not
## significant. Both values of the score test for positive and negative
## observations confirm that this value of the transformation parameter is
## OK for both sides of the distribution.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.