Last data update: 2014.03.03

R: Back-transform Y to X
get_inputR Documentation

Back-transform Y to X

Description

get_input back-transforms the observed data oldsymbol y to the (approximate) input data oldsymbol x_{τ} using the transformation vector τ = (μ_x(oldsymbol β), σ_x(oldsymbol β), γ, α, δ).

Note that get.input should be deprecated; however, since it was explicitly referenced in Goerg (2011) I keep it here for future reference. New code should use get_input exclusively.

Usage

get_input(y, tau, return.u = FALSE)

get.input(...)

Arguments

y

a numeric vector of data values or an object of class LambertW_fit.

tau

named vector τ which defines the variable transformation. Must have at least 'mu_x' and 'sigma_x' element; see complete_tau for details.

return.u

should the normalized input be returned; default: FALSE.

...

arguments passed to get_input.

Value

The (approximated) input data vector widehat{oldsymbol x}_{τ}.

For gamma != 0 it uses the principal branch solution W_gamma(z, branch = 0) to get a unique input.

For gamma = 0 the back-transformation is bijective (for any δ ≥q 0, α ≥q 0).

If return.u = TRUE, then it returns a list with 2 vectors

u

centered and normalized input widehat{oldsymbol u}_{θ},

x

input data widehat{oldsymbol x}_{θ}.

See Also

get_output

Examples


set.seed(12)
# unskew very skewed data
y <- rLambertW(n = 1000, theta = list(beta = c(0, 1), gamma = 0.3), 
               distname = "normal")
test_normality(y)
fit.gmm <- IGMM(y, type="s")

x <- get_input(y, fit.gmm$tau)
# the same as
x <- get_input(fit.gmm)
test_normality(x) # symmetric Gaussian

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(LambertW)
Loading required package: MASS
Loading required package: ggplot2
This is 'LambertW' version 0.6.4.  Please see the NEWS file and citation("LambertW").

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LambertW/get_input.Rd_%03d_medium.png", width=480, height=480)
> ### Name: get_input
> ### Title: Back-transform Y to X
> ### Aliases: get.input get_input
> ### Keywords: manip
> 
> ### ** Examples
> 
> 
> set.seed(12)
> # unskew very skewed data
> y <- rLambertW(n = 1000, theta = list(beta = c(0, 1), gamma = 0.3), 
+                distname = "normal")
> test_normality(y)
$seed
[1] 5860

$shapiro.wilk

	Shapiro-Wilk normality test

data:  data.test
W = 0.84799, p-value < 2.2e-16


$shapiro.francia

	Shapiro-Francia normality test

data:  data.test
W = 0.8472, p-value < 2.2e-16


$anderson.darling

	Anderson-Darling normality test

data:  data
A = 34.768, p-value < 2.2e-16


> fit.gmm <- IGMM(y, type="s")
> 
> x <- get_input(y, fit.gmm$tau)
> # the same as
> x <- get_input(fit.gmm)
> test_normality(x) # symmetric Gaussian
$seed
[1] 879918

$shapiro.wilk

	Shapiro-Wilk normality test

data:  data.test
W = 0.99875, p-value = 0.7239


$shapiro.francia

	Shapiro-Francia normality test

data:  data.test
W = 0.99877, p-value = 0.673


$anderson.darling

	Anderson-Darling normality test

data:  data
A = 0.39955, p-value = 0.3628


> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>