## Select data
data(banana)
data <- banana[which(banana$j==1),]
# Prepare input matrices for ptm2
bioimpedance <- matrix(data$bioimpedance, ncol=length(unique(data$t)),
byrow=TRUE)
weight <- matrix(data$weight, ncol=length(unique(data$t)), byrow=TRUE)
## Estimation
# Model on bioimpedance y_{it} with transition variable y_{i(t-1)}
# y_{it}= (phi1_c)1(y_{it-1}<= gamma) + (phi2_c)1(y_{it-1}>gamma)
# Estimation and linear test
ptm2(Y=bioimpedance, TV=NULL, Xendo=NULL, Xexo=NULL, IV=NULL,
trimrate=0.4, ngrid=100, h0=1.5, Iweight=FALSE, test.lin=TRUE,
B=100)
## NOT RUN
## Model on bioimpedance y_{it} with transition variable y_{i(t-1)} and
## weight as regressor x_{it}:
## y_{it}= (phi1_c + phi1_X*x_{it})1(y_{it-1}<= gamma) +
## (phi2_c + phi2_X*x_{it})1(y_{it-1}>gamma)
#ptm2(Y=bioimpedance, TV=NULL, Xendo=weight, Xexo=NULL, IV=NULL,
# trimrate=0.4, ngrid=100, h0=1.5, Iweight=FALSE, test.lin=FALSE)
##
Run the code above in your browser using DataLab