# Chapter 5: Shape trees

## Figure 1

```pcf.setfunc<-function(pcf,level,mu=c(0,0),sf.type="radius",minval=0)
{
support<-pcf\$support
N<-pcf\$N
d<-length(N)
recnum<-prod(N)
value<-matrix(0,recnum,1)
index<-matrix(0,recnum,d)

lowsuppo<-matrix(0,d,1)
for (i in 1:d) lowsuppo[i]<-support[2*i-1]
step<-matrix(0,d,1)
for (i in 1:d) step[i]<-(support[2*i]-support[2*i-1])/N[i]

numpositive<-0
for (i in 1:recnum){
inde<-pcf\$index[i,]
point<-lowsuppo+step*inde-step/2
if (pcf\$value[i]minval){
numpositive<-numpositive+1
value[numpositive]<-valli
index[numpositive,]<-inde
}
}
value<-value[1:numpositive]
index<-index[1:numpositive,]
down<-index-1
high<-index

return(list(
value=value,index=index,
down=down,high=high,  #step=delta,
support=support,N=N))
}

N<-c(100,100)
func<-sim.data(N=N,type="fox")
lev<-0.002
bary<-c(0,0)
d<-2
minval<-func\$support[2*d-1]

pcf1<-pcf.setfunc(func,level=lev,mu=bary,sf.type=sf.type,minval=minval)

sf.type<-"height"
pcf2<-pcf.setfunc(func,level=lev,mu=bary,sf.type=sf.type,minval=minval)

pn<-40

# frame 1
dm<-draw.pcf(func,pnum=c(pn,pn),minval=minval)
contour(dm\$x,dm\$y,dm\$z,levels=c(lev),labels="",xlim=c(-4,6),ylim=c(-10,10),
xlab="",ylab="")
points(x=c(0),y=c(0),pch=20)

# frame 2
dm<-draw.pcf(pcf1,pnum=c(pn,pn),minval=minval)
persp(dm\$x,dm\$y,dm\$z,ticktype="detailed",phi=40,theta=30,
xlab="",ylab="",zlab="")

# frame 3
dm<-draw.pcf(pcf2,pnum=c(pn,pn),minval=minval)
persp(dm\$x,dm\$y,dm\$z,ticktype="detailed",phi=40,theta=30,
xlab="",ylab="",zlab="")
```

## Figure 2

```N<-c(100,100)
pcf<-sim.data(N=N,type="fox")

lev<-0.002
bary<-c(0,0)

tr\$level<-c(0,1,2,2,2,3,3)
info<-c("A","B","D","E","C","G","F")

luk<-100
dm<-draw.pcf(pcf,pnum=c(luk,luk))

# frame 1
contour(dm\$x,dm\$y,dm\$z,levels=c(lev),labels="")
points(x=c(0),y=c(0),pch=20)
text(x=c(0),y=c(2.5),labels=c("A"))

# frame 2
contour(dm\$x,dm\$y,dm\$z,levels=c(lev),labels="")
points(x=c(0),y=c(0),pch=20)
text(x=c(0),y=c(4),labels=c("B")) #,cex=1.5)

# frame 3
contour(dm\$x,dm\$y,dm\$z,levels=c(lev),labels="")
points(x=c(0),y=c(0),pch=20)
text(x=c(0),y=c(5),labels=c("C"))
text(x=c(4.7),y=c(0),labels=c("D"))
text(x=c(0),y=c(-5),labels=c("E"))

# frame 4
contour(dm\$x,dm\$y,dm\$z,levels=c(lev),labels="")
points(x=c(0),y=c(0),pch=20)
text(x=c(-1.5),y=c(8.4),labels=c("F"))
text(x=c(1.5),y=c(8.9),labels=c("G"))

# frame 5
plot(0.5,0,xlim=c(0,1),ylim=c(0,3),xaxt="n",xlab="",ylab="",pch=20,yaxt="n")
text(0.6,0.1,"A")

# frame 6
lkm<-2
tr1<-tr
tr1\$parent<-tr\$parent[1:lkm]
tr1\$level<-tr\$level[1:lkm]
tr1\$volume<-tr\$volume[1:lkm]
tr1\$center<-tr\$center[,1:lkm]
info1<-info[1:lkm]
plottree(tr1,ylim=c(0,3),pch=20,modelabel=FALSE,yaxt="n")
text(0.2,1,"B")

# frame 7
lkm<-5
tr1<-tr
tr1\$parent<-tr\$parent[1:lkm]
tr1\$level<-tr\$level[1:lkm]
tr1\$volume<-tr\$volume[1:lkm]
tr1\$center<-tr\$center[,1:lkm]
info1<-info[1:lkm]
plottree(tr1,ylim=c(0,3),modelabel=FALSE,pch=20,
xmarginright=0.05,yaxt="n")
text(0.00,2.15,"E")
text(0.34,2.15,"D")
text(0.69,2.15,"C")

# frame 8
plottree(tr,modelabel=FALSE,pch=20,
xmarginright=0.05,ylim=c(0,3.2),yaxt="n")
text(0.00,3.15,"F")
text(0.25,3.15,"G")
```

