# NOT RUN {
# }
# NOT RUN {
require( npsf )
# Prepare data and matrices
data( ccr81 )
head( ccr81 )
# Create some missing values
ccr81 [64, "x4"] <- NA # just to create missing
ccr81 [68, "y2"] <- NA # just to create missing
Y2 <- as.matrix( ccr81[ , c("y1", "y2", "y3"), drop = FALSE] )
X2 <- as.matrix( ccr81[ , c("x1", "x2", "x3", "x4", "x5"), drop = FALSE] )
# Perform output-based test of returns to scale smoothed
# homogeneous bootstrap with 999 replications at the 5<!-- % -->
# significance level. Also perform Test #2
t1 <- nptestrts(y1 + y2 + y3 ~ x1 + x2 + x3 + x4 + x5,
data = ccr81, homogeneous = TRUE,
reps = 999, dots = TRUE, base = "o")
# suppress printing replication dots
t2 <- nptestrts(Y2 ~ X2,
homogeneous = TRUE,
reps = 100, dots = FALSE, base = "o")
# heterogeneous
t3 <- nptestrts(Y2 ~ X2,
homogeneous = FALSE,
reps = 100, dots = TRUE, base = "o")
# ===========================
# === Parallel computing ===
# ===========================
# Perform previous test but use 8 cores and
# cluster type SOCK
t3 <- nptestrts(y1 + y2 + y3 ~ x1 + x2 + x3 + x4 + x5,
data = ccr81, homogeneous = FALSE,
reps = 100, dots = TRUE, base = "o",
core.count = 8, cl.type = "SOCK")
# Really large data-set
data(usmanuf)
head(usmanuf)
nrow(usmanuf)
table(usmanuf$year)
# Figure industries to include in the sample (first quarter)
summary(usmanuf[usmanuf$year >= 1999 & usmanuf$year < 2000, "naics"])
# This test is quite demanding and it will take some time
# depending on computer power
t4 <- nptestrts(Y ~ K + L + M, data = usmanuf,
subset = year >= 1999 & year < 2000 & naics < 321900,
homogeneous = FALSE, reps = 100, dots = TRUE, base = "o",
core.count = 8, cl.type = "SOCK")
# This is very computer intensive task
t5 <- nptestrts(Y ~ K + L + M, data = usmanuf,
subset = year >= 1999 & year < 2000,
homogeneous = FALSE, reps = 100, dots = TRUE, base = "o",
core.count = 8, cl.type = "SOCK")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab