fyc7346165 发表于 2018-12-20 15:29 
包是包,函数是函数,你这个包的名字叫BNNPT,bnnpt是这个包里的一个函数
输入?bnnpt可以看这个函数的 ...
Usage
bnnpt(x, y, bags, mtry, perms)
Arguments
x
A vector containing values of a continuous variable (X).
y
A vector containing values of a continuous variable (Y).
bags
the number of bagging.
mtry
the number of randomly selected values from X.
perms
the number of permutations to calculate permutation pvalues.
Value
pvalue The pvalue of BNNPT.
Examples
#Example1
set.seed(1234)
x<-rnorm(1000)
y<-rnorm(1000)
#Test whether X and Y are independent or not using BNNPT
library(BNNPT)
#Set the parameters: bags= 20, mtry = 10, perms = 100
t1<- Sys.time()
bnnpt(x,y,bags=20, mtry=10, perm=100)
t2<- Sys.time()
#Output calculation time of BNNPT
t2-t1
#Example2
#Generate random variables X and Y with sin function
set.seed(1234)
x<-rnorm(1000)
y<-sin(x)
#Test whether X and Y are independent or not using BNNPT
library(BNNPT)
t1<- Sys.time()
#Set the parameters: bags= 50, mtry = 10, perms = 100
bnnpt(x,y,bags=50, mtry=10, perm=100)
t2<- Sys.time()
#Output calculation time of BNNPT
t2-t1
都在这了