`mixregPvary' is used to estimate a mixture of regression models with varying proportions: $$Y|_{\boldsymbol{x},Z=z} \sim \sum_{c=1}^C\pi_c(z)N(\boldsymbol{x}^{\top}\boldsymbol{\beta}_c,\sigma_c^2).$$ The varying proportions are estimated using a local constant regression method (kernel regression).
mixregPvary(x, y, C = 2, z = NULL, u = NULL, h = NULL,
kernel = c("Gaussian", "Epanechnikov"), ini = NULL)
A list containing the following elements:
length(u) by C matrix of estimated mixing proportions at grid points.
n by C matrix of estimated mixing proportions at z.
(p + 1) by C matrix of estimated component regression coefficients.
C-dimensional vector of estimated component variances.
final log-likelihood.
an n by p matrix of explanatory variables. The intercept will be automatically added to x.
an n-dimensional vector of response variable.
number of mixture components. Default is 2.
a vector of a variable with varying-proportions. It can be any of the variables in x
.
Default is NULL, and the first variable in x
will be used.
a vector of grid points for the local constant regression method to estimate the proportions. If NULL (default), 100 equally spaced grid points are automatically generated between the minimum and maximum values of z.
bandwidth for kernel density estimation. If NULL (default), the bandwidth is calculated based on the method of Botev et al. (2010).
character, determining the kernel function used in local constant method:
Gaussian
or Epanechnikov
. Default is Gaussian
.
initial values for the parameters. Default is NULL, which obtains the initial values
using the regmixEM
function of the `mixtools' package.
If specified, it can be a list with the form of
list(pi, beta, var)
, where
pi
is a vector of length C of mixing proportions,
beta
is a (p + 1) by C matrix for component regression coefficients, and
var
is a vector of length C of component variances.
Huang, M. and Yao, W. (2012). Mixture of regression models with varying mixing proportions: a semiparametric approach. Journal of the American Statistical Association, 107(498), 711-724.
Botev, Z. I., Grotowski, J. F., and Kroese, D. P. (2010). Kernel density estimation via diffusion. The Annals of Statistics, 38(5), 2916-2957.
mixregPvaryGen
n = 100
C = 2
u = seq(from = 0, to = 1, length = 100)
true_beta = cbind(c(4, - 2), c(0, 3))
true_var = c(0.09, 0.16)
data = mixregPvaryGen(n, C)
x = data$x
y = data$y
est = mixregPvary(x, y, C, z = x, u, h = 0.08)
Run the code above in your browser using DataLab