Learn R Programming

mixtools (version 1.0.1)

regmixEM.loc: Iterative Algorithm Using EM Algorithm for Mixtures of Regressions with Local Lambda Estimates

Description

Iterative algorithm returning EM algorithm output for mixtures of multiple regressions where the mixing proportions are estimated locally.

Usage

regmixEM.loc(y, x, lambda = NULL, beta = NULL, sigma = NULL, 
             k = 2, addintercept = TRUE, kern.l = c("Gaussian",
             "Beta", "Triangle", "Cosinus", "Optcosinus"), 
             epsilon = 1e-08, maxit = 10000, kernl.g = 0, 
             kernl.h = 1, verb = FALSE)

Arguments

y
An n-vector of response values.
x
An nxp matrix of predictors. See addintercept below.
lambda
An nxk matrix of initial local values of mixing proportions. Entries should sum to 1. This determines number of components. If NULL, then lambda is simply one over the number of components.
beta
Initial global values of beta parameters. Should be a pxk matrix, where p is the number of columns of x and k is number of components. If NULL, then beta has uniform standard normal entries. If both
sigma
A k-vector of initial global values of standard deviations. If NULL, then $1/\code{sigma}^2$ has random standard exponential entries. If lambda, beta, and sigma are NULL, then number of components determi
k
Number of components. Ignored unless all of lambda, beta, and sigma are NULL.
addintercept
If TRUE, a column of ones is appended to the x matrix before the value of p is calculated.
kern.l
The type of kernel to use in the local estimation of lambda.
epsilon
The convergence criterion.
maxit
The maximum number of iterations.
kernl.g
A shape parameter required for the symmetric beta kernel for local estimation of lambda. The default is g = 0 which yields the uniform kernel. Some common values are g = 1 for the Epanechnikov kernel, g = 2 for the biweight kernel, a
kernl.h
The bandwidth controlling the size of the window used in the local estimation of lambda around x.
verb
If TRUE, then various updates are printed during each iteration of the algorithm.

Value

  • regmixEM.loc returns a list of class mixEM with items:
  • xThe set of predictors (which includes a column of 1's if addintercept = TRUE).
  • yThe response values.
  • lambda.xThe final local mixing proportions.
  • betaThe final global regression coefficients.
  • sigmaThe final global standard deviations.
  • loglikThe final log-likelihood.
  • posteriorAn nxk matrix of posterior probabilities for observations.
  • all.loglikA vector of each iteration's log-likelihood.
  • restartsThe number of times the algorithm restarted due to unacceptable choice of initial values.
  • ftA character vector giving the name of the function.

See Also

regmixEM.lambda

Examples

Run this code
## Compare a 2-component and 3-component fit to NOdata.

data(NOdata)
attach(NOdata)
set.seed(100)
out1 <- regmixEM.loc(Equivalence, NO, kernl.h = 2, 
                     epsilon = 1e-02, verb = TRUE)
out2 <- regmixEM.loc(Equivalence, NO, kernl.h = 2, k = 3,
                     epsilon = 1e-02, verb = TRUE)
c(out1$loglik, out2$loglik)

Run the code above in your browser using DataLab