## Figure 3

```N<-c(100,100)
pcf<-sim.data(N=N,type="fox")

lev<-0.002
bary<-c(0,0)

pm<-prunemodes(td,modenum=4)

luk<-100
dm<-draw.pcf(pcf,pnum=c(luk,luk))

# frame 1
contour(dm\$x,dm\$y,dm\$z,levels=c(lev),labels="") #,lwd=2.5)
points(x=c(0),y=c(0),pch=20)
text(-2,10,"M1")
text(2,10,"M2")
text(6.6,0,"M3")
text(0,-9.0,"M4")

# frame 2
plottree(tr,ptext=0.4)

# frame 3
plottree(pm,ptext=0.4)
```

## Figure 4

```N<-c(100,100)
pcf<-sim.data(N=N,type="fox")

lev<-0.002
bary<-c(0,0)

ngrid<-100
tt11<-prunemodes(tt1,modenum=4)

luk<-100
dm<-draw.pcf(pcf,pnum=c(luk,luk))

paletti<-c("red","blue","orange",
"green","navy","darkgreen",
"orchid","aquamarine","turquoise")

# frame 1
contour(dm\$x,dm\$y,dm\$z,levels=c(lev),labels="")
points(x=c(0),y=c(0),pch=20)
text(-2,10,"M1")
text(2,10,"M2")
text(6.3,0,"M3")
text(0,-8.5,"M4")

# frame 2
plotvolu(tr,ptext=0.2,modelabel=TRUE,colo=TRUE,paletti=paletti)

# frame 3
plotvolu(tt11,ptext=0.3,modelabel=TRUE,colo=TRUE)
```

## Figure 5

```N<-c(100,100)
pcf<-sim.data(N=N,type="fox")

lev<-0.002
bary<-c(0,0)

ngrid<-100  #33
tt11<-prunemodes(tt1,modenum=4)

luk<-100
dm<-draw.pcf(pcf,pnum=c(luk,luk))

paletti<-c("red","blue","orange",
"green","navy","darkgreen",
"orchid","aquamarine","turquoise")

# frame 1
contour(dm\$x,dm\$y,dm\$z,nlevels=15)
text(-2,10,"M1")
text(2,9.5,"M2")
text(6.6,0,"M3")
text(0,-8.5,"M4")

# frame 2
plotvolu(tr,ptext=0.2,modelabel=TRUE,colo=TRUE,proba=TRUE,paletti=paletti)

# frame 3
plotvolu(tt11,ptext=0.2,modelabel=TRUE,colo=TRUE,proba=TRUE)
```

## Figure 6

```N<-c(100,100)
pcf<-sim.data(N=N,type="fox")

lev<-0.002
bary<-c(0,0)
st<-leafsfirst(pcf,lev,bary,levmet="proba")

ngrid<-100
tt.prob1<-treedisc(st,pcf,ngrid=ngrid)
tt.prob11<-prunemodes(tt.prob1,modenum=4)

luk<-100
dm<-draw.pcf(pcf,pnum=c(luk,luk))

paletti<-c("red","blue","orange",
"green","navy","darkgreen",
"orchid","aquamarine","turquoise")

# frame 1
contour(dm\$x,dm\$y,dm\$z,nlevels=15)
text(-2,10,"M1")
text(2,9.5,"M2")
text(6.6,0,"M3")
text(0,-8.5,"M4")

# frame 2
plotvolu(sd.prob,ptext=0.001,modelabel=TRUE,colo=TRUE,paletti=paletti)

# frame 3
plotvolu(tt.prob11,ptext=0.002,modelabel=TRUE,colo=TRUE)
```

## Figure 7

