Learn R Programming

wtest (version 3.0)

w.qqplot: plots for w p-values diagnosis

Description

To draw a Q-Q plot for W-test

Usage

w.qqplot(data, y, w.order = c(1, 2), input.poolsize = 100,
  hf1 = "default.hf1", hf2 = "default.hf2", ...)

Arguments

data

a data frame or matrix contains genotypes in the columns. Genotypes should be coded as (0, 1, 2) or (0, 1).

y

a numeric vector composed of 0 or 1; or a factor variable with two levels.

w.order

a numeric number taking values 1 or 2. If w.order = 1, main effect is calculated. If w.order = 2, pairwise interaction effect is calculated.

input.poolsize

a numeric number; The maximum number of values used to calculate first or second order effects. The default is 200.

hf1

a data frame or matrix, contains the h and f values for main effect (w.order =1) calculation at the number of categorical combinations (k) = 2 or 3. Default hf1 is h = k/(k-1) and f = k-1, where k = 2 to 3, in which the first row is the h and f for k = 2, and second row is the h and f for k = 3.

hf2

a data frame or matrix, contains the h and f values for pairwise interaction effect calculation (w.order=2) when k = 2 to 9. Default hf2 is h = k/(k-1) and f = k-1, where k = 2 to 9, the first row is the h and f for k = 2, and the last row is the h and f for k = 9.

...

graphical parameters.

Value

Q-Q plot

Details

The Q-Q plot for W-test is to use a set of randomly generated y as phenotype, to test its null distribution compared with chi-square distribution. To fit different type of data and adjust the distribution, h and f parameters are strongly recommended to calculate instead of the default hf1 and hf2 for first and second order, respectively.

The input.poolsize is suggested to set as 1000 for w.order = 1 and 200 for w.order = 2.

Examples

Run this code
# NOT RUN {
data(mydata)
data(phenotype1)
## Step 1. HF Calculation.
# Please note that parameter B is recommended to be greater than 400.
hf1<-hf(data = mydata, w.order = 1, B = 200)

w.qqplot(data = mydata, y = phenotype1, w.order = 1, hf1 = hf1, cex =.5)
abline(0,1)
# }

Run the code above in your browser using DataLab