关于plotting confidence intervals有很多答案。
我正在阅读Lourme A. et al (2016)的论文,我想从图纸中得出90%置信边界和10%例外点,如图2所示。
library("MASS")
library(copula)
set.seed(612)
n <- 1000 # length of sample
d <- 2 # dimension
# random vector with uniform margins on (0,1)
u1 <- runif(n, min = 0, max = 1)
u2 <- runif(n, min = 0, max = 1)
u = matrix(c(u1, u2), ncol=d)
Rg <- cor(u) # d-by-d correlation matrix
Rg1 <- ginv(Rg) # inv. matrix
# round(Rg %*% Rg1, 8) # check
# the multivariate c.d.f of u is a Gaussian copula
# with parameter Rg[1,2]=0.02876654
normal.cop = normalCopula(Rg[1,2], dim=d)
fit.cop = fitCopula(normal.cop, u, method="itau") #fitting
# Rg.hat = [email protected][1]
# [1] 0.03097071
sim = rCopula(n, normal.cop) # in (0,1)
# Taking the quantile function of N1(0, 1)
y1 <- qnorm(sim[,1], mean = 0, sd = 1)
y2 <- qnorm(sim[,2], mean = 0, sd = 1)
par(mfrow=c(2,2))
plot(y1, y2, col="red"); abline(v=mean(y1), h=mean(y2))
plot(sim[,1], sim[,2], col="blue")
hist(y1); hist(y2)
参考。 Lourme,A.,F. Maurer(2016)在风险管理框架中测试Gaussian和Student's t copulas。经济建模。
问题。任何人都可以帮我解释一下变量v=(v_1,...,v_d)
和G(v_1),..., G(v_d)
的等式吗?
我认为v
是非随机矩阵,尺寸应该是d=2
(尺寸)的$ k^2 $(网格点)。例如,
axis_x <- seq(0, 1, 0.1) # 11 grid points
axis_y <- seq(0, 1, 0.1) # 11 grid points
v <- expand.grid(axis_x, axis_y)
plot(v, type = "p")
[此](http://stackoverflow.com/questions/23437000/how-to-plot-a-contour-line-showing-where-95-of-values-fall -within式-R和中)? – alistaire
@alistaire,感谢您的链接,建议的代码提供了一个解决方案,但它不适合我,因为我想绘制一个“平滑”轮廓。 – Nick
你如何从数据点定义这个“alpha”置信边界? – Spacedman