```N<-c(100,100)
pcf<-sim.data(N=N,type="fox")

luk<-100
dm<-draw.pcf(pcf,pnum=c(luk,luk))

lev<-0.002
bary<-c(0,0)
st<-leafsfirst(pcf,lev,bary,levmet="proba")

ngrid<-100
tt.prob1<-treedisc(st,pcf,ngrid=ngrid)
tt.prob11<-prunemodes(tt.prob1,modenum=4)

# frame 1
contour(dm\$x,dm\$y,dm\$z,levels=c(lev),labels="")
points(x=c(0),y=c(0),pch=20)  #pch=19)
text(x=c(0),y=c(5),labels=c("I"))
text(x=c(-1.5),y=c(8.4),labels=c("II"))
text(x=c(1.5),y=c(8),labels=c("III"))

# frame 2
plotvolu(sd.prob,ptext=0.001,exmavisu=c(4))
text(x=c(6),y=c(0.007),labels=c("I"))
text(x=c(12),y=c(0.015),labels=c("II"))
text(x=c(35),y=c(0.015),labels=c("III"))
```

## Figure 8

```N<-c(100,100)
pcf<-sim.data(N=N,type="fox")

lev<-0.002
bary<-c(0,0)

paletti<-c("red","blue","orange",
"green","navy","darkgreen",
"orchid","aquamarine","turquoise")

# frame 1
plotbary(tr,coordi=1,ptext=0.3,modelabel=TRUE,paletti=paletti)

# frame 2
plotbary(tr,coordi=2,ptext=0.3,modelabel=TRUE,shiftindex=2,shift=-0.7,
paletti=paletti)
```

## Figure 9

```N<-c(100,100)
pcf<-sim.data(N=N,type="fox")

lev<-0.002
bary<-c(0,0)

ngrid<-120
tt11<-prunemodes(tt1,modenum=4)

# frame 1
plotbary(tt11,coordi=1,ptext=0.5,modelabel=TRUE)

# frame 2
plotbary(tt11,coordi=2,ptext=0.5,modelabel=TRUE)
```

## Figure 10

```N<-c(100,100)
pcf<-sim.data(N=N,type="fox")

luk<-100
dm<-draw.pcf(pcf,pnum=c(luk,luk))

lev<-0.002
bary<-c(0,0)

# frame
contour(dm\$x,dm\$y,dm\$z,levels=c(lev),labels="",xlim=c(-4,15),ylim=c(-19,10))

points(x,y)

lx<-l-18
points(x,lx,pch=20)
ly<--l+14
points(ly,y,pch=20)

segments(x,y,x,lx,lty=3)
segments(x,y,ly,y,lty=3)
#0=blank, 1=solid, 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash

segments(x[1],lx[1],x[2],lx[2],col="blue")
segments(x[2],lx[2],x[3],lx[3],col="red")
segments(x[2],lx[2],x[4],lx[4],col="darkgreen")
segments(x[2],lx[2],x[5],lx[5],col="navy")
segments(x[4],lx[4],x[6],lx[6],col="orange")
segments(x[4],lx[4],x[7],lx[7],col="green")

segments(ly[1],y[1],ly[2],y[2],col="blue")
segments(ly[2],y[2],ly[3],y[3],col="red")
segments(ly[2],y[2],ly[4],y[4],col="darkgreen")
segments(ly[2],y[2],ly[5],y[5],col="navy")
segments(ly[4],y[4],ly[6],y[6],col="orange")
segments(ly[4],y[4],ly[7],y[7],col="green")
```

## Figure 11

```func<-"skewgauss"
N<-c(100,100)
support<-c(-6,2,-6,2)

mu<-c(0,0)
sig<-c(3,1)
alpha<-c(6,0)
theta<--3*pi/4

pcf<-pcf.func(func,N,support=support,mu=mu,sig=sig,alpha=alpha,theta=theta)

dp<-draw.pcf(pcf,pnum=c(60,60))

lev<-0.02

lf<-leafsfirst(pcf,lev)
ngrid<-100
lft<-treedisc(lf,pcf,ngrid=ngrid)
lft1<-prunemodes(lft,modenum=1)

# frame 1
contour(dp\$x,dp\$y,dp\$z,levels=c(lev),labels="") #nlevels=15)
points(x=lf\$refe[1],y=lf\$refe[2],col="blue",pch=22,cex=2)
text(-5.4,-5.4,"M1")

# frame 2
plotvolu(lft1,modelabel=TRUE,ptext=0.2)

# frame 3
plotbary(lft1,coordi=1,ptext=0.2,col="black",modelabel=TRUE,title=FALSE)

# frame 4
plotbary(lft1,coordi=2,ptext=0.2,col="black",modelabel=TRUE,title=FALSE)
```

