# NOT RUN {
require(prodest)
## Chilean data on production.
## Publicly available at http://www.ine.cl/canales/chile_estadistico/estadisticas_
## economicas/industria/series_estadisticas/series_estadisticas_enia.php
data(chilean)
# we fit a model with two free (skilled and unskilled), one state (capital)
# and one proxy variable (electricity)
set.seed(154673)
LP.fit <- prodestLP(chilean$Y, fX = cbind(chilean$fX1, chilean$fX2), chilean$sX,
chilean$pX, chilean$idvar, chilean$timevar)
LP.fit.solnp <- prodestLP(chilean$Y, fX = cbind(chilean$fX1, chilean$fX2), chilean$sX,
chilean$pX, chilean$idvar, chilean$timevar, opt = 'solnp')
# }
# NOT RUN {
# run the same model in parallel
require(parallel)
nCores <- as.numeric(Sys.getenv("NUMBER_OF_PROCESSORS"))
cl <- makeCluster(getOption("cl.cores", nCores - 1))
set.seed(154673)
LP.fit.par <- prodestLP(chilean$Y, fX = cbind(chilean$fX1, chilean$fX2),
chilean$sX, chilean$pX, chilean$idvar, chilean$timevar,
cluster = cl)
stopCluster(cl)
# }
# NOT RUN {
# show results
summary(LP.fit)
summary(LP.fit.solnp)
# show results in .tex tabular format
printProd(list(LP.fit, LP.fit.solnp))
# }
Run the code above in your browser using DataLab