0% found this document useful (0 votes)
20 views4 pages

Computer Lab Solutions for Statistics

This document contains solutions to selected problems and exercises from a statistics textbook. Problem 1 discusses a t-copula with an unstructured correlation matrix and 1 degree of freedom, using a sample size of 500. Problem 2 contains a plot showing the relationship between components 2 and 3, indicating a lack of independence.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

Computer Lab Solutions for Statistics

This document contains solutions to selected problems and exercises from a statistics textbook. Problem 1 discusses a t-copula with an unstructured correlation matrix and 1 degree of freedom, using a sample size of 500. Problem 2 contains a plot showing the relationship between components 2 and 3, indicating a lack of independence.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Solutions to Selected Computer Lab Problems and Exercises

in Chapter 8 of Statistics and Data Analysis for Financial


Engineering, 2nd ed. by David Ruppert and David S.
Matteson

c 2016 David Ruppert and David S. Matteson.

Problem 1. (a) The copula is a t-copula. The correlation matrix is “unstructured” meaning
that it is a arbitrary correlation matrix. In fact, the correlation matrix is
 
1 −0.6 0.75
 −0.6 1 0 
0.75 0 1

The degrees of freedom parameter is 1.


(b) The sample size is 500.

Problem 2. (a) The plot is below. Components 2 and 3 would be uniformly scattered over
the unit square if they were independent. Clearly, the scatter is not uniform,
so they do not appear independent.

0.0 0.2 0.4 0.6 0.8 1.0


●●

● ●● ● ● ●● ● ●●
●●●

●●

●●●●
● ●
●●
●●●
●●●●
●●
●● ● ● ● ● ● ● ● ● ● ●

●●

●●
●●●
●●●●●
● ●
●●●● ●● ● ● ● ● ● ●
● ●●

●●●●
●●
●●●
●●
●●
● ●

●●●●
● ●●● ●● ● ● ● ●● ● ● ●● ●

● ● ●●● ● ●
●●

0.8
●●●●●● ● ●● ● ● ●● ● ● ● ●●● ●● ●●●
●● ● ●●
● ● ● ●●●●● ● ● ●● ●
●● ●
● ●
●●

●●●●●

●●●
● ● ●●


●●
● ●●● ●● ●●● ●
● ● ● ●●● ● ● ● ● ●● ●●●



●●●
●●

●●

●●
●●●●
● ● ● ● ● ● ●
● ●● ●●●
●●●● ●● ●
● ●● ●●● ● ●●● ●
●● ● ● ●● ● ●
● ●●●
●●●●●●● ● ●
●●●●
●● ● ●●●●
●●● ●● ●● ● ● ● ●●●● ● ● ●● ●


●● ●
● ●
●●●●●● ●
●●● ●
●●● ●● ●
● ●● ● ●● ●● ●●●●●●●●●●●● ●●

● ● ●● ● ●●●● ●●● ●
●●
● ●● ● ● ●●●● ●● ● ● ● ●● ●● ●●●●●●
● ● ●●
var 1 ● ●●


● ● ●●● ●
●●
●●●●●●●●
●●●

● ●●●●
●● ● ●
● ●●
● ●
●●
●● ● ●
●●

●●
● ●

●●
● ●●
●●●●
●●


●●
●●●
●● ●


●●●
●●●

● ● ●●●● ●
● ● ●● ● ●
● ●

0.4
●●●● ● ● ● ●●● ● ● ● ●
●●● ●●●● ●
● ● ● ● ●
●●●
● ●● ●
● ●● ●●●●●● ● ● ●●● ●●●●●●

● ●●●● ●
● ●
● ●
●● ●● ● ●● ● ● ●● ●● ● ● ●
●● ●
● ● ●
●●●● ●● ●● ● ●● ●●●●●●● ●● ●●●● ● ● ● ●●●●●
●●● ●● ●● ●● ● ●
● ● ●

●● ● ●
● ● ●● ●●●●●● ● ●●●● ●● ●
● ●●
● ● ●●●● ●
●● ● ● ●●●
●● ●● ●● ●● ●
●● ●● ●