## Figure 12

```func<-"skewgauss"
N<-c(100,100)
support<-c(-6,2,-6,2)

mu<-c(0,0)
sig<-c(3,1)
alpha<-c(6,0)
theta<--3*pi/4

pcf<-pcf.func(func,N,support=support,mu=mu,sig=sig,alpha=alpha,theta=theta)

dp<-draw.pcf(pcf,pnum=c(60,60))

lev<-0.02

refe<-lf\$bary
lfc<-leafsfirst(pcf,lev,refe=refe)
ngrid<-100
lftc<-treedisc(lfc,pcf,ngrid=ngrid)
lftc1<-prunemodes(lftc,modenum=2)

# frame 1
contour(dp\$x,dp\$y,dp\$z,levels=c(lev),labels="") #nlevels=15)
points(x=lf\$bary[1],y=lf\$bary[2],col="red",pch=19,cex=2)
text(-5.4,-5.4,"M1")
text(1.1,1.1,"M2")

# frame 2
plotvolu(lftc1,ptext=0.2,modelabel=TRUE,colo=TRUE)

# frame 3
plotbary(lftc1,coordi=1,ptext=0.2,modelabel=TRUE,title=FALSE)

# frame 4
plotbary(lftc1,coordi=2,ptext=0.2,modelabel=TRUE,title=FALSE)
```

## Figure 13

```func<-"skewgauss"
N<-c(100,100)
support<-c(-6,2,-6,2)

mu<-c(0,0)
sig<-c(3,1)
alpha<-c(6,0)
theta<--3*pi/4

pcf<-pcf.func(func,N,support=support,mu=mu,sig=sig,alpha=alpha,theta=theta)

dp<-draw.pcf(pcf,pnum=c(60,60))

lev<-0.02

lfd<-leafsfirst(pcf,lev,refe=refe,levmet="proba")
ngrid<-100
lftd<-treedisc(lfd,pcf,ngrid=ngrid)
lftd1<-prunemodes(lftd,modenum=2)

# frame 1
levels<-c(0.02,0.06,0.10,0.14,0.18,0.22,0.26)
contour(dp\$x,dp\$y,dp\$z,levels=levels) #nlevels=15)
points(x=lf\$bary[1],y=lf\$bary[2],col="red",pch=19,cex=2)
text(-5.4,-5.4,"M1")
text(1.1,1.1,"M2")

# frame 2
plotvolu(lftd1,ptext=0.02,modelabel=TRUE,colo=TRUE)

# frame 3
plotbary(lftd1,coordi=1,ptext=0.02,modelabel=TRUE,title=FALSE)

# frame 4
plotbary(lftd1,coordi=2,ptext=0.02,modelabel=TRUE,title=FALSE)
```

## Figure 14

```d<-2
mixnum<-1
M<-matrix(0,mixnum,d)
M[1,]<-rep(0,d)
sig<-matrix(1,mixnum,d)
p<-matrix(1,mixnum,1)
p[1]<-1

func<-"mixt"
theta<-pi/4
supr<-5
support<-rep(c(-supr,supr),d)
N<-rep(140,d)

bary<-rep(0,d)
nstep<-35

# ball
sig1<-1
sig[1,]<-rep(1,d)
sig[1,1]<-sig1
ef1<-pcf.func(func,N,M=M,sig=sig,p=p,support=support)
ef<-ef1
dp1<-draw.pcf(ef)

lev1<-0.1*max(ef\$value)
lf<-leafsfirst(ef,lev1,bary)
lft1<-treedisc(lf,ef,nstep)

# ellipsoid
sig1<-2
sig[1,]<-c(sig1,1)
ef2<-pcf.func(func,N,M=M,sig=sig,p=p,theta=theta,support=support)
ef<-ef2
dp2<-draw.pcf(ef)

lev2<-0.1*max(ef\$value)
lf<-leafsfirst(ef,lev2,bary)
lft2<-treedisc(lf,ef,nstep)

# thinnest ellipsoid
sig1<-3
sig[1,]<-c(sig1,1)
ef3<-pcf.func(func,N,M=M,sig=sig,p=p,theta=theta,support=support)
ef<-ef3
dp3<-draw.pcf(ef)

lev3<-0.1*max(ef\$value)
lf<-leafsfirst(ef,lev3,bary)
lft3<-treedisc(lf,ef,nstep)

# frame 1
dp<-dp1
contour(dp\$x,dp\$y,dp\$z,levels=lev1,drawlabels=FALSE,col="black",
xlim=c(-5,5),ylim=c(-5,5))
dp<-dp2
lty="dashed")
dp<-dp3
col="red",lty="dotted")
text(4,4,"C")
text(2.5,2.5,"B")
text(1,1,"A")

# frame 2
plotvolu(lft1,col="black",modelabel=FALSE)
text(12,1.75,"A",cex=1.5)

# frame 3
plotvolu(lft2,col="blue",modelabel=FALSE)
text(25,3.5,"B",cex=1.5)

# frame 4
plotvolu(lft3,col="red",modelabel=FALSE)
text(37,5.5,"C",cex=1.5)
```

