Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
man
 
 
 
 
 
 
 
 

README.md

metapro

Introduction

The meta-analysis is conducted to increase the statistical power by combining evidences (e.g., effect sizes and p-values) obtained from multiple experiments. The p-value combination has been widely used for meta-analysis when effect sizes are not available. metapro is a CRAN R package that provides functions for p-value combinations. There are four functions including

  1. ordmeta : Minimum marginal p-value in joint order distribution
  2. wFisher : weighted Fisher's method
  3. wZ : weighted Z-method
  4. lancaster : Lancaster's procedure

The original Fisher's method and (weighted) Z-method have been commonly used for p-value combination. In particular, the Z-method is effective when a feature is associated with most of the cohorts. However, this attributes is disadvantageous detecting partially associated patterns (e.g., detection of African-specific features in trans-ethnic analysis).Therefore, in this study, we designed the ordmeta and wFisher method that work effectively in those situations. The detailed formulas are described in our paper.

Installation

Prerequisites

  1. JAVA : If not installed yet, please install it first. Download: https://www.java.com/en/
  2. Rtools (for Windows): Rtools are required for Windows users. Download: https://cran.r-project.org/bin/windows/Rtools/

After all prerequisites are installed, open R and install the metapro package by typing

install.packages('devtools') # install 'devtools'
library(devtools)
install_github('unistbig/metapro', INSTALL_opts=c("--no-multiarch"))
library(metapro) # Load metapro package
library(rSymPy)
sympyStart()

or

install.packages('metapro', INSTALL_opts=c("--no-multiarch")) 
library(metapro)
library(rSymPy)
sympyStart()

Tip: Dealing with Errors
In most cases, installation errors come from 1) encoding problem and 2) JAVA environment variable settings.
So, please try followings.

Encoding error
On Windows,

  • System locale setting modification: Click Start -> Control panel-> Clock and Region -> Region -> Administrative -> Change system locale... -> set 'Current system locale' as English (United States) and check the box in the below (Beta: Use Unicode UTF-8 for worldwide language support).
  • Reboot the PC, and execute Rstudio.
  • In the R console, type
Sys.setlocale('LC_ALL','C')

and install the package again.

Error from JAVA setting
Most error will occur with rJAVA. In this case, please

  • Check whether both JAVA and R are 64-bit, and
  • Set proper environment variable for JAVA_HOME, CLASSPATH, and RPATH.
  • Tip: System environment variable can be easily set by using Set.setenv() function in R. For example,
Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jdk1.8.0_211")
Sys.setenv(CLASSPATH="C:\\Program Files\\Java\\jdk1.8.0_211\\jre\\lib\\ext")
Sys.setenv(RPATH="C:\\Program Files\\R\\R-3.6.0\\bin\\x64")

If you are Linux or Mac OSX user, type following on terminal and re-open the R console after setting the environment variables.

sudo R CMD javareconf

Next, check whether rJAVA is installed correctly, and try installing metapro again.

install.packages('rJava')
library(rJava)

Usage

1. ordmeta

ordmeta combines p-value based on the minimum marginal p-value in the joint order distribution. In the result, it reports the combined p-value, optimal rank, effective p-value indices, marginal p-value at the optimal rank (MMP), and the direction of combined effect size (for two-tailed test).

Example

ordmeta(p=c(0.01, 0.02, 0.8, 0.25), is.onetail=FALSE, eff.sign = c(1,1,1,-1))
will return

$p
[1] 0.004427233

$optimal_rank
[1] 2

$eff.p.idx
[1] 1 2

$MMP
[1] 0.00059203

$overall.eff.direction
[1] "+"

Input Arguments and Values

Arguments
p A numeric vector of p-values
is.onetail Logical. If set TRUE, p-values are combined without considering the direction of effect, and vice versa. Default: TRUE.
eff.sign A vector of signs of effects. It works when is.onetail = FALSE
Value
p Combined p-value
optimal_rank The optimal rank where minimum marginal p-value exists.
eff.p.idx Indexes of effective p-values
MMP Minimum marginal p-value
overall.eff.direction The direction of combined effects.

2. wFisher

wFisher is designed to assign weights to each experiment based on the sample size.

Example

wFisher(p=c(0.01, 0.02, 0.8, 0.25), weight = c(200, 500, 100, 80), is.onetail=FALSE, eff.sign = c(1,1,1,-1))
will return

$p
[1] 0.003060523

$overall.eff.direction
[1] "+"

Input Arguments and Values

Arguments
p A numeric vector of p-values
is.onetail Logical. If set TRUE, p-values are combined without considering the direction of effect, and vice versa. Default: TRUE.
weight A numeric vector of weight or sample size for each experiment. Note! If no weight option is given, the original Fisher method is performed.
eff.sign A vector of signs of effects. It works when is.onetail = FALSE
Value
p Combined p-value
overall.eff.direction The direction of combined effects.

3. wZ

Weighted Z-method. This function has been modified from sumz function in metap package.

Example

wZ(p=c(0.01, 0.02, 0.8, 0.25), weight = c(200, 500, 100, 80), is.onetail=FALSE, eff.sign = c(1,1,1,-1))
will return

[1] 0.001798156

$overall.eff.direction
[1] "+"

$sumz
[1] 2.911558

Input Arguments and Values

Arguments
p A numeric vector of p-values
is.onetail Logical. If set TRUE, p-values are combined without considering the direction of effect, and vice versa. Default: TRUE.
weight A numeric vector of weight or sample size for each experiment. Note! If no weight option is given, the Stouffer's method is performed.
eff.sign A vector of signs of effects. It works when is.onetail = FALSE
Value
p Combined p-value
overall.eff.direction The direction of combined effects.
sumz Transformed sum of z-values

4. lancaster

Lancaster's procedure - the generalized version Fisher's method

Example

lancaster(p=c(0.01, 0.02, 0.8, 0.25), weight = c(200, 500, 100, 80), is.onetail=FALSE, eff.sign = c(1,1,1,-1))
will return

$p
[1] 0.005694935

$overall.eff.direction
[1] "+"

Input Arguments and Values

Arguments
p A numeric vector of p-values
is.onetail Logical. If set TRUE, p-values are combined without considering the direction of effect, and vice versa. Default: TRUE.
weight A numeric vector of weight or sample size for each experiment. Required!
eff.sign A vector of signs of effects. It works when is.onetail = FALSE
Value
p Combined p-value
overall.eff.direction The direction of combined effects.

Contact

Sora Yoon: ysora90@gmail.com
Department of Biological Sciences, UNIST

About

No description, website, or topics provided.

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.