[R-SIG-Finance] seeking assistance in library(mbsts)
Wei-han Liu
we|h@n||u2002 @end|ng |rom y@hoo@com
Mon Apr 14 04:16:33 CEST 2025
Hi there:
I tried the following R lines and encountered the error message in the end:as.vector(x, mode):
cannot coerce type 'closure' to vector of type 'any'
Could any person share me some advice to solve this problem?
Thannks in advance.
Weihan
library(mbsts)
all_data <- read.csv("crypto-all.csv")all_data <- na.omit(all_data)
m<-5 #m: dimension of target seriesn<-nrow(all_data) #n: sample size
#covariance matrix of target seriescov_all<-matrix(cov(all_data[,-1]), nrow=5, ncol=5)
#Regression component#coefficients for predictorsbeta<-t(matrix(c(2,-1.5,0,4,2.5,0,0,2.5,1.5,-1,-2,0,0,-3,3.5,0.5,0.5,0.5,0.5,0.5),nrow=5,ncol=8))#predictorsX1<-rnorm(n,5,5^2)X4<-rnorm(n,-2,5)X5<-rnorm(n,-5,5^2)X8<-rnorm(n,0,100)X2<-rpois(n, 10)X6<-rpois(n, 15)X7<-rpois(n, 20)X3<-rpois(n, 5)X<-cbind(X1,X2,X3,X4,X5,X6,X7,X8)
#Simulated datadata=sim_data(X=X, beta=beta, cov, k=c(8,8,8,8,8), mu=c(1,1,1,1,1), rho=c(0.06,0.08,0.07,0.06,0.08), Dtilde=c(-0.1,0.3,0.1,0.2,0.3), Season=c(100,0,100,0,100,0), vrho=c(0,0.99,0,0.99,0), lambda=c(0,pi/100,0,pi/100,0))
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list