Learn R Programming

LEA (version 1.4.0)

adjusted.pvalues: adjusted p-values from a lfmm run

Description

Return the lfmm output vector of adjusted p-values and the genomic inflation factor using the genomic control method or the lambda inflation factor parameter for the chosen runs with K fatent factors, the d-th variable and the all option. For an example, see lfmm.

Usage

adjusted.pvalues (object, genomic.control, lambda, K, d, all, run)

Arguments

object
A lfmmProject object.
genomic.control
A boolean option. If true, the p-values are automatically calibrated using the genomic control method. If false, the p-values are calculated using the lambda inflation factor parameter.
lambda
the lambda inflation factor used to calibrate the p-value if genomic.control = FALSE (default: 1.0).
K
The number of latent factors.
d
The d-th variable.
all
A Boolean option. If true, the run with all variables at the same time. If false, the runs with each variable separately.
run
A list of chosen runs.

Value

res
A matrix containing a vector of p.values for the chosen runs per column.

See Also

lfmm.data lfmm p.values mlog10p.values

Examples

Run this code
### Example of analyses using lfmm ###

data("tutorial")
# creation of the genotype file, genotypes.lfmm.
# It contains 400 SNPs for 50 individuals.
write.lfmm(tutorial.R, "genotypes.lfmm")
# creation of the environment file, gradient.env.
# It contains 1 environmental variable for 40 individuals.
write.env(tutorial.C, "gradients.env")

################
# runs of lfmm #
################

# main options, K: (the number of latent factors), 
#           CPU: the number of CPUs.

# Toy runs with K = 3 and 2 repetitions.
# around 15 seconds per run.
project = NULL
project = lfmm("genotypes.lfmm", "gradients.env", K = 3, repetitions = 2,
    iterations = 6000, burnin = 3000, project = "new")

# get the adjusted p-values using the genomic control method
res = adjusted.pvalues(project, K = 3)

hist(res$p.values, col = "yellow3")

# get the adjusted p-values with the genomic inflatino factor
res = adjusted.pvalues(project, genomic.control = FALSE, 
    lambda = res$genomic.inflation.factor, K = 3)

hist(res$p.values, col = "yellow3")

Run the code above in your browser using DataLab