Title: | Normalisation of Multiple Variables in Large-Scale Datasets |
---|---|
Description: | The robustness of many of the statistical techniques, such as factor analysis, applied in the social sciences rests upon the assumption of item-level normality. However, when dealing with real data, these assumptions are often not met. The Box-Cox transformation (Box & Cox, 1964) <http://www.jstor.org/stable/2984418> provides an optimal transformation for non-normal variables. Yet, for large datasets of continuous variables, its application in current software programs is cumbersome with analysts having to take several steps to normalise each variable. We present an R package 'normalr' that enables researchers to make convenient optimal transformations of multiple variables in datasets. This R package enables users to quickly and accurately: (1) anchor all of their variables at 1.00, (2) select the desired precision with which the optimal lambda is estimated, (3) apply each unique exponent to its variable, (4) rescale resultant values to within their original X1 and X(n) ranges, and (5) provide original and transformed estimates of skewness, kurtosis, and other inferential assessments of normality. |
Authors: | Kevin Chang [aut, cre], Matthew Courtney [aut] |
Maintainer: | Kevin Chang <[email protected]> |
License: | GPL |
Version: | 1.0.1 |
Built: | 2024-11-21 03:19:40 UTC |
Source: | https://github.com/kcha193/normalr |
Computes optimal lambda value using boxcox function from the provided data.
getLambda(dat, lambda = seq(-10, 10, 1/100), parallel = TRUE)
getLambda(dat, lambda = seq(-10, 10, 1/100), parallel = TRUE)
dat |
a data frame containing the variables of numeric or integer vectors. |
lambda |
a vector of values of lambda – default (-10, 10) in steps of 0.01. |
parallel |
perform the computation in parallel, default setting is TRUE. |
a numeric vector
Courtney, M. G. R., and Chang, K. C. (2018) Dealing with non-normality: an introduction and step-by-step guide using R. TEST, doi: 10.1111/test.12154.
## Not run: getLambda(mtcars) getLambda(mtcars, parallel = FALSE)
## Not run: getLambda(mtcars) getLambda(mtcars, parallel = FALSE)
Apply normalisation on a numeric vector using a specific Lambda value
normalise(x, lambda = 3)
normalise(x, lambda = 3)
x |
a numeric vector to be normalised. |
lambda |
a numeric vector from the boxcox function |
a numeric vector with lambda, scale and the transformed variable
Courtney, M. G. R., and Chang, K. C. (2018) Dealing with non-normality: an introduction and step-by-step guide using R. TEST, doi: 10.1111/test.12154.
x <- c(1, 5, 9, 9, 9, 9, 10, 10, 10, 11, 11, 12) normalise(x, lambda = 3)
x <- c(1, 5, 9, 9, 9, 9, 10, 10, 10, 11, 11, 12) normalise(x, lambda = 3)
Apply normalisation on a data frame using specific Lambda value
normaliseData(dat, lambdas)
normaliseData(dat, lambdas)
dat |
a data frame containing the variables. |
lambdas |
a numeric vector from the boxcox function |
a data frame
Courtney, M. G. R., and Chang, K. C. (2018) Dealing with non-normality: an introduction and step-by-step guide using R. TEST, doi: 10.1111/test.12154.
## Not run: normaliseData(mtcars, getLambda(mtcars, parallel = FALSE)) normaliseData(mtcars, getLambda(mtcars, parallel = FALSE))
## Not run: normaliseData(mtcars, getLambda(mtcars, parallel = FALSE)) normaliseData(mtcars, getLambda(mtcars, parallel = FALSE))
Apply normalisation on a data frame using specific Lambda value
normaliseDataInfo(dat, lambdas)
normaliseDataInfo(dat, lambdas)
dat |
a data frame containing the variables. |
lambdas |
a numeric vector from the boxcox function |
a list of three elements, the first element, lambdas, is a numeric vector containing lambdas, the second element, scaled, is a numeric vector containing scale adjustment, the last element, transDat, is a data frame comprising the transformed variables.
Courtney, M. G. R., and Chang, K. C. (2018) Dealing with non-normality: an introduction and step-by-step guide using R. TEST, doi: 10.1111/test.12154.
## Not run: normaliseDataInfo(mtcars, getLambda(mtcars, parallel = FALSE)) normaliseDataInfo(mtcars, getLambda(mtcars, parallel = FALSE))
## Not run: normaliseDataInfo(mtcars, getLambda(mtcars, parallel = FALSE)) normaliseDataInfo(mtcars, getLambda(mtcars, parallel = FALSE))
Shiny application of the normalr
normalrShiny(example = "normalr")
normalrShiny(example = "normalr")
example |
name of the shiny apps |
## Not run: normalrShiny()
## Not run: normalrShiny()
Test dataset for the paper
testData
testData
An object of class data.frame
with 957 rows and 9 columns.