cpoint {PanelTM} | R Documentation |
Computation of the regime switch time in a (two-way or three-way) panel threshold regression model.
Description
A measure for computing the time at which a regime changes, i.e. the change point.
Usage
cpoint(data., nameI=NA, nameT=NA, nameJ=NA, nameY=NA, thresholds)
Arguments
data. |
A (two-way or three-way) panel dataset. It can be either a |
nameI |
If data. is a |
nameT |
If data. is a |
nameJ |
If data. is a |
nameY |
If data. is a |
thresholds |
The vector of estimated threshold value(s). If data. is a |
Details
cpoint
computes the change point on the dependent variable (Y
) for each statistical unit i given the time series of Y
and the estimated threshold value \gamma_{ij}
.
If the observed value Y
is greater (lower) than the estimated threshold parameter, t=4
belongs to the upper (lower) regime,
and the change point is identified as the time t
after which the longest sequence of days in the lower (upper) regime is observed.
Value
An object of S4 class "cpoint", which is a matrix
reporting the change point per each statistical unit i
and each j
.
Note
The change point is detected in t>4
since the criterion has been inspired by the (two-way or three-way) dynamic panel threshold regression model that
requires at least 6 times of observation: four lags of the dependent and independent variables are used as instruments and two more are necessary to identify the
regime switch (i.e., one per regime).
Author(s)
Francesca Marta Lilja Di Lascio <marta.dilascio@unibz.it>
Selene Perazzini <selene.perazzini@alumni.imtlucca.it>
References
Di Lascio, F.M.L. and Perazzini, S. (202x) A three-way dynamic panel threshold regression model for change point detection in bioimpedance data. WP BEMPS <https://repec.unibz.it/bemps104.pdf>.
Di Lascio, F.M.L. and Perazzini, S. (2022) Change point detection in fruit bioimpedance using a three-way panel model. Book of short papers - SIS2022, p.1184-1189, Eds. A. Balzanella, M. Bini, C. Cavicchia, R. Verde. Pearson. ISBN: 978-88-9193-231-0.
See Also
See also banana
, ptm2
, and ptm3
.
Examples
# Import data
data(banana)
## Example 1: Application to a three-way panel data
# Select data for all the three levels of the third way
bioimp.df2 <- banana
# Estimation: three-way ptm on bioimpedance data with the lagged
# dependent variable as transition variable
estimates2 <- ptm3(data.=bioimp.df2, nameI="i", nameT="t",
nameJ="j", nameY="bioimpedance", nameTV=NULL,
nameXexo="weight", nameIV=NULL, trimrate=0.4,
ngrid=100, h0=1.5, Iweight=FALSE,
test.lin=FALSE)
# Change point computation using a data frame (unique input choice)
CP3 <- cpoint(data.=bioimp.df2, nameI="i", nameT="t", nameJ="j",
nameY="bioimpedance",
thresholds=estimates2@"threshold"[,2])
## NOT RUN
### Example 2: Application to a two-way panel data
#
## Select data for a specific level of the third way
#bioimp.df <- banana[which(banana$j==1),]
#
## Prepare input matrix for ptm2
#bioimp.m <- matrix(bioimp.df$bioimpedance,
# ncol=length(unique(bioimp.df$t)), byrow=TRUE)
#
## Estimation: two-way ptm on bioimpedance data with the lagged
## dependent variable as transition variable
#estimates <- ptm2(Y=bioimp.m, TV=NULL, Xendo=NULL, Xexo=NULL,
# IV=NULL, trimrate=0.4, ngrid=100, h0=1.5,
# Iweight=FALSE, test.lin=FALSE)
#
## Change point computation using a data frame as input
#CP1 <- cpoint(data.=bioimp.df, nameI="i", nameT="t", nameJ="j",
# nameY="bioimpedance",
# thresholds=estimates@"threshold"[[1]])
#
## Change point computation using a data matrix as input
#CP2 <- cpoint(data.=bioimp.m, nameI=NA, nameT=NA, nameJ=NA,
# nameY=NA, thresholds=estimates@"threshold"[[1]])
##