Last data update: 2014.03.03

R: adjusted p-values from a lfmm run
adjusted.pvaluesR Documentation

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.

Author(s)

Eric Frichot

See Also

lfmm.data lfmm p.values mlog10p.values

Examples

### 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")

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(LEA)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/LEA/adjusted_pvalues.Rd_%03d_medium.png", width=480, height=480)
> ### Name: adjusted.pvalues
> ### Title: adjusted p-values from a lfmm run
> ### Aliases: adjusted.pvalues
> ### Keywords: lfmm
> 
> ### ** Examples
> 
> ### 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")
[1] "genotypes.lfmm"
> # creation of the environment file, gradient.env.
> # It contains 1 environmental variable for 40 individuals.
> write.env(tutorial.C, "gradients.env")
[1] "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")
The project is saved into :
 genotypes_gradients.lfmmProject 

To load the project, use:
 project = load.lfmmProject("genotypes_gradients.lfmmProject")

To remove the project, use:
 remove.lfmmProject("genotypes_gradients.lfmmProject")

[1] "********************************"
[1] "* K = 3  repetition 1  d = 1   *"
[1] "********************************"
Summary of the options:

        -n (number of individuals)      50
        -L (number of loci)             400
        -K (number of latent factors)   3
        -o (output file)                genotypes_gradients.lfmm/K3/run1/genotypes_r1
        -i (number of iterations)       6000
        -b (burnin)                     3000
        -s (seed random init)           772036597
        -p (number of processes (CPU))  1
        -x (genotype file)              genotypes.lfmm
        -v (variable file)              gradients.env
        -D (number of covariables)      1
        -d (the dth covariable)         1

Read variable file:
 	gradients.env		OK.

Read genotype file:
 	genotypes.lfmm		OK.

<<<<
	 Analyse for variable 1

		Start of the Gibbs Sampler algorithm.

	[                                                                           ]
	[===========================================================================]

		End of the Gibbs Sampler algorithm.

	ED:20000.19902	 DIC: 19968.12444 


ERROR: unable to open file genotypes_gradients.lfmm/K3/run1/genotypes_r1_s1.3.dic. Please, check that the name of the file you provided is correct.

Error: 
Execution halted