Package 'DPTM'

Title: Dynamic Panel Multiple Threshold Model with Fixed Effects
Description: Compute the fixed effects dynamic panel threshold model suggested by Ramírez-Rondán (2020) <doi:10.1080/07474938.2019.1624401>, and dynamic panel linear model suggested by Hsiao et al. (2002) <doi:10.1016/S0304-4076(01)00143-9>, where maximum likelihood type estimators are used. Multiple threshold estimation based on Markov Chain Monte Carlo (MCMC) is allowed, and model selection of linear model, threshold model and multiple threshold model is also allowed.
Authors: Bai Hujie [aut, cre, cph]
Maintainer: Bai Hujie <[email protected]>
License: GPL (>= 3)
Version: 1.3.7
Built: 2024-11-18 05:10:23 UTC
Source: https://github.com/hujiebai/dptm

Help Index


A simulation data used for examples

Description

A simulation data used for examples

Usage

data

Format

A simulation data used for examples

None


The dynamic panel linear model with fixed effects

Description

The dynamic panel linear model with fixed effects

Usage

DPML(
  y,
  y1 = NULL,
  x = NULL,
  w = NULL,
  var_u = NULL,
  tt,
  nn,
  time_trend = FALSE,
  time_fix_effects = FALSE,
  restart = FALSE,
  x1 = NULL,
  delty0 = NULL,
  Only_b = FALSE,
  display = TRUE
)

Arguments

y

the dependent variable; vector type input.

y1

the lag dependent variable; vector type input; By default, y1 is NULL, and then y1 will be computed by y automatically.

x

the independent variable; matrix type input.

w

the variance ratio; By default, is NULL; It must be greater than 1.

var_u

the option of variance of error term; By default, is NULL; It must be greater than 0; When meet relevant ERROR, please change the var_u.

tt

the length of time period.

nn

the number of individuals.

time_trend

the time trend; By default, it is FALSE.

time_fix_effects

the time fixed effects; By default, it is FALSE.

restart

the option of iterations; By default, restart is FALSE, if encounters iteration failure, please set restart as TRUE.

x1

the initial values of independent variable; matrix type input. By default, x1 is NULL, and thus x1 will be computed by x automatically.

delty0

the option of delta_y; By default, delty0 is NULL; Please do not change delty0.

Only_b

the option of initial equation;By default, Only_b is FALSE, and if Only_b is TRUE, initial delta y will be a constant C. Please see Hsiao (2002) and Ramírez-Rondán (2020) for more details.

display

the option of whether to print the messages of estimated results; By default, the display is TRUE.

Value

A list containing the following components:

ssemin

the negaive log-likelihood function value

Coefs

parameter estimates containing t-values

pars

iterated results for all parameters

duit

the first-difference form of residuals

dy0

the first-difference form of dependent variable

xx

the independent variables and their initial values

covariance_matrix

the covariance matrix

Ses

the standard errors of coefs

Zvalues

the values of the statistic

ccd

the number of independent variables

coefs

parameter estimates containing their initial valuess

Functions

  • DPML(): This is a dynamic panel linear model with fixed effects, which allows time trend term or time fixed effects.

Author(s)

Hujie Bai

References

Ramírez-Rondán, N. R. (2020). Maximum likelihood estimation of dynamic panel threshold models. Econometric Reviews, 39(3), 260-276.

Hsiao, C., Pesaran, M. H., & Tahmiscioglu, A. K. (2002). Maximum likelihood estimation of fixed effects dynamic panel data models covering short time periods. Journal of econometrics, 109(1), 107-150.

Examples

data("data", package = "DPTM")
y <- data$data_test_linear$y
q <- data$data_test_linear$q
x <- as.matrix(data$data_test_linear$x)
z <- as.matrix(data$data_test_linear$z)
tt <- data$data_test_linear$tt
nn <- data$data_test_linear$nn
xx <- cbind(x,z)
m1 <- DPML(y=y,x=xx,tt=tt,nn=nn)
m1$Coefs

The Dynamic panel threshold model with multiple thresholds

Description

DPTS This is a dynamic panel threshold model with fixed effects, which allows multiple thresholds, time trend term or time fixed effects.

Usage

