zoukankan      html  css  js  c++  java
  • 基于T-test的permutation test

    基于T-test的permutation test

    1:R 中进行换检验的方式有多种,比较典型的就是coin包中的oneway_test函数,但是一个问题是实际问题考虑的可能只是单侧的置换检验的结果,
    但是oneway_test计算的默认是双侧的P值,
    这时的计算最好是用Deducer包中的perm.t.test函数

     

       

       

    2:简单的perm.t.test函数的说明

      perm.t.test(x,y,statistic=c("t","mean"),alternative=c("two.sided", "less", "greater"), midp=TRUE, B=10000)

     x           a numeric vector containing the first sample
     y           a numeric vector containing the second sample
     statistic      The statistic to be permuted. See details
     alternative     The alternative hypothesis,可以设置是单侧的还是双侧的假设检验
     midp         should the mid p-value be used
     B           The number of monte-carlo samples to be generated
    Details This function performs a two sample permutation test. If the mean is permuted, then the test assumes exchangability between the two samples.

    if the t-statistic is used, the test assumes either exchangability or a sufficiently large sample size. Because there is little lost in the way of power,
    and the assumptions are weaker, the t-statistic is used by default.
    Value A list with class "htest" containing the following components: statistic   The observed value of the statistic. p.value   the p-value for the test. method   a character string indicating the type of test performed. data.name   a character string giving the name(s) of the data. B   The number of samples generated alternative   the direction of the test
    4:例子默认的是以Ttest的方式进行置换检验 perm.t.test(rnorm(100),runif(100,-.5,.5)) rm(list=ls()) x<-c(1,2,3,4,5) y<-c(100,101,102,103,104) perm.t.test(y,x,alternative="greater",midp=TRUE, B=1000)
    5:使用注意:
    a:不同类样本的先后顺序
    b:函数perm.t.test处于Deducer包中,在安装Deducer的过程中需要涉及java的环境配置等等,
    需要R的版本与Java的版本一致,目前找到的比较好的处理方式参照如下:
    http://www.cnblogs.com/ohshit/p/6159644.html

    处理之后便可以成功library rJava



     

  • 相关阅读:
    NET网络配置
    NTP时间同步器
    NFS配置linux
    DNS配置域名解析
    ftp配置windows
    samba配置与windows
    NTP服务和DNS服务
    NFS服务和DHCP服务scp
    SAMBA服务和FTP服务
    find用法
  • 原文地址:https://www.cnblogs.com/lmj-sky/p/6202144.html
Copyright © 2011-2022 走看看