[英]R language and Benford's law: warning in program implementation
Can anyone help me?谁能帮我? My code has some warnings.
我的代码有一些警告。 How can I solve these problems?
我该如何解决这些问题? Input is a simple vector 1*196608 that is extracted from Matlab.
输入是从 Matlab 中提取的简单向量 1*196608。
warnings:警告:
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
My code:我的代码:
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)
Based by your data, I think you have negative and positive values both varying in y, which is likely normally distributed, therefore you can modify benford, like this:根据您的数据,我认为您的负值和正值都在 y 中变化,这可能是正态分布的,因此您可以修改 benford,如下所示:
benford(y, number.of.digits = 3, sign = "both", discrete=TRUE, round=3)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.