Description Usage Arguments Value Author(s) References See Also Examples
View source: R/denpro.R View source: R/pcf.func.R
Calculates a piecewise constant function of a given functional form: Gaussian or a mixture of Gaussians, or functions with a given copula, ...
1 2 3 4 5 6 |
func |
a character string; the possibilities are "mixt", "normal","student","gumbel","frank","clayton", "skewgauss", "prod", "epan", "hat" |
N |
vector of d positive integers; the dimension of the grid where the function will be evaluated; we evaluate the function on a regular grid which contains the support of the function |
sig |
mixnum*d matrix of positive real numbers; the standard deviations of the marginals in a mixture of Gaussians, or the scaling factors of the student and uniform copulas |
support |
2*d vector of reals gives the d intervals of a rectangular support |
theta |
rotation angle |
g |
parameter of the Archimedean copulas |
M |
mixnum*d matrix of positive real numbers; the means of the components in a mixture of Gaussians |
p |
mixnum-vector of probabilities; mixture weights |
mul |
internal parameter |
t |
parameter of the Student marginals (degrees of freedom) |
marginal |
marginal distributions for the copulas; "normal", "student", or "unif" |
r |
0<r<1; correlation for the Gaussian and Student copulas |
mu |
parameter |
xi |
parameter |
Omega |
parameter |
alpha |
skeweness parameter for the skewed Gaussian density |
df |
degrees of freedom for the Student copula |
a, b |
parameters of the hat function |
distr |
TRUE if the distribution function is to be drawn instead of the density |
std |
standard deviation in the 1D case |
lowest |
real value; for densities equal to 0, otherwise is equal to the minimum of the function |
a piecewise constant function object, see the web page
Jussi Klemela
http://www.rni.helsinki.fi/~jsk/denpro/
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | # Elliptical copulas
N<-c(32,32) # choose the grid size
copula<-c("gauss","student")
margin<-c("normal","student","unif")
b<-4
support<-c(-b,b,-b,b)
ci<-1 # copula, ci = 1, 2
r<-0.5 # parameter of the copula
df<-2 # degrees of freedom for the Student 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
ef<-pcf.func(copula[ci],N,marginal=margin[mi],support=support,
r=r,df=df,sig=sig,t=t)
dp<-draw.pcf(ef)
contour(dp$x,dp$y,dp$z)
persp(dp$x,dp$y,dp$z,theta=30,phi=30)
# Archimedean copulas
N<-c(32,32) # choose the grid size
copula<-c("gumbel","frank","clayton")
margin<-c("normal","student","unif")
b<-4
support<-c(-b,b,-b,b)
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
ef<-pcf.func(copula[ci],N,marginal=margin[mi],support=support,
g=g,sig=sig,t=t)
dp<-draw.pcf(ef)
contour(dp$x,dp$y,dp$z)
persp(dp$x,dp$y,dp$z,theta=30,phi=30)
# mixture of Gaussians
d<-2
mixnum<-3 #we simulate a mixture of three Gaussians
M<-matrix(0,mixnum,d) #rows of M contain the means of members of the mixture
M[1,]<-c(0,0)
M[2,]<-c(4,0)
M[3,]<-c(0,4)
sig<-matrix(1,mixnum,d) #rows of sig contain the std:s ot the marginals
p0<-1/mixnum
p<-p0*rep(1,mixnum) #p is a vector of weights for the mixture members
N<-c(50,50)
pcf<-pcf.func("mixt",N,sig=sig,M=M,p=p)
dp<-draw.pcf(pcf,pnum=c(30,30))
contour(dp$x,dp$y,dp$z,drawlabels=FALSE)
persp(dp$x,dp$y,dp$z)
# skewed Gaussian
func<-"skewgauss"
N<-c(50,50)
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))
contour(dp$x,dp$y,dp$z)
persp(dp$x,dp$y,dp$z,theta=30,phi=30)
# product of univariate Student densities
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
ef<-pcf.func(func,N,t=t,support=support,marginal=marginal)
dp<-draw.pcf(ef)
contour(dp$x,dp$y,dp$z)
persp(dp$x,dp$y,dp$z,theta=30,phi=30)
# Bartlett-Epanechnikov
func<-"epan"
N<-c(50,50)
sig<-c(1,1)
ef<-pcf.func(func,N,sig)
dp<-draw.pcf(ef)
contour(dp$x,dp$y,dp$z)
persp(dp$x,dp$y,dp$z,theta=30,phi=30)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.