[R-SIG-Finance] seeking assistance in library(mbsts)
Joshua Ulrich
jo@h@m@u|r|ch @end|ng |rom gm@||@com
Mon Apr 14 16:47:14 CEST 2025
Hi,
It's hard to help you without a reproducible example. We can't run
your code because we don't have the crypto-all.csv file.
Also, please only send plain text to the list. Your html email was
converted to text by the list-server and is hard to interpret (see
your message below).
Best,
Josh
On Sun, Apr 13, 2025 at 9:16 PM Wei-han Liu via R-SIG-Finance
<r-sig-finance using r-project.org> wrote:
>
> 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]]
>
> _______________________________________________
> R-SIG-Finance using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
More information about the R-SIG-Finance
mailing list