需要在R中使用npmv包(非参数测试)的帮助吗
我试图使用R中的Bathke包“npmv”在我创建的数据集上运行nonpartest()函数。在他们的论文中,他们将实现的代码用于提供的数据集“sherry”:需要在R中使用npmv包(非参数测试)的帮助吗,r,R,我试图使用R中的Bathke包“npmv”在我创建的数据集上运行nonpartest()函数。在他们的论文中,他们将实现的代码用于提供的数据集“sherry”: install.packages("npmv") library(npmv) data("sberry",package="npmv") nonpartest(weight|bot|fungi|rating~treatment,data=sberry,permreps=1000) 这非常适合他们的数据集。但是,当我尝试在具有完全相同维
install.packages("npmv")
library(npmv)
data("sberry",package="npmv")
nonpartest(weight|bot|fungi|rating~treatment,data=sberry,permreps=1000)
这非常适合他们的数据集。但是,当我尝试在具有完全相同维度的csv数据集上运行它时,由于某些原因它不起作用,并不断给我错误“未找到数据集”,并说样本大小必须至少为2
他们的数据集如下:
Treatment Replicate Weight Botrytis Fungi Phomopsis
Kocide 1 6.9 4.1 17.24 1
Kocide 2 8.3 5.13 5.65 1
Kocide 3 8.4 6.07 8.8 1.5
Kocide 4 7.95 2.72 9.51 1.5
Elevate 1 8.6 1.19 17.06 1
Elevate 2 8.5 0.55 12.86 1
Elevate 3 8.2 0.74 6.76 0.5
Elevate 4 9.5 0.99 1.84 1
V-10135 1 6.2 4.29 4.64 1
V-10135 2 9 1.56 3.03 3
V-10135 3 6.8 0.88 5.6 0
V-10135 4 8.5 2.42 8.66 2
Control 1 7.5 15.6 13.08 1
Control 2 6.7 10.28 14.43 1
Control 3 8.7 13.29 10.92 2.5
Control 4 7.4 18.38 16.03 3
而我的是:
Treatment Replicate Weight_Loss Persistent Head_Size Salebarn_Q
LA 200 1 17.90 14.10 14.25 1.0
LA 200 2 19.30 15.30 2.56 1.0
LA 200 3 19.50 16.82 5.80 1.5
LA 200 4 18.94 12.70 7.51 1.5
Excede 1 19.60 11.20 14.52 1.0
Excede 2 19.50 10.54 9.83 1.0
Excede 3 19.10 10.83 3.82 0.5
Excede 4 20.40 11.00 0.04 1.0
Micotil 1 17.30 14.29 1.62 1.0
Micotil 2 20.00 11.65 0.13 3.0
Micotil 3 18.10 10.89 2.41 0.0
Micotil 4 19.50 12.43 5.93 2.0
Zoetis 1 18.50 25.48 10.08 1.0
Zoetis 2 17.60 20.12 11.93 1.0
Zoetis 3 19.70 23.29 7.93 2.5
Zoetis 4 18.50 28.32 13.08 3.0
(Zoetis由我控制)
我试过密码
data("Cattle", package = "npmv")
nonpartest(Weight_Loss|Persistent|Head_Size|Salebarn_Q~Treatment,data=Cattle,permreps=1000)
你知道我怎样才能返回他们为我的数据集示例获得的相同测试统计数据吗?提前感谢。对data()的调用应该用于包提供的数据集,而不是您导入的数据集。我认为你误解了一个警告
R报告“警告”和“错误”,我不认为你的是错误。加载数据并运行该函数时,我没有收到任何错误:
Cattle <- read.table(text=" Treatment Replicate Weight_Loss Persistent Head_Size Salebarn_Q
'LA 200' 1 17.90 14.10 14.25 1.0
'LA 200' 2 19.30 15.30 2.56 1.0
'LA 200' 3 19.50 16.82 5.80 1.5
'LA 200' 4 18.94 12.70 7.51 1.5
Excede 1 19.60 11.20 14.52 1.0
Excede 2 19.50 10.54 9.83 1.0
Excede 3 19.10 10.83 3.82 0.5
Excede 4 20.40 11.00 0.04 1.0
Micotil 1 17.30 14.29 1.62 1.0
Micotil 2 20.00 11.65 0.13 3.0
Micotil 3 18.10 10.89 2.41 0.0
Micotil 4 19.50 12.43 5.93 2.0
Zoetis 1 18.50 25.48 10.08 1.0
Zoetis 2 17.60 20.12 11.93 1.0
Zoetis 3 19.70 23.29 7.93 2.5
Zoetis 4 18.50 28.32 13.08 3.0", header=TRUE)
牛非常好,非常感谢,我想错误是在对象分配中,不知怎么的?当我复制并粘贴你的时,它可以工作,但当我复制并粘贴时,它确实给了我一个实际的错误:“[1]”错误:每个组的样本大小必须至少为2”警告消息:1:最小值(哪一帧[,组变量]==级别(帧[,组变量])[I]):最小值没有不丢失的参数;返回Inf 2:最大值(哪一帧[,组变量]==级别(帧[,组变量])[i] ):max没有未丢失的参数;返回-Inf“如果只执行read.table
或其他类似的输入语句,但不将其分配给对象名,则它基本上消失。函数只能在命名对象上工作。情况与save
和load
不同。任何“保存”-d对象保留其名称,并且在后续会话中执行加载
调用后,名称立即可用,无需进一步赋值。这很有意义,我的对象只是从中读取csv,因此您完全正确。非常感谢
Cattle <- read.table(text=" Treatment Replicate Weight_Loss Persistent Head_Size Salebarn_Q
'LA 200' 1 17.90 14.10 14.25 1.0
'LA 200' 2 19.30 15.30 2.56 1.0
'LA 200' 3 19.50 16.82 5.80 1.5
'LA 200' 4 18.94 12.70 7.51 1.5
Excede 1 19.60 11.20 14.52 1.0
Excede 2 19.50 10.54 9.83 1.0
Excede 3 19.10 10.83 3.82 0.5
Excede 4 20.40 11.00 0.04 1.0
Micotil 1 17.30 14.29 1.62 1.0
Micotil 2 20.00 11.65 0.13 3.0
Micotil 3 18.10 10.89 2.41 0.0
Micotil 4 19.50 12.43 5.93 2.0
Zoetis 1 18.50 25.48 10.08 1.0
Zoetis 2 17.60 20.12 11.93 1.0
Zoetis 3 19.70 23.29 7.93 2.5
Zoetis 4 18.50 28.32 13.08 3.0", header=TRUE)
nonpartest(Weight_Loss|Persistent|Head_Size|Salebarn_Q~Treatment,data=Cattle,permreps=1000)
Hit <Return> to see next plot:
Hit <Return> to see next plot:
Hit <Return> to see next plot:
Hit <Return> to see next plot:
$results
Test Statistic df1 df2 P-value
ANOVA type test p-value 2.843 6.912 27.6479 0.023
McKeon approx. for the Lawley Hotelling Test NA NA NA NA
Muller approx. for the Bartlett-Nanda-Pillai Test NA NA NA NA
Wilks Lambda NA NA NA NA
Permutation Test p-value
ANOVA type test p-value 0.007
McKeon approx. for the Lawley Hotelling Test NA
Muller approx. for the Bartlett-Nanda-Pillai Test NA
Wilks Lambda NA
$releffects
Weight_Loss Persistent Head_Size Salebarn_Q
Excede 0.71875 0.15625 0.50000 0.30469
LA 200 0.43750 0.59375 0.53125 0.53125
Micotil 0.45312 0.37500 0.23438 0.53125
Zoetis 0.39062 0.87500 0.73438 0.63281
Warning message:
In nonpartest(Weight_Loss | Persistent | Head_Size | Salebarn_Q ~ :
Rank covariance matrix is singular, only ANOVA test returned