我正在尝试使用带有趋势线的rAmCharts创建一个散点图,该趋势线还包括适合值的上下置信区间。
以下是我的数据以及潜在的置信区间:
Data = data.frame(ax = rnorm(50), ay = rnorm(50))
Data = cbind(Data, predict(lm(Data$ay ~ Data$ax - 1), newdata = data.frame(x = Data$ax), interval = 'prediction'))
Data = Data[order(Data$ax), , drop = FALSE]
此外,上述数据的rAmCharts实现:
amChart_Plot = amXYChart() %>%
setDataProvider(dataProvider = Data, keepNA = TRUE) %>%
addGraph(xField = "ax", yField = 'ay', bullet = 'round', lineAlpha = 0, bulletAlpha = 0.8, bulletSize = 15) %>%
addGraph(xField = "ax", yField = 'fit', bullet = 'round', lineAlpha = 0.5, bulletAlpha = 0, linetSize = 45, lineColor = '#d202fc') %>%
setBalloon(cornerRadius = 12, textAlign = "left", maxWidth = 1300)
amChart_Plot@valueAxes = list(list(title = paste('X-Axis', sep = ""),
labelFunction = JS("function(value) {return value+'%';}"), position = 'bottom', titleBold = FALSE),
list(title = paste('Y-Axis', sep = ""),
labelFunction = JS("function(value) {return value+'%';}"), position = 'left', titleBold = FALSE))
amChart_Plot
如您所见,虽然我能够使用Fitted值创建一个Trendline,但是无法包含上限和下限置信区间,并且该区间内的区域可以填充。
我在网上搜索,但我遇到的所有例子只是添加趋势线。
任何指针如何在Fitted值的上限和下限置信区间内填充区域将受到高度赞赏。