首页 > 解决方案 > 迭代比例拟合 (IPF) / 使用 R 倾斜

问题描述

我无法弄清楚如何使用 R 进行 IPF。

这是初始数据,“gmb_f”

F_00_04 F_05_09 F_10_14 F_15_19 F_20_24
1675    1544    1353    1610    1760
20450   19317   14790   13700   11519
52912   50398   40256   41174   37095
10491   10595   7882    7827    5792
24672   23170   20285   23088   23464
18693   18211   13701   13187   10251
8701    8860    6230    5653    4446
6508    6637    5214    5030    3537

有行约束:

(16745, 142475, 420113, 75519, 228322, 133604, 59169, 48856)

和列约束:

(200234, 169556, 144002, 121571, 101597)

我的代码是这样的:

library(ipfr)
gmb_f <- as.matrix(readxl::read_xlsx("gmb_f.xlsx", 1))
gmb_f_rowcon <- c(16745, 142475, 420113, 75519, 228322, 133604, 59169, 48856)
gmb_f_colcon <- c(200234,   169556, 144002, 121571, 101597)
m <- list(gmb_f_rowcon, gmb_f_colcon)**

ipu(gmb_f_seed, m)

我得到这个错误:

Error in targets[[name]] : 
  attempt to select less than one element in get1index

我究竟做错了什么?我怎样才能解决这个问题?

标签: restimation

解决方案


推荐阅读