在R包“ overlap”中,我尝试使用以下代码,但出现错误“带宽估计失败”。
CBTr<-cbind(CBC$x,((CBT$y+CBF$y)/2))
overlapPlot(CBC$y, CBTr[,2], main = "Activity Pattern Overlap, Control and Treatment")
我收到以下错误:
Error in overlapPlot(CBC$y, CBTr[, 2], main = "Activity Pattern Overlap, Control and Treatment") :
Bandwidth estimation failed.
我也尝试添加以下内容:
bwTr<-getBandWidth(CBTr)
overlapPlot(CBC$y, CBTr[,2], kmax=(bwTr+1), main = "Activity Pattern Overlap, Control and Treatment")
我的数据如下(前5行和后5行):
> CBTr
[,1] [,2]
[1,] -3.00000000 0.125512800
[2,] -2.76377953 0.117998311
[3,] -2.52755906 0.110192852
[4,] -2.29133858 0.102158407
[5,] -2.05511811 0.093772665
...
[124,] 26.05511811 0.043904292
[125,] 26.29133858 0.043323683
[126,] 26.52755906 0.043770531
[127,] 26.76377953 0.045407822
[128,] 27.00000000 0.048166921
> CBC
x y
1 -3.00000000 0.069162678
2 -2.76377953 0.071108556
3 -2.52755906 0.072742039
4 -2.29133858 0.073951434
5 -2.05511811 0.074643124
...
124 26.05511811 0.050142536
125 26.29133858 0.051599146
126 26.52755906 0.053085832
127 26.76377953 0.054471614
128 27.00000000 0.055673541