●●● ●●
●●
● ●●●●● ● ●●● ●● ●
●● ●●● ● ●●●●●●
● ●● ●●●●● ● ●●● ●
● ●

●●●●● ● ●● ● ● ●
● ● ●● ● ● ● ● ● ● ●● ● ●●
●●●


●● ●●● ● ●
●●
● ●●● ●●● ●● ● ●●

● ● ●
● ●● ● ●● ●● ● ● ●●●
● ●●●
●● ● ●● ●

● ●
● ● ●●●●



●●
● ●

● ●





●●

●●
●●●● ●●● ● ● ●
●● ●
0.0
● ●
●●
● ●●● ● ●
●● ●


●● ●
● ●
●● ●●
●●
●●●
● ● ●●● ●
● ●●
● ● ● ● ●● ● ● ●● ●

●●
●●
●●


●● ●● ●●●● ● ● ●●

●●●

●●● ● ●● ●●●● ● ● ●
●● ●

●●●● ●● ●● ● ● ● ● ●●●●●● ● ● ● ●● ●● ●● ●● ● ●
● ●●
● ● ●●●
●●● ● ●● ●● ● ● ●● ● ●●● ●●● ●●
● ● ●●● ●● ● ●
0.8

● ●● ●●●●●●
● ●●●●
● ● ● ●●● ● ● ●
● ●● ●● ●

●● ● ● ● ●
● ● ●●
●● ● ●●● ●● ●●
●● ● ● ● ● ●●
●● ●● ●● ● ●●● ●● ●●●● ● ● ● ●●●● ● ●● ●●●●●

●●
● ●●
●●● ● ●●●
● ●●●

● ● ● ●●● ●● ●● ● ● ●●● ● ●● ● ● ● ●● ●● ●●●
●● ●●● ● ●●●● ● ●● ● ●●
● ●●
● ● ● ● ● ●● ● ●● ●●
●●●●●
● ●●●●
●● ● ● ● ●● ●
● ●
●● ●●●
●●●● ● ●
●● ● ● ●●
●●● ●●●● ●●● ●
●● ● ● ● ●●● ● ●
● ● ●● ● ● ●● ●●● ● ● ●● ● ● ● ● ● ●● ●
●● ●●
●●
● ●●

● ●●●●●
● ● ●
●● ●●●●●●●

●●●

●●
● ●●
●●●●
● ●● ●
● ●●● ●● var 2 ●●
●● ●●●

●● ● ●●
●●● ●

●●
●●●●
●●


●●●●


●●
● ● ●
● ●● ●●● ● ● ●
● ●
●●●

0.4

●● ●
●● ●●● ●● ●●● ●
● ● ● ●● ●● ● ●● ●●
●●
●●● ●● ●● ●● ● ● ●●
● ●●● ● ● ●● ●● ●
●●●●● ●●● ●●●●● ●●
● ●● ● ● ●●● ●● ● ● ●● ● ●● ● ●●●● ●●
● ● ● ●●● ● ●●●●●
● ● ●●●● ● ● ●● ● ● ● ● ●● ●● ●● ● ●●● ● ●● ●●● ●
● ● ● ● ●●
● ●● ●● ● ● ●●● ●● ●●● ● ● ●
● ● ●● ●

● ● ●
● ● ● ● ●●●●
● ● ●
●●●●
●●●
●● ●●●● ●●
● ● ●● ●● ● ●●● ● ● ● ●●●●
● ● ●●
●●
● ● ● ● ●●●●● ● ●●●●●
●●●●●●● ●
●● ●
●● ● ●● ● ●● ● ● ●● ●●● ●●●●
●●● ● ● ●● ●● ●● ●●●● ●
●●●
●●●●●
●●● ●●● ●●●●● ● ● ● ● ●
● ●●● ●●●●●
● ● ● ● ● ● ●● ●●● ●●●●
● ●● ●● ● ●● ● ●
●● ● ● ● ●● ●●●
●●● ●●●●●● ●●● ● ●●●
● ● ● ● ● ●● ●●● ●
●●● ● ● ● ● ●●●
●● ● ●
0.0

