abline(10/100,0,col='red',lwd=1.2,lty=4)
abline(10/100,0,col='red',lwd=2,lty=4)
abline(10/100,0,col='red',lwd=2,lty=4)
abline(10/100,0,col='red',lwd=2,lty=1)
abline(10/100,0,col='red',lwd=2,lty=2)
par(mar = c(5.5, 6, 4, 2) + 0.1)
par(mgp = c(4, 1, 0))
# Create the plot
plot(merged_data$x, merged_data$true_quantile, type='l',lty= 2,col='blue' ,lwd=4,ylim=c(0,50/100),xlab=' ',cex.lab=2,cex.axis=2,cex.main=2,main = "Relative error",ylab=('95% quantile' ))
arrows(merged_data$x, merged_data$lower, merged_data$x, merged_data$upper, angle = 90, code = 3, length = 0.1,lwd=2)
points(x, asymptotic_quantile, pch = 1, col = "black", cex = 2)
# 绘制直线
lines(x, asymptotic_quantile, col = "black", lwd = 2)
legend("topright", legend = c("True quantile","asymptotic quantile"), col = c("blue","black"), lty = c(1,1), pch = c(NA_integer_,21), cex = 2)
abline(10/100,0,col='red',lwd=2,lty=2)
# Read your data
myData <- read.csv("myDatac.csv")
# Reshape your data
myDatac_long <- myData %>%
pivot_longer(cols = everything(), names_to = "x", values_to = "value")
# Convert x to numeric
myDatac_long$x <- as.numeric(gsub("X", "", myDatac_long$x))
# Calculate quantiles
quantiles <- myDatac_long %>%
group_by(x) %>%
summarise(lower = quantile(value, 0.1),
upper = quantile(value, 0.9))
# Define line data
line_data <- data.frame(
x = c(10,15,30,50,100),
true_quantile = c(0.3185,0.2554,0.1716, 0.1308,0.0925)
)
asymptotic_quantile=c(0.3263,0.2642,0.1753,0.1326,0.0923)
# Merge line data with quantiles
merged_data <- merge(line_data, quantiles, by = "x")
par(mar = c(5.5, 6, 4, 2) + 0.1)
par(mgp = c(4, 1, 0))
# Create the plot
plot(merged_data$x, merged_data$true_quantile, type='l',lty= 2,col='blue' ,lwd=4,ylim=c(0,50/100),xlab=' ',cex.lab=2,cex.axis=2,cex.main=2,main = "Relative error",ylab=('95% quantile' ))
xlab=c('n')
arrows(merged_data$x, merged_data$lower, merged_data$x, merged_data$upper, angle = 90, code = 3, length = 0.1,lwd=2)
points(x, asymptotic_quantile, pch = 1, col = "black", cex = 2)
# 绘制直线
lines(x, asymptotic_quantile, col = "black", lwd = 2)
legend("topright", legend = c("True quantile","asymptotic quantile"), col = c("blue","black"), lty = c(1,1), pch = c(NA_integer_,21), cex = 2)
abline(10/100,0,col='red',lwd=2,lty=2)
# Read your data
myData <- read.csv("myDatac.csv")
# Reshape your data
myDatac_long <- myData %>%
pivot_longer(cols = everything(), names_to = "x", values_to = "value")
# Convert x to numeric
myDatac_long$x <- as.numeric(gsub("X", "", myDatac_long$x))
# Calculate quantiles
quantiles <- myDatac_long %>%
group_by(x) %>%
summarise(lower = quantile(value, 0.1),
upper = quantile(value, 0.9))
# Define line data
line_data <- data.frame(
x = c(10,15,30,50,100),
true_quantile = c(0.3185,0.2554,0.1716, 0.1308,0.0925)
)
asymptotic_quantile=c(0.3263,0.2642,0.1753,0.1326,0.0923)
# Merge line data with quantiles
merged_data <- merge(line_data, quantiles, by = "x")
par(mar = c(5.5, 6, 4, 2) + 0.1)
par(mgp = c(4, 1, 0))
# Create the plot
plot(merged_data$x, merged_data$true_quantile, type='l',lty= 2,col='blue' ,lwd=4,ylim=c(0,50/100),xlab=' ',cex.lab=2,cex.axis=2,cex.main=2,main = "Relative error",ylab=('95% quantile' ))
xlab=c('n')
arrows(merged_data$x, merged_data$lower, merged_data$x, merged_data$upper, angle = 90, code = 3, length = 0.1,lwd=2)
points(x, asymptotic_quantile, pch = 1, col = "black", cex = 2)
# 绘制直线
lines(x, asymptotic_quantile, col = "black", lwd = 2)
legend("topright", legend = c("True quantile","asymptotic quantile"), col = c("blue","black"), lty = c(1,1), pch = c(NA_integer_,21), cex = 2)
abline(10/100,0,col='red',lwd=2,lty=2)
xlab=c('n')
title(xlab=c('n'),cex=2)
title(xlab=c('n'),cex=2)
title(xlab=c('n'),cex,lab=2)
title(xlab=c('n'),cex.lab=2)
par(mar = c(5.5, 6, 4, 2) + 0.1)
par(mgp = c(4, 1, 0))
# Create the plot
plot(merged_data$x, merged_data$true_quantile, type='l',lty= 2,col='blue' ,lwd=4,ylim=c(0,50/100),xlab=' ',cex.lab=2,cex.axis=2,cex.main=2,main = "Relative error",ylab=('95% quantile' ))
title(xlab=c('n'),cex.lab=2)
arrows(merged_data$x, merged_data$lower, merged_data$x, merged_data$upper, angle = 90, code = 3, length = 0.1,lwd=2)
points(x, asymptotic_quantile, pch = 1, col = "black", cex = 2)
# 绘制直线
lines(x, asymptotic_quantile, col = "black", lwd = 2)
legend("topright", legend = c("True quantile","asymptotic quantile"), col = c("blue","black"), lty = c(1,1), pch = c(NA_integer_,21), cex = 2)
abline(10/100,0,col='red',lwd=2,lty=2)
# 示例数据
VS2 <- c(1, 52.6554, 44.7664, 39.0564, 36.1098, 34.3851, 33.0629, 33.0304, 31.3882, 31.0684)
VS1 <- c(1, 151.1184, 128.5056, 114.5724, 102.3883, 98.3276, 88.8109, 85.9322, 77.271, 71.3831)
Vs2 <- c(1, 48.9292, 39.0802, 35.3464, 33.7445, 32.1296, 30.0783, 29.5348, 29.5252, 29.1622)
Vs1 <- c(1, 129.0605, 106.9006, 86.531, 75.9037, 70.7072, 64.1126, 61.4903, 55.231, 51.6641)
VS2_ban <- c(1, 51.9668, 42.9528, 36.3784, 32.5186, 29.6903, 28.1072, 27.5711, 24.8436, 24.3351)
VS1_ban <- c(1, 136.6737, 104.1217, 87.6141, 73.1772, 68.8562, 58.7026, 54.7636, 47.3965, 41.8396)
Vs2_ban <- c(1, 48.3305, 37.6673, 33.1092, 30.7056, 28.1692, 25.7081, 24.76494, 23.6005, 22.8641)
Vs1_ban <- c(1, 118.8581, 89.3119, 67.4921, 55.3365, 49.6512, 42.163, 38.3349, 32.9545, 29.5778)
# 计算四个曲线
curve_1 <- VS2 / VS2_ban
curve_2 <- VS1 / VS1_ban
curve_3 <- Vs2 / Vs2_ban
curve_4 <- Vs1 / Vs1_ban
# 绘制图像
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "o", ylim = c(0.2, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = "Asymptotic Variances Ratio")
lines(x, curve_2, type = "o")
lines(x, curve_3, type = "o")
lines(x, curve_4, type = "o")
# 添加直线y=1
abline(h = 1, lty = 2, col = "red")
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1", "y=1"), lty = 1, col = 1:5, pch = 1)
# 绘制图像
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "o", ylim = c(0.2, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = "Asymptotic Variances Ratio")
lines(x, curve_2, type = "o")
lines(x, curve_3, type = "o")
lines(x, curve_4, type = "o")
# 添加直线y=1
abline(h = 1, lty = 2, col = "red")
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1"), lty = 1, col = 1:5, pch = 1)
# 绘制图像
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", ylim = c(0.2, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = "Asymptotic Variances Ratio")
lines(x, curve_2, type = "l")
lines(x, curve_3, type = "l")
lines(x, curve_4, type = "l")
# 添加直线y=1
# 绘制图像
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, ylim = c(0.2, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = "Asymptotic Variances Ratio")
lines(x, curve_2, type = "l", lty = 2)
lines(x, curve_3, type = "l", lty = 1)
lines(x, curve_4, type = "l", lty = 2)
# 绘制图像
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", ylim = c(0.2, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = "Asymptotic Variances Ratio")
lines(x, curve_2, type = "l", lty = 2, col = "black")
lines(x, curve_3, type = "l", lty = 1, col = "green")
lines(x, curve_4, type = "l", lty = 2, col = "orange")
# 添加直线y=1
abline(h = 1, lty = 2, col = "red")
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1", "y=1"), lty = c(1, 2, 1, 2, 2), col = c("blue", "red", "green", "orange", "gray"))
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.2, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = list("Asymptotic Variances Ratio", font.main = 2))
lines(x, curve_2, type = "l", lty = 2, col = "red", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "gray")
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1", "y=1"), lty = c(1, 2, 1, 2, 2), col = c("blue", "red", "green", "orange", "gray"), lwd = 2, title = list("Legend", font = 2))
# 加粗x轴标签和y轴标签
par(font.lab = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.2, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = list("Asymptotic Variances Ratio", font.main = 2))
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1", "y=1"), lty = c(1, 2, 1, 2, 2), col = c("blue", "black", "green", "orange", "gray"), lwd = 2, title = list("Legend", font = 2))
# 加粗x轴标签和y轴标签
par(font.lab = 2)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.2, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = list("Asymptotic Variances Ratio", font.main = 2))
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1", "y=1"), lty = c(1, 2, 1, 2, 2), col = c("blue", "black", "green", "orange", "gray"), lwd = 2, title = list("Legend", font = 2))
# 加粗x轴标签和y轴标签
par(font.lab = 2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1", "y=1"), lty = c(1, 2, 1, 2, 2), col = c("blue", "black", "green", "orange", "gray"), lwd = 2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1", "y=1"), lty = c(1, 2, 1, 2), col = c("blue", "black", "green", "orange"), lwd = 2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1", "y=1"), lty = c(1, 2, 1, 2), col = c("blue", "black", "green", "orange"), lwd = 2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1"), lty = c(1, 2, 1, 2), col = c("blue", "black", "green", "orange"), lwd = 2)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.2, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = list("Asymptotic Variances Ratio", font.main = 2))
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1"), lty = c(1, 2, 1, 2), col = c("blue", "black", "green", "orange"), lwd = 2)
# 加粗x轴标签和y轴标签
par(font.lab = 2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1"), lty = c(1, 2, 1, 2), col = c("blue", "black", "green", "orange"),  cex = 2,lwd=4)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.5, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = list("Asymptotic Variances Ratio", font.main = 2))
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1"), lty = c(1, 2, 1, 2), col = c("blue", "black", "green", "orange"),  cex = 2,lwd=4)
# 加粗x轴标签和y轴标签
par(font.lab = 2)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = list("Asymptotic Variances Ratio", font.main = 2))
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c("S2", "S1", "s2", "s1"), lty = c(1, 2, 1, 2), col = c("blue", "black", "green", "orange"),  cex = 2,lwd=4)
# 加粗x轴标签和y轴标签
par(font.lab = 2)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = list("Asymptotic Variances Ratio", font.main = 2))
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c( "S1", "s1","S2","s2", ), lty = c(2, 2, 1, 1), col = c( "black", "orange","blue", "green"),  cex = 2,lwd=4)
# 加粗x轴标签和y轴标签
par(font.lab = 2)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = list("Asymptotic Variances Ratio", font.main = 2))
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c( "S1", "s1","S2","s2" ), lty = c(2, 2, 1, 1), col = c( "black", "orange","blue", "green"),  cex = 2,lwd=4)
# 加粗x轴标签和y轴标签
par(font.lab = 2)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = list("Asymptotic Variances Ratio", font.main = 2),cex.lab=2,cex.axis=2,cex.main=2)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ration of asymptotic variances", main = "Asymptotic Variances Ratio",cex.lab=2,cex.axis=2,cex.main=2)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ration", main = "Asymptotic Variances Ratio",cex.lab=2,cex.axis=2,cex.main=2)
par(mar = c(5.5, 6, 4, 2) + 0.1)
par(mgp = c(4, 1, 0))
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ration", main = "Asymptotic Variances Ratio",cex.lab=2,cex.axis=2,cex.main=2)
par(mar = c(5.4, 6, 4, 2) + 0.1)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ratio", main = "Asymptotic Variances Ratio",cex.lab=2,cex.axis=2,cex.main=2)
par(mar = c(5.3, 6, 4, 2) + 0.1)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ratio", main = "Asymptotic Variances Ratio",cex.lab=2,cex.axis=2,cex.main=2)
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
par(mar = c(5.3, 5, 4, 2) + 0.1)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ratio", main = "Asymptotic Variances Ratio",cex.lab=2,cex.axis=2,cex.main=2)
par(mar = c(5.3, 6.5, 4, 2) + 0.1)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ratio", main = "Asymptotic Variances Ratio",cex.lab=2,cex.axis=2,cex.main=2)
par(mar = c(5.3, 7, 4, 2) + 0.1)
x <- seq(0, 0.9, by = 0.1)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ratio", main = "Asymptotic Variances Ratio",cex.lab=2,cex.axis=2,cex.main=2)
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c( "S1", "s1","S2","s2" ), lty = c(2, 2, 1, 1), col = c( "black", "orange","blue", "green"),  cex = 2,lwd=4)
plot(x, curve_1, type = "l", lty = 1, col = "blue", lwd = 2, ylim = c(0.6, 2), xlab = "discounted factor", ylab = "ratio", main = "Ratio of asymptotic variances",cex.lab=2,cex.axis=2,cex.main=2)
lines(x, curve_2, type = "l", lty = 2, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "green", lwd = 2)
lines(x, curve_4, type = "l", lty = 2, col = "orange", lwd = 2)
# 添加直线y=1
abline(h = 1, lty = 2, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c( "S1", "s1","S2","s2" ), lty = c(2, 2, 1, 1), col = c( "black", "orange","blue", "green"),  cex = 2,lwd=4)
# 加粗x轴标签和y轴标签
par(font.lab = 2)
# 示例数据
VS2=c(1,   51.7029,42.5822,40.3961,35.1084,  34.3618, 33.5908,33.6476,32.0089, 31.8473,30.9556)
VS1=c(1,146.3786,121.8115,111.0495,103.8765, 96.7320, 88.2202,84.1219,82.1907, 80.2235,72.0908)
Vs2=c(1,51.5383, 41.9820,39.1684,32.0586,29.7495,30.2593,30.3551,28.4661 ,  28.8559,28.2068)
Vs1=c(1,127.9262,101.3905,87.0822, 76.6653,69.6382, 63.9095,61.8849, 59.1031, 57.1388, 53.5869)
VS2_ban=c(1,  50.9652,40.8863,37.7153, 31.5081,30.1934,28.8045,28.1436, 26.1562 , 25.3355,24.3470)
VS1_ban=c(1, 131.9985,98.4301,  84.4832,74.2666,66.8354,58.1979, 53.5857,51.3789 , 48.9098, 42.3179)
Vs2_ban=c(1, 50.8799,40.4839,  36.6755,28.8450,26.1629,25.8493,25.2416 , 23.1476,22.9200,22.1494)
Vs1_ban=c( 1,117.9813,84.7864, 67.5887,55.4497,48.0776, 42.0816,39.4259,36.2932 , 33.7322,30.6155)
# 计算四个曲线
curve_1 <- (VS2 - VS2_ban)/VS2
curve_2 <- (VS1 - VS1_ban)/VS1
curve_3 <- (Vs2 - Vs2_ban)/Vs2
curve_4 <- (Vs1 - Vs1_ban)/Vs1
par(mar = c(6, 7, 4, 2) + 0.1)
x <- seq(0, 1, by = 0.1)
plot(x, curve_1, type = "l", lty = 4, col = "black", lwd = 4, ylim = c(0, 0.5), xlab = "discounted factor", ylab = "ratio", main = "Ratio of asymptotic variances",cex.lab=2,cex.axis=2,cex.main=2)
lines(x, curve_2, type = "l", lty = 4, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "blue", lwd = 4)
lines(x, curve_4, type = "l", lty = 1, col = "blue", lwd = 2)
# 添加直线y=1
abline(h = 0, lty = 3, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c( "S1", "s1","S2","s2" ), lty = c(2, 1, 2, 1), col = c( "black", "blue","black", "blue"),  cex = 2,lwd=c(2,2,4,4))
# 加粗x轴标签和y轴标签
par(font.lab = 2)
# 添加图例
legend("topleft", legend = c( "S1", "s1","S2","s2" ), lty = c(4, 1, 4, 1), col = c( "black", "blue","black", "blue"),  cex = 2,lwd=c(2,2,4,4))
proposed_method=c(  0.8727, 0.9054,0.9284,0.9425,0.9450,0.9489,0.9459,0.9501)
jacknife_method=c( 0.8862,0.9160,0.9398, 0.9448,0.9516,0.9518,0.9498,0.9476)
bootstrap_method=c( 0.8742,0.9032,0.9318,0.9358,0.9478,0.9502,0.9456,0.9446)
n <- c(10, 15, 30, 50, 100, 200, 500, 1000)
par(mar=c(4.8,5.4,1.5,1.2))
plot(n, proposed_method ,type='l',lty= 2,col='black' ,lwd=4,ylim=c(0.8,1),xlab=' ',ylab=c('Coverage probability' ),cex.lab=2,cex.axis=2,cex.main=2)
lines(n, bootstrap_method,type='l',lty= 4,col='green' ,lwd=4,ylim=c(0.8,1),xlab=' ',ylab=c('Coverage probability' ),cex.lab=1,cex.axis=2)
lines(n, jacknife_method,type='l',lty= 5,col='purple' ,lwd=4,ylim=c(0.8,1),xlab=' ',ylab=c('Coverage probability' ),cex.lab=1,cex.axis=2)
abline(0.95,0,col='red',lwd=1.2,lty=2)
legend("bottomright", lty=c(2,4,5), lwd=4,col=c("black",'green','purple'),
legend=c('Proposed method','Bootstrap method','Jackknife method' ),cex=2,seg.len = 6, y.intersp = 0.75)
title(xlab=c('n'),cex.lab=2)
VS2=c(1,   51.7029,42.5822,40.3961,35.1084,  34.3618, 33.5908,33.6476,32.0089, 31.8473,30.9556)
VS1=c(1,146.3786,121.8115,111.0495,103.8765, 96.7320, 88.2202,84.1219,82.1907, 80.2235,72.0908)
Vs2=c(1,51.5383, 41.9820,39.1684,32.0586,29.7495,30.2593,30.3551,28.4661 ,  28.8559,28.2068)
Vs1=c(1,127.9262,101.3905,87.0822, 76.6653,69.6382, 63.9095,61.8849, 59.1031, 57.1388, 53.5869)
VS2_ban=c(1,  50.9652,40.8863,37.7153, 31.5081,30.1934,28.8045,28.1436, 26.1562 , 25.3355,24.3470)
VS1_ban=c(1, 131.9985,98.4301,  84.4832,74.2666,66.8354,58.1979, 53.5857,51.3789 , 48.9098, 42.3179)
Vs2_ban=c(1, 50.8799,40.4839,  36.6755,28.8450,26.1629,25.8493,25.2416 , 23.1476,22.9200,22.1494)
Vs1_ban=c( 1,117.9813,84.7864, 67.5887,55.4497,48.0776, 42.0816,39.4259,36.2932 , 33.7322,30.6155)
# 计算四个曲线
curve_1 <- (VS2 - VS2_ban)/VS2
curve_2 <- (VS1 - VS1_ban)/VS1
curve_3 <- (Vs2 - Vs2_ban)/Vs2
curve_4 <- (Vs1 - Vs1_ban)/Vs1
par(mar = c(6, 7, 4, 2) + 0.1)
x <- seq(0, 1, by = 0.1)
plot(x, curve_1, type = "l", lty = 4, col = "black", lwd = 4, ylim = c(0, 0.5), xlab = "discounted factor", ylab = "ratio",cex.lab=2,cex.axis=2,cex.main=2)
lines(x, curve_2, type = "l", lty = 4, col = "black", lwd = 2)
lines(x, curve_3, type = "l", lty = 1, col = "blue", lwd = 4)
lines(x, curve_4, type = "l", lty = 1, col = "blue", lwd = 2)
# 添加直线y=1
abline(h = 0, lty = 3, col = "red",lwd=2)
# 添加图例
legend("topleft", legend = c( "S1", "s1","S2","s2" ), lty = c(4, 1, 4, 1), col = c( "black", "blue","black", "blue"),  cex = 2,lwd=c(2,2,4,4))
# 加粗x轴标签和y轴标签
par(font.lab = 2)
# Load necessary libraries
library(dplyr)
library(tidyr)
# Read your data
myData <- read.csv("myDatac.csv")
# Reshape your data
myDatac_long <- myData %>%
pivot_longer(cols = everything(), names_to = "x", values_to = "value")
# Convert x to numeric
myDatac_long$x <- as.numeric(gsub("X", "", myDatac_long$x))
# Calculate quantiles
quantiles <- myDatac_long %>%
group_by(x) %>%
summarise(lower = quantile(value, 0.1),
upper = quantile(value, 0.9))
x = c(10,15,30,50,100)
# Define line data
line_data <- data.frame(
x = c(10,15,30,50,100),
true_quantile = c(0.3185,0.2554,0.1716, 0.1308,0.0925)
)
asymptotic_quantile=c(0.3263,0.2642,0.1753,0.1326,0.0923)
# Merge line data with quantiles
merged_data <- merge(line_data, quantiles, by = "x")
par(mar = c(5.5, 6, 4, 2) + 0.1)
par(mgp = c(4, 1, 0))
# Create the plot
plot(merged_data$x, merged_data$true_quantile, type='l',lty= 2,col='blue' ,lwd=4,ylim=c(0,50/100),xlab=' ',cex.lab=2,cex.axis=2,cex.main=2,main = "",ylab=('95% quantile' ))
title(xlab=c('n'),cex.lab=2)
arrows(merged_data$x, merged_data$lower, merged_data$x, merged_data$upper, angle = 90, code = 3, length = 0.1,lwd=2)
points(x, asymptotic_quantile, pch = 1, col = "black", cex = 2)
# 绘制直线
lines(x, asymptotic_quantile, col = "black", lwd = 2)
legend("topright", legend = c("True quantile","asymptotic quantile"), col = c("blue","black"), lty = c(2,1), pch = c(NA_integer_,21), cex = 2,lwd=4)
abline(10/100,0,col='red',lwd=2,lty=2)
edp_infuence=c(12.135,11.396,9.69,9.1236,8.6533,8.4227,8.2730)
saa_influence=c(17.584,15.144,12.273,11.059,9.9892,9.4706,9.1263)
edp_boot=c(9.0918,8.7303,8.6526,8.4996,8.3228,8.3612,8.2281)
saa_boot=c(9.3726,9.2848,9.2322,9.1392,9.0980,8.9762,8.9322)
sqrt(edp_infuence)*1.96*2/sqrt(n)
par(mar=c(4.8,5.4,1.5,1.2))
plot(n, sqrt(edp_infuence)*1.96*2/10 ,type='l',lty= 2,col='black' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste('length of CI ', ' (', ' x 10'^3, ')')),cex.lab=2,cex.axis=2,main = '',cex.main=2)
lines(n, sqrt(saa_influence)*1.96*2/10,type='l',lty= 3,col='blue' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')')),cex.lab=1.5,cex.axis=2)
lines(n,sqrt(edp_boot)*1.96*2/10 ,type='l',lty= 4,col='green' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
lines(n, sqrt(saa_boot)*1.96*2/10,type='l',lty= 5,col='purple' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
legend("topright", lty=c(2,3,4,5), lwd=4,col=c("black",'blue','green','purple'),
legend=c('EDP_asymptotic','SAA_asymptotic','EDP_bootstrap','SAA_bootstrap' ),cex=1.8,seg.len = 6, y.intersp = 0.75)
title(xlab=c('n'),cex.lab=2)
n=c(10,15,30,50,100,200,500)
S3=c(     14.8842, 17.6085 ,18.3042 ,17.7607, 17.2091 ,16.9466 )
S3bt=c(   21.0864, 19.1453 ,18.1454, 17.3796, 16.9684,   16.6217)
S3_saa_bt=c(34.1269 , 36.8635, 40.4191, 46.7785, 55.0092,  61.1413 ,68.1432)
S3_saa=c(  64.4238 , 69.1540, 69.2742, 68.2939, 74.1626,  97.2588 ,70.7368)
edp_infuence=c(12.135,11.396,9.69,9.1236,8.6533,8.4227,8.2730)
saa_influence=c(17.584,15.144,12.273,11.059,9.9892,9.4706,9.1263)
edp_boot=c(9.0918,8.7303,8.6526,8.4996,8.3228,8.3612,8.2281)
saa_boot=c(9.3726,9.2848,9.2322,9.1392,9.0980,8.9762,8.9322)
sqrt(edp_infuence)*1.96*2/sqrt(n)
par(mar=c(4.8,5.4,1.5,1.2))
plot(n, sqrt(edp_infuence)*1.96*2/10 ,type='l',lty= 2,col='black' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste('length of CI ', ' (', ' x 10'^3, ')')),cex.lab=2,cex.axis=2,main = '',cex.main=2)
lines(n, sqrt(saa_influence)*1.96*2/10,type='l',lty= 3,col='blue' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')')),cex.lab=1.5,cex.axis=2)
lines(n,sqrt(edp_boot)*1.96*2/10 ,type='l',lty= 4,col='green' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
lines(n, sqrt(saa_boot)*1.96*2/10,type='l',lty= 5,col='purple' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
legend("topright", lty=c(2,3,4,5), lwd=4,col=c("black",'blue','green','purple'),
legend=c('EDP_asymptotic','SAA_asymptotic','EDP_bootstrap','SAA_bootstrap' ),cex=1.8,seg.len = 6, y.intersp = 0.75)
title(xlab=c('n'),cex.lab=2)
par(mar=c(4.8,5.4,1.5,1.2))
plot(n, sqrt(edp_infuence)*1.96*2/10 ,type='l',lty= 2,col='black' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste('length of CI ', ' (', ' x 10'^3, ')')),cex.lab=2,cex.axis=2,main = '',cex.main=2)
lines(n, sqrt(saa_influence)*1.96*2/10,type='l',lty= 3,col='blue' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')')),cex.lab=1.5,cex.axis=2)
lines(n,sqrt(edp_boot)*1.96*2/10 ,type='l',lty= 4,col='green' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
lines(n, sqrt(saa_boot)*1.96*2/10,type='l',lty= 5,col='purple' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
legend("topright", lty=c(2,3,4,5), lwd=4,col=c("black",'blue','green','purple'),
legend=c('EDP_asymptotic','SAA_asymptotic','EDP_bootstrap','SAA_bootstrap' ),cex=1.8,seg.len = 6, y.intersp = 0.75)
title(xlab=c('n'),cex.lab=2)
par(mar=c(5,5.4,1.5,1.2))
plot(n, sqrt(edp_infuence)*1.96*2/10 ,type='l',lty= 2,col='black' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste('length of CI ', ' (', ' x 10'^3, ')')),cex.lab=2,cex.axis=2,main = '',cex.main=2)
lines(n, sqrt(saa_influence)*1.96*2/10,type='l',lty= 3,col='blue' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')')),cex.lab=1.5,cex.axis=2)
lines(n,sqrt(edp_boot)*1.96*2/10 ,type='l',lty= 4,col='green' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
lines(n, sqrt(saa_boot)*1.96*2/10,type='l',lty= 5,col='purple' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
legend("topright", lty=c(2,3,4,5), lwd=4,col=c("black",'blue','green','purple'),
legend=c('EDP_asymptotic','SAA_asymptotic','EDP_bootstrap','SAA_bootstrap' ),cex=1.8,seg.len = 6, y.intersp = 0.75)
title(xlab=c('n'),cex.lab=2)
par(mar=c(5,6,1.5,1.2))
plot(n, sqrt(edp_infuence)*1.96*2/10 ,type='l',lty= 2,col='black' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste('length of CI ', ' (', ' x 10'^3, ')')),cex.lab=2,cex.axis=2,main = '',cex.main=2)
lines(n, sqrt(saa_influence)*1.96*2/10,type='l',lty= 3,col='blue' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')')),cex.lab=1.5,cex.axis=2)
lines(n,sqrt(edp_boot)*1.96*2/10 ,type='l',lty= 4,col='green' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
lines(n, sqrt(saa_boot)*1.96*2/10,type='l',lty= 5,col='purple' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
legend("topright", lty=c(2,3,4,5), lwd=4,col=c("black",'blue','green','purple'),
legend=c('EDP_asymptotic','SAA_asymptotic','EDP_bootstrap','SAA_bootstrap' ),cex=1.8,seg.len = 6, y.intersp = 0.75)
title(xlab=c('n'),cex.lab=2)
par(mar=c(5,6.5,1.5,1.2))
plot(n, sqrt(edp_infuence)*1.96*2/10 ,type='l',lty= 2,col='black' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste('length of CI ', ' (', ' x 10'^3, ')')),cex.lab=2,cex.axis=2,main = '',cex.main=2)
lines(n, sqrt(saa_influence)*1.96*2/10,type='l',lty= 3,col='blue' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')')),cex.lab=1.5,cex.axis=2)
lines(n,sqrt(edp_boot)*1.96*2/10 ,type='l',lty= 4,col='green' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
lines(n, sqrt(saa_boot)*1.96*2/10,type='l',lty= 5,col='purple' ,lwd=4,ylim=c(1.1,1.8),xlab=' ',ylab=expression(paste(' length of CI  ', ' (', ' x 10'^3, ')'))
,cex.lab=1,cex.axis=2)
legend("topright", lty=c(2,3,4,5), lwd=4,col=c("black",'blue','green','purple'),
legend=c('EDP_asymptotic','SAA_asymptotic','EDP_bootstrap','SAA_bootstrap' ),cex=1.8,seg.len = 6, y.intersp = 0.75)
title(xlab=c('n'),cex.lab=2)
n=c(10,15,30,50,100,200,500)
cost=c( 1, 0.9937, 0.9769, 0.9637, 0.9598, 0.9534, 0.9467)
cost_saa=c(0.9262, 0.9330, 0.9406, 0.9454, 0.9460, 0.9470, 0.9422)
cost_bt=c(0.8804, 0.9067, 0.9308, 0.9341, 0.9409, 0.9468, 0.9462)
cost_saa_bt=c( 0.7890, 0.8385, 0.8928 ,0.9106, 0.9518, 0.9549 ,0.9513)
plot(n, cost ,type='l',lty= 2,col='black' ,lwd=4,ylim=c(0.7,1),xlab=' ',ylab=c('Coverage probability' ),cex.lab=2,cex.axis=2,main = '',cex.main=2)
lines(n, cost_saa,type='l',lty= 3,col='blue' ,lwd=4,ylim=c(0.7,1),xlab=' ',ylab=c('Coverage probability' ),cex.lab=1,cex.axis=2)
lines(n, cost_bt,type='l',lty= 4,col='green' ,lwd=4,ylim=c(0.7,1),xlab=' ',ylab=c('Coverage probability' ),cex.lab=1,cex.axis=2)
lines(n, cost_saa_bt,type='l',lty= 5,col='purple' ,lwd=4,ylim=c(0.7,1),xlab=' ',ylab=c('Coverage probability' ),cex.lab=1,cex.axis=2)
abline(0.95,0,col='red',lwd=1.2,lty=2)
legend("bottomright", lty=c(2,3,4,5), lwd=4,col=c("black",'blue','green','purple'),
legend=c('EDP_asymptotic','SAA_asymptotic','EDP_bootstrap','SAA_bootstrap' ),cex=2,seg.len = 6, y.intersp = 0.75)
title(xlab=c('n'),cex.lab=2)
# Load necessary libraries
library(dplyr)
library(tidyr)
# Read your data
myData <- read.csv("myDatac.csv")
# Reshape your data
myDatac_long <- myData %>%
pivot_longer(cols = everything(), names_to = "x", values_to = "value")
# Convert x to numeric
myDatac_long$x <- as.numeric(gsub("X", "", myDatac_long$x))
# Calculate quantiles
quantiles <- myDatac_long %>%
group_by(x) %>%
summarise(lower = quantile(value, 0.1),
upper = quantile(value, 0.9))
x = c(10,15,30,50,100)
# Define line data
line_data <- data.frame(
x = c(10,15,30,50,100),
true_quantile = c(0.3185,0.2554,0.1716, 0.1308,0.0925)
)
asymptotic_quantile=c(0.3263,0.2642,0.1753,0.1326,0.0923)
# Merge line data with quantiles
merged_data <- merge(line_data, quantiles, by = "x")
par(mar = c(5.5, 6, 4, 2) + 0.1)
par(mgp = c(4, 1, 0))
# Create the plot
plot(merged_data$x, merged_data$true_quantile, type='l',lty= 2,col='blue' ,lwd=4,ylim=c(0,50/100),xlab=' ',cex.lab=2,cex.axis=2,cex.main=2,main = "",ylab=('95% quantile' ))
title(xlab=c('n'),cex.lab=2)
arrows(merged_data$x, merged_data$lower, merged_data$x, merged_data$upper, angle = 90, code = 3, length = 0.1,lwd=2)
points(x, asymptotic_quantile, pch = 1, col = "black", cex = 2)
# 绘制直线
lines(x, asymptotic_quantile, col = "black", lwd = 2)
legend("topright", legend = c("True quantile","asymptotic quantile"), col = c("blue","black"), lty = c(2,1), pch = c(NA_integer_,21), cex = 2,lwd=4)
abline(10/100,0,col='red',lwd=2,lty=3)
