fit.Archcopula2d {QRMlib} | R Documentation |
fits two-dimensional Archimedean copula by maximum likelihood
fit.Archcopula2d(data, name)
data |
matrix of copula data with two columns taking values in unit interval |
name |
name of Archimedean copula: "clayton", "gumbel" |
see pages 234-236 of QRM
list containing parameter estimate, standard error, value of log-likelihood at maximum and convergence flag
data(ftse100); data(smi); TS1 <- cut(ftse100, "1990-11-08", "2004-03-25"); TS1Augment <- alignDailySeries(TS1, method="before"); TS2Augment <- alignDailySeries(smi, method="before"); INDEXES.RAW <- merge(TS1Augment,TS2Augment); #Cleanup: rm(TS1, TS1Augment, TS2Augment); INDEXES <- mk.returns(INDEXES.RAW); PARTIALINDEXES <- cut(INDEXES, "1993-12-31", "2003-12-31"); #Now create a data matrix from the just-created timeSeries data <- seriesData(PARTIALINDEXES); #Keep only the data items which are non-zero for both smi and ftse100 data <- data[data[,1]!=0 & data[,2] !=0,]; # Construct pseudo copula data. The 2nd parameter is MARGIN=2 #when applying to columns and 1 applied to rows. Hence this says to #apply the 'edf()' empirical distribtion function() to the columns #of the data. Udata <- apply(data,2,edf,adjust=1); #Fit 2-dimensional Archimedian copula: choices are gumbel or clayton #using pseudo data generated via edf() from observed data: mod.gumbel <- fit.Archcopula2d(Udata,"gumbel"); ## Not run: mod.clayton <- fit.Archcopula2d(Udata,"clayton"); ## End(Not run)