●● ● ●●

● ●●●● ●
● ●●
●●● ● ●●●

● ●●



● ●


●●● ● ●● ●

● ● ● ● ●● ● ● ● ● ●
● ●● ● ● ●●

●● ●
● ●
●●





● ●●●●
●●●●●
●●●● ● ● ● ●● ● ●●●●●

● ● ● ●●
● ● ● ● ●●



●●

●●●
● ●
● ●●●●● ●● ● ●● ● ● ● ●● ●●
● ●● ●
0.8

●● ●● ●●● ●● ●
● ●
●● ● ● ● ●●
●● ● ●● ●
●●●●
●●● ●●
●●●●●

● ●
● ●●
● ●●●
●● ● ●
● ●●
●●

● ●●
● ●●● ●
●●●●●
● ●●●● ● ● ● ●● ●● ●
● ●● ●● ●● ●●
●●●
● ●●
●● ●●
●●
●●
●● ●
●●●●●●● ●●● ●● ●● ●●●
●●● ●
● ●
●●●● ●● ● ●● ● ●
● ●● ●●●
● ● ●●●● ● ●●●●●●●● ●

● ●●● ● ●● ● ●●●● ●● ●


● ● ● ● ● ●●● ●

●● ●●● ● ● ●●● ●
● ●●
● ●● ● ● ● ● ● ●●
● ●● ●● ●●●●● ●● ●●●●●● ●● ● ●● ● ● ●● ●
● ●●
●●●●● ●●● ●
●●●● ●
●●● ● ● ●● ●



● ● ● ●●●
●●


●●

●●
●●

●●

●●




●●


●●●●

●●

●● ●● ●
●●
●● ●●

●●● ● ● ●●
● ● ● ●


● ●●
● ●● ●
●● ●●
● ●● ●●●
● ●●● ●●● ●
●● ●●●



●●
●●●● ●●●●●

●●●● ●●● ●
● ●
● ● ●
●●
● ● ●● var 3
0.4

●● ●● ●● ● ● ●
● ● ●● ●● ●● ●●●●●●●●
●● ●● ● ● ●
● ●●
●● ●●●
●●●
●●●● ●● ●

● ●● ●

●●● ● ●
●●
● ●
●●●
●●
● ● ● ●
● ●
● ●● ●
●●●●●●● ●●● ● ●● ● ●●● ●
● ●● ●
●● ●
● ●●●
●●●● ●● ● ● ● ● ●●● ● ●● ●●●
●●● ● ●●● ● ●● ●
● ●● ●
●●●
●●
●●
●●●
● ●● ● ●●● ● ● ● ● ●●
●●●●●● ●● ● ● ●●● ● ●● ●● ●● ● ●●
●●●●●●● ●
●●●●● ●● ●● ●●● ● ● ● ●● ● ● ● ●● ●
● ● ●
●●●●●● ●
●● ● ● ●●● ● ●●● ● ● ● ●●●
●●● ● ● ●● ● ● ● ● ●●●

●●
●●

● ●●●
● ●
●● ●
●● ● ● ●● ● ● ● ● ● ●●●



● ●●● ● ● ● ●
● ● ● ● ●●●●


●●●
●● ●● ● ● ●● ●
●●●●● ● ● ●●●●●

●●●●● ● ● ●
● ● ●●●

0.0





●●●●● ● ●● ● ● ●


●●

0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0

(b) The non-uniformity mentioned in (a) is that there are more data in the
corners, which shows that extreme values tend to occur together, although
because of the zero correlation, a positive extreme value of one component is
equally likely to be paired with a positive or negative extreme value of the other
component.

