mvdist-mscFit: Multivariate Skew Cauchy Parameter Estimation

Description Usage Arguments Details Examples

Description

Fitting the parameters for the Multivariate Skew Cauchy Distribution.

Usage

1
    mscFit(x, trace=FALSE, title = NULL, description = NULL)

Arguments

x

a matrix with "d" columns, giving the coordinates of the point(s) where the density must be evaluated.

trace

a logical value, should the estimation be traced? By default FALSE.

title

an optional project title.

description

an option project desctiption.

Details

This is an easy to use wrapper function using default function settings for fitting the distributional parameters in the framework of the contributed package "sn" written by Adelchi Azzalini.

Starting values for the estimation have not to be provided, they are automatically created.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## Not run: 
## Load Library:
   require(sn)
   
## mscFit - 
   # Fit Example:
   N <- 1000
   xi <- c(0, 0) 
   Omega <- diag(2); Omega[2,1] <- Omega[1,2] <- 0.5
   alpha <- c(2, -6)
   set.seed(4711)
   X <- rmsc(n=N, xi, Omega, alpha)
   ans <- mscFit(X)
   # Show fitted Parameters:
   print(ans)
   
   # 2-D Density Plot:
   plot(hexBinning(X[,1], X[, 2], bins = 30), main="Skew Cauchy")
   # Add Contours:
   N <- 101
   x <- seq(min(X[, 1]), max(X[, 1]), l=N)
   y <- seq(min(X[, 2]), max(X[, 2]), l=N)        
   u <- grid2d(x, y)$x
   v <- grid2d(x, y)$y
   XY <- cbind(u, v)
   param <- ans@fit$dp
   Z <- matrix(dmsc(XY, param[[1]][1,], param[[2]], param[[3]]), ncol=N)
   contour(x, y, Z, add=TRUE, col="green", lwd=2)
   grid(col="brown", lty=3)
   
## Cut the Tails:
   CUT <- 25
   X <- X[abs(X[, 1]) <= CUT, ] 
   X <- X[abs(X[, 2]) <= CUT, ]   
   plot(hexBinning(X[,1], X[, 2], bins = 30), main="Skew Cauchy")
   x <- y <- seq(-CUT, CUT, l=N) 
   u <- grid2d(x, y)$x
   v <- grid2d(x, y)$y
   XY <- cbind(u, v)
   param <- ans@fit$dp
   Z <- matrix(dmsc(XY, param[[1]][1,], param[[2]], param[[3]]), ncol=N)
   contour(x, y, Z, add=TRUE, col="green", lwd=2)
   grid(col="brown", lty=3)
   # Try larger cuts ...

## End(Not run)

Example output

Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics
Loading required package: sn
Loading required package: stats4

Attaching package: 'sn'

The following object is masked from 'package:fBasics':

    vech

The following object is masked from 'package:stats':

    sd


Title:
 Skew Cauchy Parameter Estimation 

Call:
 mscFit(x = X)

Model:
 Skew Cauchy Distribution

Estimated Parameter(s):
$beta
            [,1]         [,2]
[1,] -0.02944072 -0.008399548

$Omega
          [,1]      [,2]
[1,] 1.0642710 0.4999892
[2,] 0.4999892 0.9818502

$alpha
[1]  2.621132 -7.339497


Description:
 Sat Oct 20 23:46:44 2018 by user: anon 

fMultivar documentation built on March 13, 2020, 3:06 a.m.