sampleUnivTMoE: Draw a sample from a univariate t mixture of experts (TMoE). In meteorits: Mixture-of-Experts Modeling for Complex Non-Normal Distributions

Description

Draw a sample from a univariate t mixture of experts (TMoE).

Usage

 1 sampleUnivTMoE(alphak, betak, sigmak, nuk, x)

Arguments

 alphak The parameters of the gating network. alphak is a matrix of size (q + 1, K - 1), with K - 1, the number of regressors (experts) and q the order of the logistic regression betak Matrix of size (p + 1, K) representing the regression coefficients of the experts network. sigmak Vector of length K giving the standard deviations of the experts network. nuk Vector of length K giving the degrees of freedom of the experts network t densities. x A vector of length n representing the inputs (predictors).

Value

A list with the output variable y and statistics.

• y Vector of length n giving the output variable.

• zi A vector of size n giving the hidden label of the expert component generating the i-th observation. Its elements are zi[i] = k, if the i-th observation has been generated by the k-th expert.

• z A matrix of size (n, K) giving the values of the binary latent component indicators Zik such that Zik = 1 iff Zi = k.

• stats A list whose elements are:

• Ey_k Matrix of size (n, K) giving the conditional expectation of Yi the output variable given the value of the hidden label of the expert component generating the ith observation zi = k, and the value of predictor X = xi.

• Ey Vector of length n giving the conditional expectation of Yi given the value of predictor X = xi.

• Vary_k Vector of length k representing the conditional variance of Yi given zi = k, and X = xi.

• Vary Vector of length n giving the conditional expectation of Yi given X = xi.

Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 n <- 500 # Size of the sample alphak <- matrix(c(0, 8), ncol = 1) # Parameters of the gating network betak <- matrix(c(0, -2.5, 0, 2.5), ncol = 2) # Regression coefficients of the experts sigmak <- c(0.5, 0.5) # Standard deviations of the experts nuk <- c(5, 7) # Degrees of freedom of the experts network t densities x <- seq.int(from = -1, to = 1, length.out = n) # Inputs (predictors) # Generate sample of size n sample <- sampleUnivTMoE(alphak = alphak, betak = betak, sigmak = sigmak, nuk = nuk, x = x) # Plot points and estimated means plot(x, sample\$y, pch = 4) lines(x, sample\$stats\$Ey_k[, 1], col = "blue", lty = "dotted", lwd = 1.5) lines(x, sample\$stats\$Ey_k[, 2], col = "blue", lty = "dotted", lwd = 1.5) lines(x, sample\$stats\$Ey, col = "red", lwd = 1.5)

meteorits documentation built on Jan. 11, 2020, 9:13 a.m.