DPTS(
  y,
  y1 = NULL,
  x = NULL,
  q,
  cvs = NULL,
  time_trend = FALSE,
  time_fix_effects = FALSE,
  x1 = NULL,
  tt,
  nn,
  Th = 1,
  ms = 1000,
  burnin = 1000,
  types = "DREAMzs",
  ADs = FALSE,
  r0x = NULL,
  r1x = NULL,
  NoY = FALSE,
  restart = FALSE,
  Only_b = FALSE,
  w = NULL,
  var_u = NULL,
  delty0 = NULL,
  nCR = 3,
  autoburnin = TRUE,
  sro = 0.1,
  display = TRUE
)

Arguments

y

the dependent variable; vector type input.

y1

the lag dependent variable; vector type input; By default, y1 is NULL, and then y1 will be computed by y automatically.

x

the independent variable; matrix type input.

q

the threshold variable; vector type input.

cvs

the set of control variables; matrix type input;By default, cvs is NULL.

time_trend

the time trend; By default, it is FALSE.

time_fix_effects

the time fixed effects; By default, it is FALSE.

x1

the initial values of independent variable; matrix type input. By default, x1 is NULL, and thus x1 will be computed by x automatically.

tt

the length of time period.

nn

the number of individuals.

Th

the number of thresholds.

ms

the length of MCMC chains after burn-in.

burnin

the length of burn-in.

types

the type of MCMC used; More details see BayesianTools::runMCMC.

ADs

the options for MCMC; More details see BayesianTools::runMCMC.

r0x

the lower bound of thresholds; By default, r0x is NULL, and thus r0x will be computed by q automatically.

r1x

the upper bound of thresholds; By default, r0x is NULL, and thus r1x will be computed by q automatically.

NoY

the option of threshold effects on the lag dependent variable; By default, NoY is False, and thus there will be threshold effects on y1.

restart

the option of iterations; By default, restart is FALSE, if encounters iteration failure, please set restart as TRUE.

Only_b

the option of initial equation;By default, Only_b is FALSE, and if Only_b is TRUE, initial delta y will be a constant C.; Please see Hsiao (2002) and Ramírez-Rondán (2020) for more details.

w

the variance ratio; By default, is NULL; It must be greater than 1.

var_u

the option of variance of error term; By default, is NULL; It must be greater than 0; When meet relevant ERROR, please change the var_u.

delty0

the option of delta_y; By default, delty0 is NULL; Please do not change delty0.

nCR

parameter determining the number of cross-over proposals of DREAM MCMC. If nCR = 1 all parameters are updated jointly.

autoburnin

a logical flag indicating of the Gelman and Rubin's convergence diagnostic, whether variables in x should be transformed to improve the normality of the distribution. If set to TRUE, a log transform or logit transform, as appropriate, will be applied.

sro

the least ratio of sample in regimes.

display

the option of whether to print the messages of estimated results; By default, the display is TRUE.

Value

A list containing the following components:

ssemin

the negaive log-likelihood function value

Ths

a vector of multiple thresholds in order

Ths_IC

a matrix of confidence intervals of all thresholds

Coefs

parameter estimates containing t-values

MCMC_Convergence_Diagnostic

the Gelman and Rubin's convergence diagnostic results of MCMC sample

model

a list of results of DMPL

MCMC

an object of class mcmcSampler (if one chain is run) or mcmcSamplerList, more details see BayesianTools::runMCMC

Author(s)

Hujie Bai

References

Ramírez-Rondán, N. R. (2020). Maximum likelihood estimation of dynamic panel threshold models. Econometric Reviews, 39(3), 260-276.

Hsiao, C., Pesaran, M. H., & Tahmiscioglu, A. K. (2002). Maximum likelihood estimation of fixed effects dynamic panel data models covering short time periods. Journal of econometrics, 109(1), 107-150.

Examples

data("data", package = "DPTM")
y <- data$data_test$y
q <-data$data_test$q
x <- as.matrix(data$data_test$x)
z <- as.matrix(data$data_test$z)
tt <- data$data_test$tt
nn <- data$data_test$nn
m1 <- DPTS(y=y,q=q,x=x,cvs = z,tt=tt,nn=nn,Th=1,ms = 100,burnin = 100)
m1$Ths
m1$Ths_IC
m1$Coefs
m1$MCMC_Convergence_Diagnostic
plot(m1$MCMC)

