Re: [R] fitting t copula with fixed dof
er...@rice.edu on Wed, 16 May 2012 12:39:44 -0500 writes: I need to fit a t copula with fixed degree of freedom let's say 4. I do not want to estimate the dof together with correlation matrix optimally. Instead fix the dof to 4 and only estimate the correlation matrix in the optimization routine. Is anyone aware of such estimation method in R. The packages and functions that I know of can't do this estimation. I searched online but couldn't find anything. I will appreciate any help/comments. I searched wrongly. The copula package has been able to do that for a very long time. -- fitCopula() Martin Maechler, ETH Zurich __ R-help@r-project.org 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] fitting t copula with fixed dof
I need to fit a t copula with fixed degree of freedom let's say 4. I do not want to estimate the dof together with correlation matrix optimally. Instead fix the dof to 4 and only estimate the correlation matrix in the optimization routine. Is anyone aware of such estimation method in R. The packages and functions that I know of can't do this estimation. I searched online but couldn't find anything. I will appreciate any help/comments. Best Regards Ibrahim Ergen __ R-help@r-project.org 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] Fitting t copula
I'm a new user of R and a novice user in copula R package. I want to fit 3-dimensional t copula for my trivariate data. So I used the command t.cop - tCopula(c(0.785,0.283,0.613),dim=3,dispstr=un,df=6,df.fixed = TRUE) where c(0.785,0.283,0.613) is the correlation pattern of my data with 0.785 pearson correlation between variable 1-2, 0.283 correlation between 1-3 and 0.613 is the correlation between variable 2-3. In given command degree of freedom (dof) is fixed at 6 and i'm checking p-value of the estimate using gof copula using gofCopula(t.cop,x,500) for 500 iterations, where x is my data vector. I'm checking p-values of my each run by varying dofs from 2,3,...,6. But in every run the value of cramer von-mises is changing but p-value is keeping constant as 0.000998004, showing its a quite poor fit to data. Am i going wrong any where? pls. suggest. As Most of the literature fitting t copula shows dof in the range of generally 2-6 with significant p-values of the estimate -- View this message in context: http://r.789695.n4.nabble.com/Fitting-t-copula-tp3724588p3724588.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] fitting t copula
Hi r-users, I try to fit the t copula using the gamma marginals. But I got error message which I don't really understand. Thank you for any help given. myCop.t - ellipCopula(family = t, dim = 2, dispstr = toep, param = 0.5, df = 8) myCop.t myMvd - mvdc(copula = myCop.t, margins = c(gamma, gamma), paramMargins = list(list(mean = 0, sd = 2), list(mean = 0, sd = 1))) myMvd dat - stn_pos ## observed data loglikMvdc(c(0, 2, 0, 1, 0.5,8), dat, myMvd)  ## loglikelihood mm - apply(dat, 2, mean) vv - apply(dat, 2, var) rho - rcorr(stn_pos,type=spearman)[[1]]; round(rho,2) rbind(mm,vv) b1.0 - c(mm[1]^2/vv[1], vv[1]/mm[1]) b2.0 - c(mm[2]^2/vv[2], vv[2]/mm[2]) a.0 - sin(cor(dat[, 1], dat[, 2], method = kendall) * pi/2) start - c(b1.0, b2.0, a.0) fit - fitMvdc(dat, myMvd, start = start,optim.control = list(trace = TRUE, maxit = 2000)) fit # head(dat);tail(dat)      [,1] [,2] [1,] 28.4 43.5 [2,]  9.2  7.4 [3,] 48.8 68.9 [4,] 185.2 115.7 [5,]  4.1 11.7 [6,] 67.6 29.8        [,1] [,2] [946,]  8.8 17.2 [947,] 119.6 164.0 [948,] 68.4 163.6 [949,] 45.8 61.6 [950,] 77.0 101.0 [951,] 56.6 74.8 myCop.t - ellipCopula(family = t, dim = 2, dispstr = toep, param = 0.5, df = 8) myCop.t t copula family Dimension: 2 Parameters:   rho.1 = 0.5   df = 8 myMvd - mvdc(copula = myCop.t, margins = c(gamma, gamma), paramMargins = list(list(mean = 0, sd = 2), list(mean = 0, sd = 1))) myMvd An object of class âmvdcâ Slot copula: t copula family Dimension: 2 Parameters:   rho.1 = 0.5   df = 8 Slot margins: [1] gamma gamma Slot paramMargins: [[1]] [[1]]$mean [1] 0 [[1]]$sd [1] 2 [[2]] [[2]]$mean [1] 0 [[2]]$sd [1] 1 Slot marginsIdentical: [1] FALSE dat - stn_pos ## observed data loglikMvdc(c(0, 2, 0, 1, 0.5,8), dat, myMvd)  ## loglikelihood Error in pgamma(x, mean = 0, sd = 2) :  unused argument(s) (mean = 0, sd = 2) [1] NaN mm - apply(dat, 2, mean) vv - apply(dat, 2, var) rho - rcorr(stn_pos,type=spearman)[[1]]; round(rho,2)     [,1] [,2] [1,] 1.0 0.9 [2,] 0.9 1.0 rbind(mm,vv)         [,1]     [,2] mm  58.63912  83.7224 vv 1789.51116 3315.2367 b1.0 - c(mm[1]^2/vv[1], vv[1]/mm[1]) b2.0 - c(mm[2]^2/vv[2], vv[2]/mm[2]) a.0 - sin(cor(dat[, 1], dat[, 2], method = kendall) * pi/2) start - c(b1.0, b2.0, a.0) fit - fitMvdc(dat, myMvd, start = start,optim.control = list(trace = TRUE, maxit = 2000)) Error in fitMvdc(dat, myMvd, start = start, optim.control = list(trace = TRUE, :  The length of start and mvdc parameters do not match. [[alternative HTML version deleted]] __ R-help@r-project.org 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.