1
(c) The effects of tail dependence is the tendency of extreme values to pair.
The negative correlation of components 1 and 2 shows in the concentration of
the data along the diagonal from upper left to lower right. Positive extreme
values in one component tend to pair with negative extreme values of ther other
component.
The positive correlation of components 2 and 3 shows in the concentration of
the data along the diagonal from lower left to upper right. Positive extreme
values in one component tend to pair with positive extreme values of ther other
component.
(d) The output is below and the confidence interval is (0.6603, 0.7484) which
does not quite include 0.75. This is not surprising. 0.75 is the correlation
between the t-distributed random variables that define the copula and need not
be the same as the uniformly-distributed variables in the copula itself.

> [Link](rand_t_cop[,1],rand_t_cop[,3])

Pearson’s product-moment correlation

data: rand_t_cop[, 1] and rand_t_cop[, 3]


t = 22, df = 500, p-value <2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.6603 0.7484
sample estimates:
cor
0.7071

Problem 4. The code and output are below. The estimate omega is 0.7018.

library(MASS) # for fitdistr() and kde2d() functions


library(copula) # for copula functions
library(fGarch) # for standardized t density
netRtns = [Link]("IBM_SP500_04_14_daily_netRtns.csv", header = T)
ibm = netRtns[,2]
sp500 = netRtns[,3]
[Link] = [Link]( fitdistr(ibm,"t")$estimate )
est.sp500 = [Link]( fitdistr(sp500,"t")$estimate )
[Link][2] = [Link][2] * sqrt( [Link][3] / ([Link][3]-2) )
est.sp500[2] = est.sp500[2] * sqrt(est.sp500[3] / (est.sp500[3]-2) )
cor_tau = cor(ibm, sp500, method = "kendall")
omega = sin((pi/2)*cor_tau)
omega

> omega
[1] 0.7018

2
Problem 5. (a) Both fits are by pseudo-likelihood. ft1 is the parametric approach because
the univariate marginal distributions are estimated by fitting t-distributions,
and ft2 is the nonparametric approach because the univariate distributions are
estimated by empirical CDFs.
(b) The two estimates of the correlation are 0.7022 and 0.7031. The two esti-
mates of the degrees of freedom are 2.98 and 3.02. Thus, the two estimates of
the copula are quite similar with no significant practical difference. Notice also
that the two estimates of the correlation are similar to the estimate, 0.7018, in
Problem 3 that used Kendall’s tau.

cop_t_dim2 = tCopula(omega, dim = 2, dispstr = "un", df = 4)


data1 = cbind(pstd(ibm, [Link][1], [Link][2], [Link][3]),
pstd(sp500, est.sp500[1], est.sp500[2], est.sp500[3]))
n = nrow(netRtns) ; n
data2 = cbind(rank(ibm)/(n+1), rank(sp500)/(n+1))
ft1 = fitCopula(cop_t_dim2, data1, method="ml", start=c(omega,4) )
ft2 = fitCopula(cop_t_dim2, data2, method="ml", start=c(omega,4) )
ft1
ft2

> ft1
fitCopula() estimation based on ’maximum likelihood’
and a sample of size 2516.
Estimate Std. Error z value Pr(>|z|)
rho.1 0.7022 0.0117 60.1 <2e-16 ***
df 2.9834 0.2693 11.1 <2e-16 ***
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
The maximized loglikelihood is 967
Optimization converged
Number of loglikelihood evaluations:
function gradient
46 9
> ft2
fitCopula() estimation based on ’maximum likelihood’
and a sample of size 2516.
Estimate Std. Error z value Pr(>|z|)
rho.1 0.7031 0.0117 60.3 <2e-16 ***
df 3.0222 0.2785 10.8 <2e-16 ***
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
The maximized loglikelihood is 965
Optimization converged
Number of loglikelihood evaluations:
function gradient
39 9

3
Exercise 1. A monotonically strictly decreasing transformation of one variable will change
concordant pairs to discordant pairs and vice versa, so it will change the sign
but not the magnitude of Kendall’s tau.
Since Y → 1/Y is monotonicity strictly decreasing, Kendall’s tau between X
and 1/Y is −0.55 and Kendall’s tau between 1/X and 1/Y is 0.55.