The test for the number of thresholds.

Description

Threshold_Test This is a test for the numer of thresholds, and it is noted that when under H0 the number of Thresholds is 0, this test is the so called threshold existence test.

Usage

Threshold_Test(
  y,
  y1 = NULL,
  x = NULL,
  q,
  cvs = NULL,
  time_trend = FALSE,
  time_fix_effects = FALSE,
  x1 = NULL,
  tt,
  nn,
  Th = 0,
  ms = 1000,
  burnin = 1000,
  types = "DREAMzs",
  ADs = FALSE,
  r0x = NULL,
  r1x = NULL,
  NoY = FALSE,
  restart = FALSE,
  Only_b = FALSE,
  w = NULL,
  var_u = NULL,
  nCR = 3,
  autoburnin = TRUE,
  bt = 100,
  parallel = TRUE,
  sro = 0.1,
  display = TRUE
)

Arguments

y

the dependent variable; vector type input.

y1

the lag dependent variable; vector type input; By default, y1 is NULL, and then y1 will be computed by y automatically.

x

the independent variable; matrix type input.

q

the threshold variable; vector type input.

cvs

the set of control variables; matrix type input;By default, cvs is NULL.

time_trend

the time trend; By default, it is FALSE.

time_fix_effects

the time fixed effects; By default, it is FALSE.

x1

the initial values of independent variable; matrix type input. By default, x1 is NULL, and thus x1 will be computed by x automatically.

tt

the length of time period.

nn

the number of individuals.

Th

the number of thresholds.

ms

the length of MCMC chains after burn-in.

burnin

the length of burn-in.

types

the type of MCMC used; More details see BayesianTools::runMCMC.

ADs

the options for MCMC; More details see BayesianTools::runMCMC.

r0x

the lower bound of thresholds; By default, r0x is NULL, and thus r0x will be computed by q automatically.

r1x

the upper bound of thresholds; By default, r0x is NULL, and thus r1x will be computed by q automatically.

NoY

the option of threshold effects on the lag dependent variable; By default, NoY is False, and thus there will be threshold effects on y1.

restart

the option of iterations; By default, restart is FALSE, if encounters iteration failure, please set restart as TRUE.

Only_b

the option of initial equation;By default, Only_b is FALSE, and if Only_b is TRUE, initial delta y will be a constant C. Please see Hsiao (2002) and Ramírez-Rondán (2020) for more details.

w

the variance ratio; By default, is NULL; It must be greater than 1.

var_u

the option of variance of error term; By default, is NULL; It must be greater than 0; When meet relevant ERROR, please change the var_u.

nCR

parameter determining the number of cross-over proposals of DREAM MCMC. If nCR = 1 all parameters are updated jointly.

autoburnin

a logical flag indicating of the Gelman and Rubin's convergence diagnostic, whether variables in x should be transformed to improve the normality of the distribution. If set to TRUE, a log transform or logit transform, as appropriate, will be applied.

bt

the number of bootstrap.

parallel

the option of parallel; By default, parallel is FALSE, when parallel is TRUE, this test will run in parallel.

sro

the least ratio of sample in regimes.

display

the option of whether to print the messages of estimated results; By default, the display is TRUE.

Value

A list containing the following components:

ps

the p-value of test

crit

the crit value of test

LR

the statistic

LRs

a vector of statistics in bootstrap

Author(s)

Hujie Bai

References

Ramírez-Rondán, N. R. (2020). Maximum likelihood estimation of dynamic panel threshold models. Econometric Reviews, 39(3), 260-276.

Hsiao, C., Pesaran, M. H., & Tahmiscioglu, A. K. (2002). Maximum likelihood estimation of fixed effects dynamic panel data models covering short time periods. Journal of econometrics, 109(1), 107-150.

Examples

data("data", package = "DPTM")
y <- data$data_test$y
q <- data$data_test$q
x <- as.matrix(data$data_test$x)
z <- as.matrix(data$data_test$z)
tt <- data$data_test$tt
nn <- data$data_test$nn

### Examples elapsed time > 5s
m1 <- Threshold_Test(y=y,x=x,q=q,cvs=z,tt=tt,nn=nn,Th=0,ms = 500,burnin=500,
bt=10,parallel=FALSE)
m1$ps