[英]How to sample from a Kendalls distribution function for a given copula?
1 , ..., ) from a Gauss copula with a given correlation matrix CM and with this I want to create some new variables = -1 ( ) where is the Kendalls distribution function of a Gumbel copula with parameter CorPar .我正在從具有給定相關矩陣CM的高斯 copula 創建一個樣本向量 v=( 1 , ..., ) 並且我想用這個創建一些新變量 = -1 ( ) 其中 是參數為CorPar的 Gumbel copula 的 Kendalls 分布函數。
在“工作”部分,我創建了一個相關矩陣,然后創建了我的隨機向量v 。
library(QRM)
library(copula)
library(matrixcalc)
library(Matrix)
CM <- matrix(runif(25),5,5)
CM_PSD <- nearPD(CM, corr=TRUE)$mat
v <- rcopula.gauss(1,as.matrix(CM_PSD))
CorPar <- 1.54
現在我想得到我的z但我無法運行 R 代碼。 據我從我的研究中了解到,這應該以某種方式與 copula-Package 中的函數qK一起工作。 http://artax.karlin.mff.cuni.cz/r-help/library/copula/html/K.html
qK(u, cop, d, n.MC=0, method=c("default", "simple", "sort", "discrete", "monoH.FC"), u.grid, ...)
u
是評估點,所以我的v_i
並且因為我的 copula 是一個二維 Gumbel copula 我猜d
應該設置為2
。
但我在cop部分和acopula
背后的邏輯上一直失敗。
你能幫我解決這個問題嗎?
經過多次嘗試和時間,我終於自己解決了這個問題。 我不確定它為什么起作用,但這是因為我可以使用不同的程序驗證我的結果。 :)
cop_z <- onacopulaL("Gumbel", list(CorPar,1:2))
z <- qK(v,cop_z@copula, 2)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.