Learn R Programming

chickn (version 1.2.3)

DrawFreq: Draw frequency vectors

Description

Function samples frequency vectors from the selected frequency distribution law.

Usage

DrawFreq(
  m,
  n,
  sigma,
  alpha = rep(1, length(sigma)),
  TypeDist = "AR",
  ncores = 1,
  parallel = FALSE
)

Arguments

m

Number of frequency vectors.

n

Length of frequency vector.

sigma

Data variance, a scalar or a vector in the case of the Gaussian distribution mixture.

alpha

Variance weights. By default all are equal to 1.

TypeDist

Frequency distribution type. Possible values: "G" (Gaussian), "FG" (Folded Gaussian radial) or "AR" (Adapted radius). Default is "AR".

ncores

Number of cores. Multicore computation should be used only when the data is a mixture of Gaussian distributions.

parallel

logical parameter that defines whether to perform the parallel computations. Default is FALSE.

Value

A matrix m x n, with frequency vectors in rows.

Details

The frequency vectors \(w_1, \dots, w_m\) are randomly sampled from the predefined frequency distribution. The distribution law can be either \(N(0, \Sigma^{-1})\) (typeDist = "G") or \(p_R \cdot \varphi \cdot \Sigma^{-\frac{1}{2}}\) (typeDist = c("FG", "AR")), where \(\varphi\) is a vector uniformly distributed on the unit sphere, \(\Sigma\) is a diagonal matrix with the data variance sigma on the diagonal and where \(p_R\) is the radius density function. For "FG" the radius distribution is \(N(0,1)^+\) and for "AR" \(p_R = C \cdot (R^2 + \frac{R^4}{4})^{0.5} \cdot \exp{(-0.5 \cdot R^2)}\), where C is a normalization constant.

See Also

EstimSigma, GenerateFrequencies, Sketch

Examples

Run this code
# NOT RUN {
W1 = DrawFreq(m = 20, n = 10, sigma = 1e-3, TypeDist = "AR")
W2 = DrawFreq(m = 20, n = 10, sigma = 1e-3, TypeDist = "FG")
W3 = DrawFreq(m = 20, n = 10, sigma = 1e-3, TypeDist = "G")
# }

Run the code above in your browser using DataLab