1

我有一系列名为 TrueDist 和 TrueVal 的高精度测量。我还有一个更大的数据集,在标记为 Relativedist 的距离测量中具有大量不确定性,它与值测量 Relativeval 配对。

我正在寻找与 Relativedist 参数相匹配的偏移量,以便我可以直接将高精度测量值与更高体积测量值进行比较。

数据

Relativedist<-c(-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10)
Relativeval<-c(0.843,3.051,8.29,16.94,26.00,30,26.006,16.941,8.293,3.051,0.843,0.175,0.0279,0.0032,0.00028,0.00001)
TrueDist<-c(-3,1,3,5,8)
TrueVal<-c(17,29,16.8,3,0.03)

我想这样做的方式是设置一个函数

DistCorrect<-function(TrueDist,Relativedist,Relativeval,param){
(Relativeval/(Relativedist+param[1]))*TrueDist 
}

然后使用最小二乘优化器

lsfunc<-function(param,TrueVal,TrueDist,Relativedist,Relativeval){
  eta<-DistCorrect(TrueDist,Relativedist,Relativeval,param)
  sum((par - eta)^2)
}

初步猜测

startparam<-c(2)

优化器

    optval<-optim(startparam,lsfunc,NULL,method="Nelder-Mead",control=c(maxit=1000,reltol=1e-8),TrueVal,TrueDist,Relativedist,Relativeval)

print(optval)

但这似乎不起作用,我认为是由于样本不平衡。我该如何解决这个问题?

4

0 回答 0