[R] Fitting Data to tCopula
Hello, Has anyone successfully fit empirical data to a tCopula using the fitCopula function? If so, are there ways to pick intelligent starting values to avoid the errors such as a minor matrix not being positive definite and the initial value of 'vmmin' not being finite? I've been able to fit a normal Copula to my data, but am having diffuculty with the tCopula. Any suggestions are greatly appreciated. Thank you. Adam -- View this message in context: http://www.nabble.com/Fitting-Data-to-tCopula-tf3363801.html#a9358456 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] tCopula package question
Hello everyone, I am having issues with the R copula package. Just trying to run the example I found at this site gives me an error. When I implement this code: mycop - tCopula(param=0.5, dim=8, dispstr = ex, df =5) myfit - fitCopula(x, mycop, c(0.6,10), optim.control=list(trace=1),method=Nelder-Mead) myfit I get the following information on the search method and an error: Error in chol(x, pivot = FALSE) : the leading minor of order 2 is not positive definite myfit Error: object myfit not found Any ideas on why this is happening are appreciated. Thanks. Adam (aat) -- View this message in context: http://www.nabble.com/tCopula-package-question-tf3188503.html#a8850378 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] traverse through many columns of a matrix in a function
Hello everyone, Here is the setup. z is a 119 x 15 matrix, m_index is a 119 x 5 matrix What I am trying to do is return the results from fitCopula by sequentially binding all 15 columns of z to the first column of m_index, (cbind(z[,1],m_index[,1]),(cbind(z[,2],m_index[,1]), etc. Unfortunately, my code below only binds z[,1] and m_index[,1] and return the same result 14 times. Any ideas on how to implement my idea would be greatly appreciated. Also, why am I getting the same result 14 times, shouldn't it be 15 since there are 15 columns in z? my.cop - normalCopula(param = 0.5, dim = 2) answer - apply(z[,-1], 2, function(m_index[,1],my.cop) fitCopula(cbind(z[,-1], m_index[,1]), my.cop, start=0.3), my.cop = my.cop) Thanks for help. Adam (aat) -- View this message in context: http://www.nabble.com/traverse-through-many-columns-of-a-matrix-in-a-function-tf3152747.html#a8742152 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] for loop problem
Hello R users, A beginners question which I could not find the answer to in earler posts. My thought process: Here z is a 119 x 15 data matrix Step 1: start at column one, bind every column with column 1 Step2: use the new matrix, test, in the fitCopula package Step3: store each result in myfit, bind each result to answer Step4: return answer copula_est - function(z) { for(i in 1:length(z[1,])) { my.cop - normalCopula(param = 0.5, dim = 2) test - cbind(z[,1],z[,i]) myfit[i] - fitCopula(test,my.cop, start=0.3) } answer - cbind(myfit[i]) return(answer) } Errors received: Error: object test not found Could my syntax be incorrect, or is it a deeper faulty logic error. Thank you for your help, it is much appreciated. aat -- View this message in context: http://www.nabble.com/for-loop-problem-tf3047849.html#a8472217 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.