Cpp function: fitting NEMoE paramters. (observed likelihood, penalized likelihood, complete likelihood, penalized complete likelihood) in all levels.

fitNEMoE0(
  X,
  seg,
  Z,
  y,
  K,
  lambda1,
  lambda2,
  alpha1,
  alpha2,
  V_init,
  W_init,
  beta_max,
  EM_opt,
  itmax,
  itmin,
  adapt,
  btr,
  stop_all,
  verbose,
  early_stop = FALSE
)

Arguments

X

an aggregated data matrix (n*P) of input in experts network (rbind of all levels input).

seg

an integer vector of length in each level (L).

Z

a data matrix (n*q) of input in gating network.

y

a vector of response (n).

K

A number of latent class.

lambda1

aggregated penalty lambda parameters in experts network(P*K).

lambda2

penalty parameters lambda in gating network(q*1).

alpha1

penalty parameters alpha in experts network(L*K).

alpha2

penalty parameter alpha in gating network(1).

V_init

initial parameters in gating network((q+1)*K).

W_init

aggregated initial parameters in experts network (cbind of all levels) ((P+L)*K).

beta_max

A number of maximal of coefficients to avoid divergence of during the fitting.

EM_opt

A integer indicate methods for EM algorithm. 0="EM", 1 = "CEM", 2 = "SEM", 3= "SAEM", 4="GEM".

itmax

maximal numbers of iteration in fitting NEMoE.

itmin

minimal numbers of iteration in fitting NEMoE.

adapt

A boolean variable indicates whether to use adaptive NEMoE.

btr

A boolean variable indicates whether to use backtracking during fitting NEMoE.

stop_all

A boolean variable indicates whether to stop by (likelihood converge)&(parameters converge)

verbose

A boolean variable indicates whether to show PLL during each iteration.

early_stop

A boolean variable indicates whether to stop when one latent class have select zero variables (to save time).

Value

A matrix of fitting result.