EPF_L_compl: Parameter Estimation Of Linear Models Using Evolutionary...

View source: R/EPF_L_compl.R

EPF_L_complR Documentation

Parameter Estimation Of Linear Models Using Evolutionary Particle Filters (EPF) Method

Description

Estimation of the parameters of a linear regression model using a particle filter method that includes two evolutionary algorithm-based steps. See Details

Usage

EPF_L_compl(
  Data,
  Y,
  nPart = 1000L,
  p_mut = 0.01,
  p_cross = 0.5,
  sigma_l = 1,
  lmbd = 3,
  count = 10,
  initDisPar,
  resample_met = syst_rsmpl
)

Arguments

Data

matrix. The matrix containing the independent variables of the linear model

Y

numeric. The dependent variable

nPart

integer. The number of particles, by default 1000L

p_mut

numeric. The mutation probability in EPF, by default 0.01

p_cross

numeric. The cross-over probability in EPF, by default 0.5

sigma_l

The value of the variance in the likelihood normal, 1 by default

lmbd

numeric. A number to be added and subtracted from the priors when initDisPar is not provided, by default 3

count

numeric. The number of replications within EPF, by default 10

initDisPar

matrix. Values a, b of the uniform distribution (via runif) for each parameter to be estimated, see more in Details

resample_met

function. The resampling method used in EPF, by default syst_rsmpl, see Details

Details

Estimation of the coefficients of a linear regression:

Y = β_0 + β_1*X_1 + ... + β_n*X_n + ε, (ε \sim N(0,1))

using Evolutionary Particle Filter. EPF includes additional steps within PF-base algorithm to avoid degeneracy of particles and prevent the curse of dimensionality. One step is the inclusion of two evolutionary algorithm - based processes: mutation and cross-over. In mutation, p_mut * nPart particles are selected at random from the set of particles obtained in k-1 PF-iteration. This particles will be replaced by fresh new particles taken from a uniform distribution. In cross-over, a pair of random particles is selected from the k-1 propagated particles. The pair is combined into one particle (using the mean function) and the result replaces a particle selected at random from the k-1 propagated particles. This cross-over process is replicated prob_cross * N times on each iteration. EPF_L_compl uses all the information to estimate the parameters, differs from function EPF_L_MovH by using movH equals nrows(Data)

Similarly as in PF_lm and PF_lm_ss, the state-space equations of the linear model are:

(Eq. 1) X_{k} = a_0 + a_1 * X1_{k-1} + ... + a_n * Xn_{k-1}

(Eq. 2) Y_{k} = X_{k} + ε, ε \sim N(0,σ)

where, k = 2, ... , number of observations; a_0, ... , a_n are the parameters to be estimated (coefficients), and σ = 1 .

The priors of the parameters are assumed uniformly distributed. initDisPar is a matrix; the number of rows is the number of independent variables plus one since the constant term of the regression is also estimated. The first and second column of initDisPar are the corresponding arguments a and b of the uniform distribution (stats::runif) for each parameter prior. The first row of initDisPar is the prior guess of the constant term. The following rows are the prior guesses of the coefficients. If initDisPar is missing, the initial priors are taken using lm() and coeff() plus-minus lmbd as a reference.

For resample_met, several resampling methods are used following Li, T., Bolic, M., & Djuric, P. M. (2015). Resampling methods for particle filtering: classification, implementation, and strategies. IEEE Signal processing magazine, 32(3), 70-86. Currently available resampling methods are: syst_rsmpl - systematic resampling (default), multin_rsmpl - multinomial resampling, strat_rsmpl - stratified resampling, and simp_rsmpl - simple resampling (similar to PF_lm_ss)

Value

A list with the following elements: smmry: A summary matrix of the estimated parameters; first column is the OLS estimation, and second column is the EPF estimation. SSE: The sum of squared errors of the EPF estimation. Yhat: Estimation of the observation Y. sttp: A matrix with the last iteration particles. estm: A vector with the final parameter EPF estimation. c_time: The time in seconds it takes to complete EPF.

Author(s)

Christian Llano Robayo, Nazrul Shaikh.

Examples


## Not run: 
#Example using linear model with 5 variables
#Using rcorrmatrix from cluterGeneration to generate a random correlation matrix
realval_coef <- c(2, -1.25, 2.6, -0.7, -1.8, 0.6)
Data1 <-  MASS::mvrnorm(100, mu = rep(0, 5),
                        Sigma = clusterGeneration::rcorrmatrix(5),
                        empirical = TRUE)
eps <- stats::rnorm(100) # error term
Y_ <- colSums(t(cbind(1,Data1)) * realval_coef) + eps
#run EPF
Res1 <- EPF_L_compl(Data = Data1, Y = Y_)
#Summary EPF estimation
Res1$smmry

## End(Not run)

ChrissCod/LMfilteR documentation built on Feb. 9, 2023, 1:06 p.m.