R:NE.Johnson包(RE.ADT(xsl[,i]):object';p';中的错误未找到)
我目前正在使用Johnson软件包转换一些数据(例如,错误召回物品的百分比和类似数据) () 除了两个变量外,NE.Johnson函数对我的大多数数据都适用。 尝试运行函数时,我收到以下错误:R:NE.Johnson包(RE.ADT(xsl[,i]):object';p';中的错误未找到),r,package,transformation,R,Package,Transformation,我目前正在使用Johnson软件包转换一些数据(例如,错误召回物品的百分比和类似数据) () 除了两个变量外,NE.Johnson函数对我的大多数数据都适用。 尝试运行函数时,我收到以下错误: >recall_Johnson <- RE.Johnson(RECALL) 不起作用:回忆错误 > sort.x=sort(Inhibpercent) > print(sort.x) [1] 0.0000000 0.0000000 0.0000000 0.00000
>recall_Johnson <- RE.Johnson(RECALL)
不起作用:回忆错误
> sort.x=sort(Inhibpercent)
> print(sort.x)
[1] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[7] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[13] 0.8403361 0.8474576 1.2605042 1.6666667 1.6666667 1.6666667
[19] 1.6666667 1.6666667 1.6666667 1.6666667 1.6806723 1.6949153
[25] 1.6949153 1.6949153 1.7021277 1.7241379 1.7241379 1.7543860
[31] 2.0833333 2.1008403 2.1276596 2.5000000 2.5000000 2.5104603
[37] 2.5423729 2.5531915 2.9166667 2.9166667 2.9166667 2.9166667
[43] 2.9411765 2.9535865 3.0042918 3.3333333 3.3333333 3.3333333
[49] 3.3333333 3.3613445 3.3755274 3.3755274 3.3898305 3.3898305
[55] 3.4188034 3.4482759 3.7500000 3.7656904 3.7815126 3.7815126
[61] 3.8297872 4.1666667 4.1841004 4.2016807 4.2194093 4.5833333
[67] 4.6025105 4.6511628 4.6808511 5.0000000 5.0000000 5.0000000
[73] 5.0209205 5.0847458 5.0847458 5.0847458 5.0847458 5.1282051
[79] 5.4393305 5.5319149 5.8333333 6.6666667 6.6666667 6.7796610
[85] 6.7796610 6.7796610 6.7796610 6.8965517 6.8965517 7.3033708
[91] 8.3333333 8.3333333 8.3333333 8.3333333 8.3333333 8.3333333
[97] 8.4388186 8.4745763 8.4745763 8.4745763 8.6206897 9.5833333
[103] 9.6638655 10.0000000 10.1694915 10.1694915 10.3448276 10.5042017
[109] 10.7142857 11.3924051 11.6666667 11.6666667 12.0833333 13.3333333
[115] 15.2542373 18.3333333 20.7547170 25.8536585
> sort.x=sort(incorrectrecallpercent)
> print(sort.x)
[1] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[7] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[13] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[19] 0.0000000 0.0000000 0.0000000 0.0000000 0.4166667 0.4166667
[25] 0.4201681 0.4201681 0.4201681 0.4219409 0.4255319 0.4255319
[31] 0.4878049 0.8333333 0.8368201 0.8403361 0.8403361 0.8438819
[37] 1.2500000 1.2500000 1.2500000 1.2605042 1.2875536 1.6666667
[43] 1.6666667 1.6666667 1.6666667 1.6666667 1.6666667 1.6736402
[49] 1.6949153 1.6949153 1.6949153 2.1186441 2.1186441 2.1186441
[55] 2.5000000 2.5000000 2.5104603 2.5210084 2.5210084 2.9166667
[61] 2.9787234 3.3333333 3.3333333 3.3898305 3.3898305 3.7500000
[67] 3.7735849 3.7974684 4.1666667 4.1841004 4.6025105 5.0000000
[73] 5.0000000 5.0847458 5.0847458 5.1724138 5.3571429 5.4621849
[79] 5.5084746 5.5555556 6.6666667 6.6666667 6.7226891 6.7796610
[85] 6.7796610 6.8965517 7.0175439 8.3333333 8.3333333 8.3333333
[91] 8.3333333 8.3333333 8.3333333 8.3333333 8.3333333 10.0000000
[97] 10.0000000 10.0000000 10.1694915 10.3448276 11.2359551 11.6666667
[103] 12.2807018 12.2881356 13.5593220 13.7931035 13.7931035 16.1016949
[109] 16.2790698 16.4556962 16.9491525 17.9487179 26.1603376 29.3103448
[115] 32.2033898 32.2033898 32.2033898 39.9159664
除了回忆有稍微多一些零的例子外,我真的看不出有什么实质性的区别吗?但也许我忽略了什么
我试着遵循这条线索的指导:
建议修改该代码(关于Johnson.R的第101-103行):
if(xsb.valida[1,i]==0)xsb.adtest[1,i]Wow。该软件包的源代码充满了危险
我在您提供的SO链接中做了建议的更改,它确实解决了您的问题,理论上也解决了您的问题:
# install.packages("devtools")
devtools::install_github("hrbrmstr/Johnson")
library(Johnson)
c(0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000,
0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000,
0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000,
0.0000000, 0.4166667, 0.4166667, 0.4201681, 0.4201681, 0.4201681, 0.4219409,
0.4255319, 0.4255319, 0.4878049, 0.8333333, 0.8368201, 0.8403361, 0.8403361,
0.8438819, 1.2500000, 1.2500000, 1.2500000, 1.2605042, 1.2875536, 1.6666667,
1.6666667, 1.6666667, 1.6666667, 1.6666667, 1.6666667, 1.6736402, 1.6949153,
1.6949153, 1.6949153, 2.1186441, 2.1186441, 2.1186441, 2.5000000, 2.5000000,
2.5104603, 2.5210084, 2.5210084, 2.9166667, 2.9787234, 3.3333333, 3.3333333,
3.3898305, 3.3898305, 3.7500000, 3.7735849, 3.7974684, 4.1666667, 4.1841004,
4.6025105, 5.0000000, 5.0000000, 5.0847458, 5.0847458, 5.1724138, 5.3571429,
5.4621849, 5.5084746, 5.5555556, 6.6666667, 6.6666667, 6.7226891, 6.7796610,
6.7796610, 6.8965517, 7.0175439, 8.3333333, 8.3333333, 8.3333333, 8.3333333,
8.3333333, 8.3333333, 8.3333333, 8.3333333, 10.0000000, 0.0000000, 10.0000000,
10.1694915, 10.3448276, 11.2359551, 11.6666667, 2.2807018, 12.2881356,
13.5593220, 13.7931035, 13.7931035, 16.1016949, 6.2790698, 16.4556962,
16.9491525, 17.9487179, 26.1603376, 29.3103448, 2.2033898, 32.2033898,
32.2033898, 39.9159664) -> incorrectrecallpercent
str(RE.Johnson(incorrectrecallpercent))
#> List of 8
#> $ : chr "Johnson Transformation"
#> $ function : chr "SB"
#> $ p : num 0.00058
#> $ transformed: num [1:118] -1.08 -1.08 -1.08 -1.08 -1.08 ...
#> $ f.gamma : num 2.65
#> $ f.lambda : num 112
#> $ f.epsilon : num -0.921
#> $ f.eta : num 0.778
我将把计算输出的准确性留给你
注意:CRAN上有第二个包用于执行Johnson转换:
library(jtrans)
library(nortest)
str(jtrans(incorrectrecallpercent, test="ad.test"))
## List of 10
## $ original : num [1:118] 0 0 0 0 0 0 0 0 0 0 ...
## $ transformed: num [1:118] -1.09 -1.09 -1.09 -1.09 -1.09 ...
## $ type : chr "sl"
## $ test : chr "ad.test"
## $ eta : num 0.824
## $ gamma : num -1.06
## $ lambda : num NA
## $ epsilon : num -0.967
## $ z : num 0.26
## $ p.value : num 0.000397
## - attr(*, "class")= chr [1:2] "sl" "jtrans"
同样,只有你才能知道什么是正确的结果。哇。该软件包的源代码充满了危险
我在您提供的SO链接中做了建议的更改,它确实解决了您的问题,理论上也解决了您的问题:
# install.packages("devtools")
devtools::install_github("hrbrmstr/Johnson")
library(Johnson)
c(0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000,
0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000,
0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000,
0.0000000, 0.4166667, 0.4166667, 0.4201681, 0.4201681, 0.4201681, 0.4219409,
0.4255319, 0.4255319, 0.4878049, 0.8333333, 0.8368201, 0.8403361, 0.8403361,
0.8438819, 1.2500000, 1.2500000, 1.2500000, 1.2605042, 1.2875536, 1.6666667,
1.6666667, 1.6666667, 1.6666667, 1.6666667, 1.6666667, 1.6736402, 1.6949153,
1.6949153, 1.6949153, 2.1186441, 2.1186441, 2.1186441, 2.5000000, 2.5000000,
2.5104603, 2.5210084, 2.5210084, 2.9166667, 2.9787234, 3.3333333, 3.3333333,
3.3898305, 3.3898305, 3.7500000, 3.7735849, 3.7974684, 4.1666667, 4.1841004,
4.6025105, 5.0000000, 5.0000000, 5.0847458, 5.0847458, 5.1724138, 5.3571429,
5.4621849, 5.5084746, 5.5555556, 6.6666667, 6.6666667, 6.7226891, 6.7796610,
6.7796610, 6.8965517, 7.0175439, 8.3333333, 8.3333333, 8.3333333, 8.3333333,
8.3333333, 8.3333333, 8.3333333, 8.3333333, 10.0000000, 0.0000000, 10.0000000,
10.1694915, 10.3448276, 11.2359551, 11.6666667, 2.2807018, 12.2881356,
13.5593220, 13.7931035, 13.7931035, 16.1016949, 6.2790698, 16.4556962,
16.9491525, 17.9487179, 26.1603376, 29.3103448, 2.2033898, 32.2033898,
32.2033898, 39.9159664) -> incorrectrecallpercent
str(RE.Johnson(incorrectrecallpercent))
#> List of 8
#> $ : chr "Johnson Transformation"
#> $ function : chr "SB"
#> $ p : num 0.00058
#> $ transformed: num [1:118] -1.08 -1.08 -1.08 -1.08 -1.08 ...
#> $ f.gamma : num 2.65
#> $ f.lambda : num 112
#> $ f.epsilon : num -0.921
#> $ f.eta : num 0.778
我将把计算输出的准确性留给你
注意:CRAN上有第二个包用于执行Johnson转换:
library(jtrans)
library(nortest)
str(jtrans(incorrectrecallpercent, test="ad.test"))
## List of 10
## $ original : num [1:118] 0 0 0 0 0 0 0 0 0 0 ...
## $ transformed: num [1:118] -1.09 -1.09 -1.09 -1.09 -1.09 ...
## $ type : chr "sl"
## $ test : chr "ad.test"
## $ eta : num 0.824
## $ gamma : num -1.06
## $ lambda : num NA
## $ epsilon : num -0.967
## $ z : num 0.26
## $ p.value : num 0.000397
## - attr(*, "class")= chr [1:2] "sl" "jtrans"
同样,只有你才能知道什么是正确的结果
library(jtrans)
library(nortest)
str(jtrans(incorrectrecallpercent, test="ad.test"))
## List of 10
## $ original : num [1:118] 0 0 0 0 0 0 0 0 0 0 ...
## $ transformed: num [1:118] -1.09 -1.09 -1.09 -1.09 -1.09 ...
## $ type : chr "sl"
## $ test : chr "ad.test"
## $ eta : num 0.824
## $ gamma : num -1.06
## $ lambda : num NA
## $ epsilon : num -0.967
## $ z : num 0.26
## $ p.value : num 0.000397
## - attr(*, "class")= chr [1:2] "sl" "jtrans"