如果这是一个基本问题,我只是R的零星用户,所以道歉。 我的问题是在嵌套在两个不同列表中的矩阵上执行矩阵运算。这些列表相互映射,我对涉及相应矩阵的操作感兴趣。在下面给出的代码中,两个列表是v1和w1。它们包含3级向下的矩阵,我想将w1中矩阵的转置乘以v1中的相应矩阵。 非常感谢!
# Simulating data from the original DCC-GARCH(1,1) process
library(ccgarch)
library(wavelets)
library(plyr)
ur <- function(nobs) {
cut <- 1000
u <- 8
a <- c(0.003, 0.005, 0.001)
A <- diag(c(0,0,0))
B <- diag(c(0.75, 0.6, 0.8))
uncR <- matrix(c(1.0, 0.4, 0.3, 0.4, 1.0, 0.12, 0.3, 0.12, 1.0),3,3)
dcc.para <- c(0.01,0.98)
# for normally distributed innovations
dcc.data <- dcc.sim(nobs, a, A, B, uncR, dcc.para, model="diagonal")
# for t distributed innovations
#dcc.data.t <- dcc.sim(nobs, a, A, B, uncR, dcc.para, d.f=nu,
#model="diagonal")
urgarch <- apply(dcc.data$eps, 2, cumsum)
}
ur <- list(replicate(5, ur(nobs = 10)),
replicate(5, ur(nobs = 15)),
replicate(5, ur(nobs = 20)),
replicate(5, ur(nobs = 25)))
names(ur) <- c("T=10", "T=15", "T=20", "T=25")
url <- lapply(ur, function(x) alply(x, 3))
# wavelet decomposition level 2
dw2 <- lapply(url, function(x)
lapply(x, function(x) modwt(x, filter="haar", n.levels=1))
# extract smooth and details for level 1
v1 <- lapply(dw2, function(x) lapply(x, function(x) dw2[[1]][1]$'1'@V))
w1 <- lapply(dw2, function(x) lapply(x, function(x) dw2[[1]][1]$'1'@W))