0

谁能帮我?我的代码有一些警告。我该如何解决这些问题?输入是从 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)
4

1 回答 1

1

根据您的数据,我认为您的负值和正值都在 y 中变化,这可能是正态分布的,因此您可以修改 benford,如下所示:

benford(y, number.of.digits = 3, sign = "both", discrete=TRUE, round=3)
于 2020-08-15T15:37:03.273 回答