# Chapter 10: Density classes. Code

The following code reproduces this figure. Change the parameter ``t'' to study the effect of the degrees of freedom.

```func<-"prod"
marginal<-"student"
b<-5; support<-c(-b,b,-b,b)
N<-c(32,32)                 # choose the grid size
t<-0.5                      # degrees of freedom
pcf<-pcf.func(func,N,t=t,support=support,marginal=marginal)
```

We use function "draw.pcf" to draw the function.

```dp<-draw.pcf(pcf)
contour(dp\$x,dp\$y,dp\$z)
persp(dp\$x,dp\$y,dp\$z,theta=30,phi=30)
```

We set the general parameters for the copulas.

```N<-c(32,32)  # choose the grid size
margin<-c("gauss","student","unif")
b<-4
support<-c(-b,b,-b,b)
```

The following code may be used to reproduce and modify the figures showing elliptical copulas.

```copula<-c("gauss","student")

ci<-2        # copula, ci = 1, 2
r<-0.5       # parameter of the copula
df<-2        # degrees of freedom for the Student copula

mi<-3        # margin, mi = 1, 2, 3
sig<-c(1,1)  # std:s for the margins
t<-c(2,2)    # degreeds of freedom for the student margin

pcf<-pcf.func(copula[ci],N,marginal=margin[mi],support=support,
r=r,df=df,sig=sig,t=t)
```

The following code may be used to reproduce and modify the figures showing Archimedean copulas.

```copula<-c("gumbel","frank","clayton")

ci<-1        # copula, ci = 1, 2, 3
g<-2         # parameter of the copula

mi<-1        # margin, mi = 1, 2, 3
sig<-c(1,1)  # std:s for the margins
t<-c(2,2)    # degreeds of freedom for the student margin

pcf<-pcf.func(copula[ci],N,marginal=margin[mi],support=support,
g=g,sig=sig,t=t)
```