簡體   English   中英

R 語言和本福德定律:程序執行中的警告

[英]R language and Benford's law: warning in program implementation

誰能幫我? 我的代碼有一些警告。 我該如何解決這些問題? 輸入是從 Matlab 中提取的簡單向量 1*196608。

警告:

1: In empirical.distribution$dist.freq - benford.dist.freq :
  longer object length is not a multiple of shorter object length

2: In ((empirical.distribution$dist.freq - benford.dist.freq)^2)/benford.dist.freq :
  longer object length is not a multiple of shorter object length

3: In empirical.distribution$dist - benford.dist :
  longer object length is not a multiple of shorter object length

4: In as.data.table.list(x, keep.rownames = keep.rownames,  ... :
  Item 1 has 9 rows but longest item has 10; recycled with remainder

我的代碼:

library(benford.analysis)
library(R.matlab)
f=readMat('vectorimage.mat')
s=f$vectorimage
y=as.numeric(s);#convert to numeric type
d=benford(y,number.of.digits = 1)
print(d)
plot(d)

根據您的數據,我認為您的負值和正值都在 y 中變化,這可能是正態分布的,因此您可以修改 benford,如下所示:

benford(y, number.of.digits = 3, sign = "both", discrete=TRUE, round=3)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM