Title: | Computation of Rayleigh Densities of Arbitrary Dimension |
---|---|
Description: | We offer an implementation of the series representation put forth in "A series representation for multidimensional Rayleigh distributions" by Wiegand and Nadarajah <DOI: 10.1002/dac.3510>. Furthermore we have implemented an integration approach proposed by Beaulieu et al. for 3 and 4-dimensional Rayleigh densities (Beaulieu, Zhang, "New simplest exact forms for the 3D and 4D multivariate Rayleigh PDFs with applications to antenna array geometrics", <DOI: 10.1109/TCOMM.2017.2709307>). |
Authors: | Martin Wiegand |
Maintainer: | Martin Wiegand <[email protected]> |
License: | GPL-2 |
Version: | 1.0 |
Built: | 2024-12-07 06:27:23 UTC |
Source: | CRAN |
The alpha matrix is a necessary intermediate step in the series expansion approach. It lists the different parameter combinations necessary for the series expansion.
alphamatrix(n)
alphamatrix(n)
n |
Distribution dimension. |
Returns a n-1
dimensional matrix that contains the permutations of
all indeces.
alphamatrix(3)
alphamatrix(3)
Auxilliary function, that evaluates coefficents for elements of the indices matrix.
btcol(col)
btcol(col)
col |
Variables t,a and j to be combined |
Coefficients need to be computed for the entire permutation matrix of indices,
this is the columnwise evaluation based on t
,a
and j
.
Auxilliary function. Based on the results of the btcol
the row wise results are computed.
btprod(t,a,Jstar)
btprod(t,a,Jstar)
t |
Index number. |
a |
The respective Alpha matrix value. |
Jstar |
Matrix of the j-star indeces of the series expansion. |
Returns the row-wise multiplication of the coefficients based on the indeces j
.
A three dimensional Rayleigh density by integration.
drayl_int3D(r,omega,sigma,cor,method)
drayl_int3D(r,omega,sigma,cor,method)
r |
Evaluation point. |
omega |
Omega construct necessary for the Integration method. |
sigma |
Variances of the signals. |
cor |
Correlation structure. |
method |
Integration methods, either "Kronrod","Clenshaw","Simpson","Romberg","TOMS614" or "mixed". |
Evaluates the 3D Rayleigh density at the point r
, for the values
omega
,sigma
and cor
as specified by Bealieu's method.
# Matrix K3 = matrix(0,nrow = 6,ncol = 6) sigma3 = sqrt(c(0.5,1,1.5)) diag(K3) = c(0.5,0.5,1,1,1.5,1.5) # rho_12 rho_13 rho_23 rho3<-c(0.9,0.8,0.7) K3[1,3]=K3[3,1]=K3[2,4]=K3[4,2]=sigma3[1]*sigma3[2]*rho3[1] K3[1,5]=K3[5,1]=K3[2,6]=K3[6,2]=sigma3[1]*sigma3[3]*rho3[2] K3[3,5]=K3[5,3]=K3[4,6]=K3[6,4]=sigma3[2]*sigma3[3]*rho3[3] cor3 = rho3 mat<-diag(3) mat[1,2]=mat[2,1]=cor3[1] mat[1,3]=mat[3,1]=cor3[2] mat[2,3]=mat[3,2]=cor3[3] omega3=mat drayl_int3D(c(1,1,1),omega = omega3,sigma = sigma3,cor = cor3, method = "Romberg")
# Matrix K3 = matrix(0,nrow = 6,ncol = 6) sigma3 = sqrt(c(0.5,1,1.5)) diag(K3) = c(0.5,0.5,1,1,1.5,1.5) # rho_12 rho_13 rho_23 rho3<-c(0.9,0.8,0.7) K3[1,3]=K3[3,1]=K3[2,4]=K3[4,2]=sigma3[1]*sigma3[2]*rho3[1] K3[1,5]=K3[5,1]=K3[2,6]=K3[6,2]=sigma3[1]*sigma3[3]*rho3[2] K3[3,5]=K3[5,3]=K3[4,6]=K3[6,4]=sigma3[2]*sigma3[3]*rho3[3] cor3 = rho3 mat<-diag(3) mat[1,2]=mat[2,1]=cor3[1] mat[1,3]=mat[3,1]=cor3[2] mat[2,3]=mat[3,2]=cor3[3] omega3=mat drayl_int3D(c(1,1,1),omega = omega3,sigma = sigma3,cor = cor3, method = "Romberg")
A four dimensional Rayleigh density by integration.
drayl_int4D(r,omega,sigma,cor,method)
drayl_int4D(r,omega,sigma,cor,method)
r |
Evaluation point. |
omega |
Omega construct necessary for the Integration method. |
sigma |
Variances of the signals. |
cor |
Correlation structure. |
method |
Integration methods, either "Romberg","Cubature" or "Quadrature". |
Evaluates the 4D Rayleigh density at the point r
, for the values
omega
,sigma
and cor
as specified by Bealieu's method.
library("RConics") K4 = matrix(0,nrow = 8,ncol = 8) sigma4 = sqrt(c(0.5,1,1.5,1)) rho4<-c(0.7,0.75,0.8,0.7,0.75,0.7) K4[1,1]=K4[2,2]=sigma4[1]^2 K4[3,3]=K4[4,4]=sigma4[2]^2 K4[5,5]=K4[6,6]=sigma4[3]^2 K4[7,7]=K4[8,8]=sigma4[4]^2 K4[1,3]=K4[3,1]=K4[2,4]=K4[4,2]=sigma4[1]*sigma4[2]*rho4[1] K4[1,5]=K4[5,1]=K4[2,6]=K4[6,2]=sigma4[1]*sigma4[3]*rho4[2] K4[1,7]=K4[7,1]=K4[2,8]=K4[8,2]=sigma4[1]*sigma4[4]*rho4[3] K4[3,5]=K4[5,3]=K4[4,6]=K4[6,4]=sigma4[2]*sigma4[3]*rho4[4] K4[3,7]=K4[7,3]=K4[4,8]=K4[8,4]=sigma4[2]*sigma4[4]*rho4[5] K4[5,7]=K4[7,5]=K4[8,6]=K4[6,8]=sigma4[3]*sigma4[4]*rho4[6] sigma4 = c(sqrt(c(K4[1,1],K4[3,3],K4[5,5],K4[7,7]))) cor4 = c(K4[1,3]/(sigma4[1]*sigma4[2]), K4[1,5]/(sigma4[1]*sigma4[3]), K4[1,7]/(sigma4[1]*sigma4[4]), K4[3,5]/(sigma4[2]*sigma4[3]), K4[3,7]/(sigma4[2]*sigma4[4]), K4[5,7]/(sigma4[3]*sigma4[4])) omega4=omega4<-matrix(data = c(1,cor4[1],cor4[2],cor4[3],cor4[1],1,cor4[4], cor4[5],cor4[2],cor4[4],1,cor4[6],cor4[3],cor4[5],cor4[6],1),nrow = 4) drayl_int4D(c(1,1,1,1),omega = omega4,sigma = sigma4,cor = cor4, method = "Cubature")
library("RConics") K4 = matrix(0,nrow = 8,ncol = 8) sigma4 = sqrt(c(0.5,1,1.5,1)) rho4<-c(0.7,0.75,0.8,0.7,0.75,0.7) K4[1,1]=K4[2,2]=sigma4[1]^2 K4[3,3]=K4[4,4]=sigma4[2]^2 K4[5,5]=K4[6,6]=sigma4[3]^2 K4[7,7]=K4[8,8]=sigma4[4]^2 K4[1,3]=K4[3,1]=K4[2,4]=K4[4,2]=sigma4[1]*sigma4[2]*rho4[1] K4[1,5]=K4[5,1]=K4[2,6]=K4[6,2]=sigma4[1]*sigma4[3]*rho4[2] K4[1,7]=K4[7,1]=K4[2,8]=K4[8,2]=sigma4[1]*sigma4[4]*rho4[3] K4[3,5]=K4[5,3]=K4[4,6]=K4[6,4]=sigma4[2]*sigma4[3]*rho4[4] K4[3,7]=K4[7,3]=K4[4,8]=K4[8,4]=sigma4[2]*sigma4[4]*rho4[5] K4[5,7]=K4[7,5]=K4[8,6]=K4[6,8]=sigma4[3]*sigma4[4]*rho4[6] sigma4 = c(sqrt(c(K4[1,1],K4[3,3],K4[5,5],K4[7,7]))) cor4 = c(K4[1,3]/(sigma4[1]*sigma4[2]), K4[1,5]/(sigma4[1]*sigma4[3]), K4[1,7]/(sigma4[1]*sigma4[4]), K4[3,5]/(sigma4[2]*sigma4[3]), K4[3,7]/(sigma4[2]*sigma4[4]), K4[5,7]/(sigma4[3]*sigma4[4])) omega4=omega4<-matrix(data = c(1,cor4[1],cor4[2],cor4[3],cor4[1],1,cor4[4], cor4[5],cor4[2],cor4[4],1,cor4[6],cor4[3],cor4[5],cor4[6],1),nrow = 4) drayl_int4D(c(1,1,1,1),omega = omega4,sigma = sigma4,cor = cor4, method = "Cubature")
Returns a 3D Rayleigh density for arbitrary covariance values. The resulting function can then be evaluated at arbitrary points.
drayl3D(dK,Ccomp,lim)
drayl3D(dK,Ccomp,lim)
dK |
Determinant of the covariance matrix. |
Ccomp |
"Compressed" cofactor matrix, leaving out zero value entries. |
lim |
Number of series terms. |
The 3D Rayleigh density for the compressed cofactor matrix Ccomp
of the covariance matrix.
The function can then be evaluated for 3-dimensional vectors r
.
library("RConics") # Matrix K3 = matrix(0,nrow = 6,ncol = 6) sigma3 = sqrt(c(0.5,1,1.5)) diag(K3) = c(0.5,0.5,1,1,1.5,1.5) # rho_12 rho_13 rho_23 rho3<-c(0.9,0.8,0.7) K3[1,3]=K3[3,1]=K3[2,4]=K3[4,2]=sigma3[1]*sigma3[2]*rho3[1] K3[1,5]=K3[5,1]=K3[2,6]=K3[6,2]=sigma3[1]*sigma3[3]*rho3[2] K3[3,5]=K3[5,3]=K3[4,6]=K3[6,4]=sigma3[2]*sigma3[3]*rho3[3] C3=adjoint(K3) n = nrow(K3)/2 Ccomp3<-C3[seq(1,(2*n-1),2),][,seq(1,(2*n-1),2)] dK3<-det(K3) pdf3D<-drayl3D(dK = dK3, Ccomp = Ccomp3, lim = 3) pdf3D(rep(1,3))
library("RConics") # Matrix K3 = matrix(0,nrow = 6,ncol = 6) sigma3 = sqrt(c(0.5,1,1.5)) diag(K3) = c(0.5,0.5,1,1,1.5,1.5) # rho_12 rho_13 rho_23 rho3<-c(0.9,0.8,0.7) K3[1,3]=K3[3,1]=K3[2,4]=K3[4,2]=sigma3[1]*sigma3[2]*rho3[1] K3[1,5]=K3[5,1]=K3[2,6]=K3[6,2]=sigma3[1]*sigma3[3]*rho3[2] K3[3,5]=K3[5,3]=K3[4,6]=K3[6,4]=sigma3[2]*sigma3[3]*rho3[3] C3=adjoint(K3) n = nrow(K3)/2 Ccomp3<-C3[seq(1,(2*n-1),2),][,seq(1,(2*n-1),2)] dK3<-det(K3) pdf3D<-drayl3D(dK = dK3, Ccomp = Ccomp3, lim = 3) pdf3D(rep(1,3))
Returns a 4D Rayleigh density for arbitrary covariance values. The resulting function can then be evaluated at arbitrary points.
drayl4D(dK,Ccomp,lim)
drayl4D(dK,Ccomp,lim)
dK |
Determinant of the covariance matrix. |
Ccomp |
"Compressed" cofactor matrix, leaving out zero value entries. |
lim |
Number of series terms. |
The 4D Rayleigh density for the compressed cofactor matrix Ccomp
of the covariance matrix.
The function can then be evaluated for 4-dimensional vectors r
.
library("RConics") K4 = matrix(0,nrow = 8,ncol = 8) sigma4 = sqrt(c(0.5,1,1.5,1)) rho4<-c(0.7,0.75,0.8,0.7,0.75,0.7) K4[1,1]=K4[2,2]=sigma4[1]^2 K4[3,3]=K4[4,4]=sigma4[2]^2 K4[5,5]=K4[6,6]=sigma4[3]^2 K4[7,7]=K4[8,8]=sigma4[4]^2 K4[1,3]=K4[3,1]=K4[2,4]=K4[4,2]=sigma4[1]*sigma4[2]*rho4[1] K4[1,5]=K4[5,1]=K4[2,6]=K4[6,2]=sigma4[1]*sigma4[3]*rho4[2] K4[1,7]=K4[7,1]=K4[2,8]=K4[8,2]=sigma4[1]*sigma4[4]*rho4[3] K4[3,5]=K4[5,3]=K4[4,6]=K4[6,4]=sigma4[2]*sigma4[3]*rho4[4] K4[3,7]=K4[7,3]=K4[4,8]=K4[8,4]=sigma4[2]*sigma4[4]*rho4[5] K4[5,7]=K4[7,5]=K4[8,6]=K4[6,8]=sigma4[3]*sigma4[4]*rho4[6] C4=adjoint(K4) n = nrow(K4)/2 Ccomp4<-C4[seq(1,(2*n-1),2),][,seq(1,(2*n-1),2)] dK4<-det(K4) pdf4D<-drayl4D(dK = dK4, Ccomp = Ccomp4, lim = 3) pdf4D(rep(1,4))
library("RConics") K4 = matrix(0,nrow = 8,ncol = 8) sigma4 = sqrt(c(0.5,1,1.5,1)) rho4<-c(0.7,0.75,0.8,0.7,0.75,0.7) K4[1,1]=K4[2,2]=sigma4[1]^2 K4[3,3]=K4[4,4]=sigma4[2]^2 K4[5,5]=K4[6,6]=sigma4[3]^2 K4[7,7]=K4[8,8]=sigma4[4]^2 K4[1,3]=K4[3,1]=K4[2,4]=K4[4,2]=sigma4[1]*sigma4[2]*rho4[1] K4[1,5]=K4[5,1]=K4[2,6]=K4[6,2]=sigma4[1]*sigma4[3]*rho4[2] K4[1,7]=K4[7,1]=K4[2,8]=K4[8,2]=sigma4[1]*sigma4[4]*rho4[3] K4[3,5]=K4[5,3]=K4[4,6]=K4[6,4]=sigma4[2]*sigma4[3]*rho4[4] K4[3,7]=K4[7,3]=K4[4,8]=K4[8,4]=sigma4[2]*sigma4[4]*rho4[5] K4[5,7]=K4[7,5]=K4[8,6]=K4[6,8]=sigma4[3]*sigma4[4]*rho4[6] C4=adjoint(K4) n = nrow(K4)/2 Ccomp4<-C4[seq(1,(2*n-1),2),][,seq(1,(2*n-1),2)] dK4<-det(K4) pdf4D<-drayl4D(dK = dK4, Ccomp = Ccomp4, lim = 3) pdf4D(rep(1,4))
Determines the contribution of sum terms, based on the index j
, rho
and the matrix A
.
zerooneoutput(j,rho,A)
zerooneoutput(j,rho,A)
j |
Vector of j indeces. |
rho |
Vector of the rho index. |
A |
Alpha matrix. |
Either 0 or 1, computes the integral contribution based on the alphamatrix A
.
A = alphamatrix(3) zerooneoutput(c(0,0,0),c(-1,-1,-1),A)
A = alphamatrix(3) zerooneoutput(c(0,0,0),c(-1,-1,-1),A)