[英]Use of dcopula.t with a vector in R QRM, Error in apply…dim(X) must have a positive length
如何使用帶矢量的copula密度函數dcopula.t()
?
修改文檔中的示例它得到Error in apply(Udata, 2, qt, df = df) : must have a positive length
的錯誤Error in apply(Udata, 2, qt, df = df) : must have a positive length
。 將它應用於整個矩陣的工作,盡管文檔需要一個向量。 請參閱下面的示例:
library("QRM", lib.loc="~/R/win-library/3.3")
#Modified Example from the docs
S <- equicorr(d = 6, rho = 0.7)
data <- rcopula.t(2000, df = 4, Sigma = S)
dcopula.t(data[1,], Sigma = S, df=4)
#Get error: Error in apply(Udata, 2, qt, df = df) : must have a positive length
is.vector(data[1,]) #True
#this works
dcopula.t(data, Sigma = S, df=4)
非常感謝
嘗試使用copula::dCopula()
。 你需要的只是:
Library(copula)
Dens.t<- dCopula()
包的手冊描述中提供了一些示例。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.