Movatterモバイル変換


[0]ホーム

URL:


minerva

R package for Maximal Information-Based Nonparametric Explorationcomputation

Install

install.packages("minerva")
devtools::install_github('filosi/minerva')

Usage

library(minerva)x<-0:200/200y<-sin(10* pi* x)+ xmine(x,y,n.cores=1)
x<-0:200/200y<-sin(10* pi* x)+ xmine_stat(x, y,measure="mic")
x<-0:200/200y<-sin(10* pi* x)+ xr2<-cor(x, y)mm<-mine_stat(x, y,measure="mic")mm- r2**2## mine(x, y, n.cores=1)[[5]]

Compute statistic onmatrices

x<-matrix(rnorm(1000),ncol=10,nrow=10)y<-as.matrix(rnorm(1000),ncol=10,nrow=20)## Compare feature of the same matrixpstats(x)## Compare features of matrix x with feature in matrix ycstats(x, y)

Mictools pipeline

This is inspired to the original implementation by Albanese etal. available in python here:https://github.com/minepy/mictools.

Reading the data frommictool repository

datasaurus<-read.table("https://raw.githubusercontent.com/minepy/mictools/master/examples/datasaurus.txt",header=TRUE,row.names=1,as.is=TRUE,stringsAsFactors=FALSE)datasaurus.m<-t(datasaurus)

Compute null distributionfortic_e

Automatically compute:

ticnull<-mictools(datasaurus.m,nperm=10000,seed=1234)## Get the names of the named listnames(ticnull)##[1]  "tic"      "nulldist" "obstic"   "obsdist"  "pval"
Null Distribution
ticnull$nulldist
BinStartBinEndNullCountNullCumSum
0e+001e-0401e+05
1e-042e-0401e+05
2e-043e-0401e+05
3e-044e-0401e+05
4e-045e-0401e+05
5e-046e-0401e+05
….….
Observed distribution
ticnull$obsdist
BinStartBinEndCountCountCum
0e+001e-040325
1e-042e-040325
2e-043e-040325
3e-044e-040325
4e-045e-040325
5e-046e-040325
….….

Plottic_e and pvalue distribution.

hist(ticnull$tic)hist(ticenull$pval,breaks=50,freq=FALSE)

Usep.adjust.method to use a different pvalue correctionmethod, or use theqvalue package to use Storey’sqvalue.

## Correct pvalues using qvalueqobj<-qvalue(ticnull$pval$pval)## Add column in the pval data.frameticnull$pval$qvalue<- qobj$qvalueticnull$pval

Same table as above with the qvalue column added at the end.

pvalI1I2Var1Var2adj.P.Valqvalue
0.520212away_xbullseye_x0.951
0.953313away_xcircle_x0.991
0.044214away_xdino_x0.520
0.621915away_xdots_x0.951
0.892216away_xh_lines_x0.981
0.397217away_xhigh_lines_x0.911
….

Strenght of the association(MIC)

## Use columns of indexes and FDR adjusted pvaluemicres<-mic_strength(datasaurus.m, ticnull$pval,pval.col=c(6,2,3))
TicePvalMICI1I2
0.04570.42215
0.00000.63316
0.01960.50518
0.01620.36922
0.00000.631023
0.00000.571326

Association strength computed based on theqvalueadjusted pvalue

## Use qvalue adjusted pvaluemicresq<-mic_strength(datasaurus.m, ticnull$pval,pval.col=c("qvalue","Var1","Var2"))
TicePvalMICI1I2
0.04010.42bullseye_xbullseye_y
0.00000.63circle_xcircle_y
0.01720.50dots_xdots_y
0.01430.36slant_up_xslant_up_y
0.00000.63star_xstar_y
0.00000.57x_shape_xx_shape_y

Citing minepy/minerva andmictools

minepy2013Davide Albanese, Michele Filosi, RobertoVisintainer, Samantha Riccadonna, Giuseppe Jurman and Cesare Furlanello.minerva and minepy:a C engine for the MINE suite and its R, Pythonand MATLAB wrappers. Bioinformatics (2013) 29(3): 407-408 firstpublished online December 14, 2012
mictools2018Davide Albanese, Samantha Riccadonna,Claudio Donati, Pietro Franceschi.A practical tool for maximalinformation coefficient analysis. GigaScience (2018)

[8]ページ先頭

©2009-2025 Movatter.jp