ztransform: Transformation to standard Normal

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Transformation of a variable or residuals from GLM analysis to standard Normal.

Usage

1

Arguments

formula

GLM formula for the variable to be transformed, or just the variable

data

data.frame or gwaa.data object containing the data

family

GLM family

Details

Transformation to normality generates a variable which has mean zero and variance of one. If formula used, residuals from regression model are scaled to standard Normal.

Value

Vector containing transformed variable, distributed as standard normal.

Author(s)

Yurii Aulchenko

See Also

ztransform

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
	# uniformly distributed variable
	x <- round(runif(200)*100)
	# get 7 missing values
	x[round(runif(7,min=1,max=100))] <- NA
	# Z-transform
	y0 <- ztransform(x)
	# Rank-transform to normality
	y1 <- rntransform(x)
	# test normality of the original and transformed var
	shapiro.test(x)
	shapiro.test(y0)
	shapiro.test(y1)
	# plot histogram
	par(mfcol=c(3,1))
	hist(x)
	hist(y0)
	hist(y1)
	# tests with genetic data
	require(GenABEL.data)
	data(srdta)
	Zqt1 <- ztransform(qt1,srdta)
	Zqt1sexA <- ztransform(qt1~sex,srdta)

Example output

Loading required package: MASS
Loading required package: GenABEL.data

	Shapiro-Wilk normality test

data:  x
W = 0.94805, p-value = 1.812e-06


	Shapiro-Wilk normality test

data:  y0
W = 0.94805, p-value = 1.812e-06


	Shapiro-Wilk normality test

data:  y1
W = 0.99745, p-value = 0.9891

GenABEL documentation built on May 30, 2017, 3:36 a.m.

Related to ztransform in GenABEL...