Learn R Programming

scorematchingad (version 0.1.1)

ppi_param_tools: PPI Parameter Tools

Description

The default parameterisation of the PPI model is a symmetric covariance-like matrix \(A_L\), a location-like vector \(b_L\) and a set of Dirichlet exponents \(\beta\). For p components, \(A_L\) has p-1 rows, \(b_L\) is a vector with p-1 elements and \(\beta\) is a vector with p elements. For score matching estimation this form of the parameters must be converted into a single parameter vector using ppi_paramvec(). ppi_paramvec() also includes easy methods to set parameters to NA for estimation with ppi() (in ppi() the NA-valued elements are estimated and all other elements are fixed). The reverse of ppi_paramvec() is ppi_parammats(). An alternative parametrisation of the PPI model uses a single p by p matrix \(A^*\) instead of \(A_L\) and \(b_L\), and for identifiability \(A^*\) is such that \(1^T A^* 1 = 0\) where \(1=(1,1,...,1)\) and \(0=(0,0,..., 0)\) scealy2023scscorematchingad. Convert between parametrisations using ppi_toAstar() and ppi_fromAstar().

Usage

ppi_paramvec(
  p = NULL,
  AL = NULL,
  bL = NULL,
  Astar = NULL,
  beta = NULL,
  betaL = NULL,
  betap = NULL
)

ppi_parammats(paramvec)

ppi_toAstar(AL, bL)

ppi_fromAstar(Astar)

Value

ppi_paramvec(): a vector of length \(p + (p-1)(2 + (p-1)/2)\).

ppi_parammats(): A named list of \(A_L\), \(b_L\), and \(\beta\).

ppi_toAstar(): The matrix \(A^*\).

ppi_fromAstar(): A list of the matrix \(A_L\), the vector \(b_L\) and a discarded constant.

Arguments

p

The number of components. If NULL then p will be inferred from other inputs.

AL

Either NULL, a p-1 x p-1 symmetric matrix, a number, or "diag". If NULL then all \(A_L\) elements will be set to NA. If a single number, then \(A_L\) will be fixed as a matrix of the given value. If "diag" then the non-diagonal elements of \(A_L\) will be fixed to 0, and the diagonal will be NA.

bL

Either NULL, a number, or a vector of length p-1. If NULL, then all elements of \(b_L\) will be set to NA. If a single number, then \(b_L\) will be fixed at the supplied value.

Astar

The \(A^*\) matrix (a p by p symmetric matrix)

beta

Either NULL, a number, or a vector of length p. If NULL then all elements of \(\beta\) will be set to NA. If a single number then the \(\beta\) elements will be fixed at the given number.

betaL

Either NULL, a number, or a vector of length p-1. If NULL then the 1...(p-1)th \(\beta\) elements will be set to NA. If a single number then the 1...(p-1)th \(\beta\) elements will be fixed at the given number.

betap

Either NULL or a number. If NULL then the pth element of \(\beta\) will be set to NA, and ppi() will estimate it. If a number, then the pth element of \(\beta\) will be fixed at the given value.

paramvec

A PPI parameter vector, typically created by ppi_paramvec() or as an output of ppi().

PPI Model

The PPI model density is proportional to $$\exp(z_L^TA_Lz_L + b_L^Tz_L)\prod_{i=1}^p z_i^{\beta_i},$$ where \(p\) is the dimension of a compositional measurement \(z\), and \(z_L\) is \(z\) without the final (\(p\)th) component. \(A_L\) is a \(p-1 \times p-1\) symmetric matrix that controls the covariance between components. \(b_L\) is a \(p-1\) vector that controls the location within the simplex. The \(i\)th component \(\beta_i\) of \(\beta\) controls the concentration of density when \(z_i\) is close to zero: when \(\beta_i \geq 0\) there is no concentration and \(\beta_i\) is hard to identify; when \(\beta_i < 0\) then the probability density of the PPI model increases unboundedly as \(z_i\) approaches zero, with the increasing occurring more rapidly and sharply the closer \(\beta_i\) is to \(-1\).

Details

ppi_paramvec() returns a vector starting with the diagonal elements of \(A_L\), then the off-diagonal elements extracted by upper.tri() (which extracts elements of \(A_L\) along each row, left to right, then top to bottom), then \(b_L\), then \(\beta\).

The Astar parametrisation rewrites the PPI density as proportional to $$\exp(z^TA^*z)\prod_{i=1}^p z_i^{\beta_i},$$ where \(A^*\) (Astar) is a \(p\) by \(p\) matrix. Because \(z\) lies in the simplex (in particular \(\sum z_i = 1\)), the density is the same regardless of the value of \(1^T A^* 1\)=sum(Astar), where \(1\) is the vector of ones. Thus \(A_L\) and \(b_L\) specify \(A^*\) up to an additive factor. In the conversion ppi_toAstar(), \(A^*\) is returned such that \(1^T A^* 1 = 0\). NULL values or NA elements are not allowed for ppi_toAstar() and ppi_fromAstar().

See Also

Other PPI model tools: dppi(), ppi(), ppi_robust(), rppi()

Examples

Run this code
ppi_paramvec(AL = "diag", bL = 0, betap = -0.5, p = 3)
vec <- ppi_paramvec(AL = rsymmetricmatrix(2), beta = c(-0.8, -0.7, 0))
ppi_parammats(vec)
Astar <- rWishart(1, 6, diag(3))[,,1]
ppi_fromAstar(Astar)
ppi_toAstar(ppi_fromAstar(Astar)$AL, ppi_fromAstar(Astar)$bL)

Run the code above in your browser using DataLab