## Figure 15

```d<-2
func<-"clayton"
# Gaussian marginals
ver<-3
support<-c(-ver,ver,-ver,ver)
sig<-c(1,1)
bary<-c(0,0)

N<-c(140,140)

# g = 1
g<-1
ef1<-pcf.func(func,N,support=support,g=g,marginal="normal",sig=sig)
dp1<-draw.pcf(ef1)

lev1<-0.1*max(ef1\$value)
lf1<-leafsfirst(ef1,lev1,bary)
nstep<-35
lft1<-treedisc(lf1,ef1,nstep)
lft11<-prunemodes(lft1,modenum=2)

# g = 2
g<-2
ef2<-pcf.func(func,N,support=support,g=g,marginal="normal",sig=sig)
dp2<-draw.pcf(ef2)

lev2<-0.1*max(ef2\$value)
lf2<-leafsfirst(ef2,lev2,bary)
nstep<-45
lft2<-treedisc(lf2,ef2,nstep)
lft22<-prunemodes(lft2,modenum=2)

# g = 4
g<-4
ef3<-pcf.func(func,N,support=support,g=g,marginal="normal",sig=sig)
dp3<-draw.pcf(ef3)

lev3<-0.1*max(ef3\$value)
lf3<-leafsfirst(ef3,lev3,bary)
nstep<-45
lft3<-treedisc(lf3,ef3,nstep)
lft33<-prunemodes(lft3,modenum=2)

# frame 1
dp<-dp1
contour(dp\$x,dp\$y,dp\$z,levels=lev1,drawlabels=FALSE,col="black")
dp<-dp2
lty="dashed")
dp<-dp3
lty="dotted")
text(1,-0.95,"A")
text(1,-0.5,"B")
text(1,-0.0,"C")

# frame 2
plotvolu(lft11,col="black",modelabel=FALSE)
text(10,2.5,"A",cex=1.5)

# frame 3
plotvolu(lft22,col="blue",modelabel=FALSE)
text(8,3,"B",cex=1.5)

# frame 4
plotvolu(lft3,col="red",modelabel=FALSE)
text(4.5,3,"C",cex=1.5)
```

## Figure 16

```d<-2
N<-c(100,100)

func<-"mixt"
mixnum<-2
M<-matrix(0,mixnum,d)
M[1,]<-c(0,0)
M[2,]<-c(0,0)
sig<-matrix(1,mixnum,d)
sig[1,1]<-0.5
sig[1,2]<-1.5
sig[2,1]<-1.5
sig[2,2]<-0.5
p<-matrix(1,mixnum,1)
p<-p/sum(p)
theta<-pi/4
support<-c(-2.5,2.5,-2.5,2.5)
et1<-pcf.func(func,N,M=M,sig=sig,p=p,theta=theta,support=support)
dm1<-draw.pcf(et1)
lev1<-0.1*max(et1\$value)

func<-"epan"
et2<-pcf.func(func,N)
dm2<-draw.pcf(et2)
lev2<-0.1*max(et2\$value)

func<-"student"
# Gaussian marginals
ver<-3
support<-c(-ver,ver,-ver,ver)
sig<-c(1,1)
df<-1
marginal<-"normal"
r<-0.3
et3<-pcf.func(func,N,support=support,df=df,sig=sig,r=r,marginal=marginal)
dm3<-draw.pcf(et3)
lev3<-0.1*max(et3\$value)

bary<-c(0,0)
nstep<-40

lev<-lev1
et<-et1
lf<-leafsfirst(et,lev,bary,type="st")
ngrid<-nstep
lft1<-treedisc(lf,et,ngrid)

lev<-lev2
et<-et2
lf<-leafsfirst(et,lev,bary,type="st")
ngrid<-nstep
lft2<-treedisc(lf,et,ngrid)

lev<-lev3
et<-et3
lf<-leafsfirst(et,lev,bary,type="st")
ngrid<-nstep
lft3<-treedisc(lf,et,ngrid)

# frame 1
dm<-dm1
contour(dm\$x,dm\$y,dm\$z,levels=lev1,drawlabels=FALSE,col="black",lty=1)
dm<-dm3
dm<-dm2
text(1.7,-1.7,"A")
text(1.4,-1.4,"B")
text(0.6,-0.6,"C")

# frame 2
plotvolu(lft1,col="black",modelabel=FALSE)
text(11,2.2,"A",cex=1.5)

# frame 3
plotvolu(lft3,col="blue",modelabel=FALSE)
text(9,2.5,"B",cex=1.5)

# frame 4
plotvolu(lft2,col="red",modelabel=FALSE)
text(3,0.9,"C",cex=1.5)
```

