即使在AMELIA中应用边界,我也无法获得正面输入,我的结果中有一些负数并有警告:
警告讯息:
1:在min(x)中:min没有非缺失参数;返回Inf
2:在max(x)中:max没有非缺失参数;返回-Inf
我的代码是:
library(Amelia)
data <- read.table(file='Test.csv', sep=',', header=T, row.names=1)
x <- 30106
y <- 1
bds <- matrix(c(3, y, x), nrow = 1, ncol = 3)
a.out.bsd <- amelia(data, bound = bds, max.resample = 10, ords=c("distance_to_center", "stars", "city_id"))
out <- range(a.out.bsd$imputations$imp1[is.na(data[, 3]), 3])
write.amelia(obj=a.out.bsd, file.stem="Trivago", format="csv")
CSV
HOTEL_ID,city_id,点击,星星,distance_to_center
155796153,738,256,4,554
155827306,738,NA,4624个
155858459,738,349,4,434
155889612,738,NA,4,5391
155920765,772,3,3,3922
155951918,772,10,4,750
155983071,772,1,3,3133
156014224,772,0,3,5411
156045377,772,0,4,4757
156076530,772,NA,4,5087
156107683,772,2,0,3187
156138836,772,0,2,5974
156169989,772,NA,3,5256
答案 0 :(得分:0)
我找到了答案,当你没有放任何索引号列时会发生这种情况,似乎Amelia需要这个来应用边界。
hotel_id city_id clicks stars distance_to_center
1 155796153 738 256 4 554
2 155827306 738 NA 4 624
3 155858459 738 349 4 434
4 155889612 738 NA 4 5391
5 155920765 772 3 3 3922
6 155951918 772 10 4 750
7 155983071 772 1 3 3133
8 156014224 772 0 3 5411
9 156045377 772 0 4 4757