Closed 5k5kkkk closed 2 years ago
Hi, the message is not a problem, it just tells you that the optimization routine reached a convergence threshold.
The Frank copula thing is annoying though. The Frank copula with parameter 0 is the independence copula, but the numerical formulas for the Frank family are numerically instable around 0. We might handle this better internally at some point.
For your specific problem, there might be easy immediate fixes. First, you can just do vine_matrix <- mle$RVM
although that leaves you with the Frank-0 and there's likely a reason for your extra call to RVineMatrix()
. Second, you can do
mle$RVM$family[mle$RVM$family == 5) & (mle$RVM$par == 0)] <- 0
to replace the problematic pair-copula with independence. Let me know if that doesn't do the trick for you.
Thanks to your help, I was able to complete the file type conversion by the second method. Since only one set of the original data is Frank, I completed the replacement with the code below. But I have an data group which consists of eleven sets of data suggesting that joe's parameters are not in the specified range, I don't know if it's the same reason, and it's also unclear how to discern this set, because the number of groups fitted with joe is too much.
RVM1<-RVineCopSelect(copula_data1,familyset=c(1:6),RVM$Matrix,rotations = FALSE)
RVM2<-RVineSeqEst(copula_data1,RVM1)
mle<-RVineMLE(copula_data1,RVM1)
mle$RVM$family[which(mle$RVM$family == 5)] <- 0
vine_matrix<-RVineMatrix(mle$RVM$Matrix,family =mle$RVM$family,names=mle$RVM$names,par2 =mle$RVM$par2 )
Also I have another question. I am switching file categories to detect structural variation points and the code is as follows.
a<-0
all<-RVineLogLik(copula_data1,mle$RVM)$loglik
for(i in (100:(nrow(copula_data1)-100))){
test1<-RVineSeqEst(copula_data1[1:i,],vine_matrix,method="mle")
s<-RVineLogLik(copula_data1[1:i,],test1$RVM)$loglik
test2<-RVineSeqEst(copula_data1[(i+1):(nrow(copula_data1)),],vine_matrix,method="mle")
t<-RVineLogLik(copula_data1[(i+1):(nrow(copula_data1)),],test2$RVM)$loglik
a[i]<-2*(s+t-all)
print(c(i,a[i]))
}
plot.ts(a)
When I import the datain, it reports the following error, may you help me point it out, there are too many matrices and it's a little hard to determine which one exactly.
Error in matrix(1, dim(RVM), dim(RVM)) : non-numeric matrix extent
I made a few small fixes, if you install the latest version with
remotes::install_github("tnagler/VineCopula")
and run everything again, there should be no issues.
It is difficult for me to make a connection to github , and R reports the following error, which has not been debugged yet.
Timeout was reached: [api.github.com] Connection timed out
I would like to know if there is any other way for me to get your latest package and when I can get the new package from RCRAN
Hello, I downloaded and ran VineCopula version 2.4.4.999 from your homepage, but the fit of frank and joe copula still gives the same error as before
Did you fit the models with the new version of the software or load the previous models? In the first case, could you provide a reproducible example?
R.studio shows the package version as 2.4.4.9999. it should not be an old version. Here is the reproducible example I tried to build
dim <- 4
Matrix <- c(1,0,0,0,
4,2,0,0,
3,4,3,0,
2,3,4,4)
Matrix <- matrix(Matrix, dim, dim)
family <- c(0,0,0,0,
5,0,0,0,
2,2,0,0,
2,2,2,0)
family <- matrix(family, dim, dim)
par <- c( 0.00000000,0.0000000,0.000000,0,
-0.35193771,0.0000000,0.000000,0,
-0.06220268,0.1949584,0.000000,0,
-0.20699043,0.4600010,0.603558,0)
par <- matrix(par, dim, dim)
par2<-c(0.00000,0.00000,0.000000,0,
0.00000,0.00000,0.000000,0,
30.00000,21.28198,0.000000,0,
15.80092,12.76917,7.983461,0)
par2 <- matrix(par2, dim, dim)
names = c("V1", "V2", "V3", "V4")
RVM <- RVineMatrix(Matrix = Matrix, family = family,
par = par, par2 = par2,
names = c("V1", "V2", "V3", "V4"))
This gives
Error:
In RVineMatrix: Matrix is not a valid R-vine matrix.
If I change Matrix
to t(Matrix)
, the code runs without error. What are you getting?
I'm sorry for my low level of code. According to your instruction above, I also ran this matrix successfully, but I am encountering the error in the actual running process.
mle<-RVineMLE(copula_data1,RVM1)
vine_matrix<-RVineMatrix(mle$RVM$Matrix,family =mle$RVM$family,names=mle$RVM$names,par2 =mle$RVM$par2 )
Error:
In RVineMatrix: The parameter of the Frank copula has to be unequal to 0.
The code still reports the same error as before after installing the new package.Can I use the above modified matrix to replace the original one?
You also habe to pass mle$RVM$par
to RVineMatrix()
, otherwise all parameters are assumed to be 0.
Thank you very much.Sorry for taking you so long because of my carelessness
When I use RvineMLE(){VineCopula}, I get the following system feedback.
It reports an error when importing into rvinematrix(), showing.
In RVineMatrix: The parameter of the Frank copula has to be unequal to 0.
I'm not sure why the parameter of the Frank copula is 0 and whether it's related to the message above.Code is as follows