## Figure 17

```func<-"gumbel"
marginal<-"normal"
ver<-3
support<-c(-ver,ver,-ver,ver)
N<-c(60,60) #c(32,32)
g<-2

ef<-pcf.func(func,N,support=support,marginal=marginal,g=g)
dp<-draw.pcf(ef)

lnum<-20
st<-stseq(N,lnum,func=func,support=support,marginal=marginal,g=g)
gnum<-50
ngrid=50
vd<-shape2d(st,gnum=gnum,ngrid=ngrid)

# frame 1
contour(dp\$x,dp\$y,dp\$z,drawlabels=FALSE)

# frame 2
plotvolu2d(vd)
```

## Figure 18

```N<-c(40,40)
lnum<-25
gnum<-50
func<-"mixt"
mixnum<-2
d<-2
M<-matrix(0,mixnum,d)
M[1,]<-c(0,0)
M[2,]<-c(0,0)
sig<-matrix(1,mixnum,d)
sig[1,1]<-0.5
sig[1,2]<-1.5
sig[2,1]<-3.5
sig[2,2]<-0.5
p<-matrix(1,mixnum,1)
p<-p/sum(p)
theta<-pi/4
ver1<-8
ver2<-4.5
support<-c(-ver1,ver1,-ver2,ver2)
refe<-c(0,0)

pcf<-pcf.func(N,lnum,func=func,support=support,M=M,sig=sig,p=p)
dp<-draw.pcf(pcf)

st4<-stseq(N,lnum,func=func,support=support,M=M,sig=sig,p=p,refe=refe)
ngrid<-40
vd4<-shape2d(st4,gnum=gnum,ngrid=ngrid) #,norma=TRUE)

# frame 1
contour(dp\$x,dp\$y,dp\$z,nlevels=30)

# frame 2
plotvolu2d(vd4)
```

## Figure 19

```N<-c(50,50,50)
lnum<-30
gnum<-50
func<-"prod"
marginal<-"student"
yla<-8
ala<--yla
support<-c(ala,yla,ala,yla,ala,yla)
g<-c(1,1,1)
st5<-stseq(N,lnum,func=func,support=support,marginal=marginal,g=g)
ngrid<-50
vd5<-shape2d(st5,gnum=gnum,ngrid=ngrid)

N<-c(32,32,32)
lnum<-25
gnum<-50
func<-"gumbel"
marginal<-"normal"
ver<-3
support<-c(-ver,ver,-ver,ver,-ver,ver)
g<-2
st6<-stseq(N,lnum,func=func,support=support,marginal=marginal,g=g)
vd6<-shape2d(st6,gnum=gnum)

# frame 1
plotvolu2d(vd6)

# frame 2
plotvolu2d(vd5)
```

## Figure 20

```type<-"proba"

N<-c(120,120)  #c(140,140)
gnum<-40
func<-"gumbel"
marginal<-"normal"
ver<-3
support<-c(-ver,ver,-ver,ver)
g<-2
lnum<-28
base<-NULL
st3<-stseq(N,lnum,func=func,support=support,marginal=marginal,g=g,base=base)
ngrid<-30
vd3<-shape2d(st3,gnum=gnum,type=type,ngrid=ngrid,norma=TRUE)

N<-c(80,80)
func<-"prod"
marginal<-"student"
yla<-6
ala<--yla
support<-c(ala,yla,ala,yla)
t<-1
st2<-stseq(N,lnum,func=func,t=t,support=support,marginal=marginal,base=NULL)
gnum<-50
vd2<-shape2d(st2,gnum=gnum,type=type,norma=TRUE,modelim=4)
vd2\$x[6]<-vd2\$x[6]+0.001

# frame 1
plotvolu2d(vd3)

# frame 2
plotvolu2d(vd2)
```