## Not run:
library("ConvergenceConcepts")
library("strucchange")
data("PhillipsCurve")
## Not run:
# uk <- window(PhillipsCurve, start = 1948)
# attach(data.frame(uk))
# y <- uk[,5]
# bigx <- cbind(dp1,du,u1) # collect all regressors
# reg1 <- lm(y ~ bigx)
# coef(reg1)
# nover <- 16 # choose range allowing n=25, 26, ..., 40
#
# # the following step will take some time to run
#
# sC <- checkConv(y, bigx, trueb=0, n999=999, nover=nover, seed1=294)
#
# dim(sC) # n999 x nover x length(key)
# j <- 3 # choose key coefficient no. 3 for lagged income
# epsilon <- 0.1 #needed for p.as.plot command below
# nb.sp <- 10 # needed for p.as.plot command below
# mode <- "p" # needed for p.as.plot command below
#
# # criterion function in ConvergenceConcepts package wants 999 rows
# dat <- sC[,,j] # 999 sample paths for diff inflation n=25,26,..40
# critp <- criterion(data = dat, epsilon = epsilon, mode = "p")$crit
# critas <- criterion(data = dat, epsilon = epsilon, mode = "as")$crit
#
# p.as.plot(dat, critp, critas, epsilon, nb.sp, mode = mode)
# nstart <- length(y) - nover + 1
# nn <- seq(nstart, length(y)) # choose the range of n the sample size
#
# opar <- par(mfrow = c(2,1)) #plot 2 plots in one
# plot(nn,critp, typ="l",
# main="Convergence in probability: Diff(Inflation) Coefficient",
# xlab="Sample size", ylab="Criterion using 999 sample paths")
# plot(nn,critas, typ="l",
# main="Almost sure convergence: Diff(Inflation) Coefficient",
# xlab="Sample size", ylab="Criterion using 999 sample paths")
# par(opar)
#
# regp <- lm(critp ~ nn) # OLS of conv. in prob. criterion
# sup <- summary(regp) # regressed on sample size
# sup$coef
# # slope coeff. should be negative in sign for convergence
# # the t statistic on the slope coefficient should be large
# regas <- lm(critas ~ nn) #OLS of almost sure conv criterion
# suas <- summary(regas)#regressed on sample size
# suas$coef
# # slope coeff. should be negative in sign for convergence
# # the t statistic on the slope coefficient should be large
# ## End(Not run)
## End(Not run)
Run the code above in your browser using DataLab