Exercise 10. By (8.27), Ωjk = sin(0) = 0, so the copula of (Yj , Yk ) is the copula of a bivari-
ate Gaussian distribution with correlation matrix equal to the identity matrix.
This distribution has independent components so the copula of (Yj , Yk ) is the
independence copula with density identically equal to 1, that is, cY (yj , yk ) ≡ 1.
Therefore, the components of Y are independent, because, for example, (8.4)
implies that

fY (yj , yk ) = cY {FYj (yj ), FYk (yk )}fYj (yj )fYk (yk ) = fYj (yj )fYk (yk ),

which shows that Yj and Yk are independent.

Common questions

Powered by AI

The parametric approach (ft1) involves estimating the univariate marginal distributions by fitting them to theoretical distributions like the t-distribution, while the nonparametric approach (ft2) uses empirical cumulative distribution functions (CDFs). Both approaches, however, use maximum likelihood for estimation. In practice, the parametric approach assumes a specific distribution form for the data, providing potentially more efficient estimates if the form is correct, while the nonparametric approach offers more flexibility by not making such distributional assumptions .

Tail dependence refers to the phenomenon where extreme values of two or more variables tend to occur together, even if the variables have zero or very low correlation . This can be observed as a concentration of data points in the corners of a scatter plot, indicating that the extreme high values (or low values) for one variable are possibly paired with extreme high values (or low values) of another variable, depending on the direction of correlation .

The similarity of estimates between different copula methods, such as the parametric and nonparametric approaches, suggests that the methods provide stable and consistent results under the given data conditions. Specifically, the estimates of correlation and degrees of freedom being similar indicates robustness of the model across different methodologies, suggesting reliability of the findings irrespective of the approach utilized .

A monotonically decreasing transformation reverses the order of data points, flipping the sign of correlation measures such as Pearson's and Kendall's tau, but not their magnitude. The transformation alters the directional relationship between the variables, making increasing data appear decreasing and vice versa, which affects the sign of correlation. However, since the relative positioning of points remains the same, the strength of association, reflected in the magnitude, remains unchanged .

Negative correlation is observed as a concentration of data points along the diagonal from the upper left to the lower right of a scatter plot because as one variable increases, the other variable decreases, creating an inverse relationship. Thus, the plot displays a descending line where high values of one variable align with low values of the other, and vice versa .

A strictly decreasing monotonic transformation of a variable changes concordant pairs to discordant pairs and vice versa, altering the sign of Kendall's tau while preserving its magnitude. For instance, transforming Y to 1/Y, which is strictly decreasing, will change Kendall's tau between X and Y to its negative value .

In copula models, omega represents the strength of dependence between variables, which is crucial in capturing tail dependencies, especially in financial data where simultaneous extreme movements may occur. An accurate estimate of omega helps in constructing models that reflect the true underlying dependencies between financial instruments, enabling better risk management and pricing in portfolios . The omega estimate can indicate the degree to which different assets in a portfolio might behave similarly under extreme market conditions, which is essential for devising hedging strategies.

The independence copula, associated with a correlation matrix equal to the identity matrix in a bivariate Gaussian distribution, signifies that the components of the distribution are independent. This means the joint cumulative probability can be decomposed into the product of individual cumulative probabilities. It indicates no dependency between components, which is crucial in simplifying multivariate analyses and modeling relationships where variables are assumed to operate independently .

A 95% confidence interval for correlation that does not include a specific value (such as 0.75 in this case), means that there is statistical evidence to suggest that the correlation between the variables is different from that specific value . It indicates that repeated sampling would likely produce a correlation estimate within this confidence range, and the exclusion of 0.75 implies there's a statistically significant deviation from this assumed correlation at the 5% significance level.

Kendall's tau considers the relative ordering of data pairs. Concordant pairs are those where the order of the pairs is consistent (either both pairs' values are increasing or both decreasing), while discordant pairs are those where one pair's values are increasing while the other is decreasing. Kendall's tau is defined as the difference between the number of concordant and discordant pairs normalized by the total number of pairs, serving as a measure of ordinal association between two variables .

You might also like