# EXAMPLE 1 (INTERFACE=FORMULA): For this example, we compute a
# Bivariate nonparametric regression estimate for Giovanni Baiocchi's
# Italian income panel (see Italy for details)
data("Italy")
attach(Italy)
# Compute the least-squares cross-validated bandwidths for the local
# constant estimator (default)
bw <- npregbw(formula=gdp~ordered(year))
summary(bw)
# Sleep for 5 seconds so that we can examine the output...
Sys.sleep(5)
# Supply your own bandwidth...
bw <- npregbw(formula=gdp~ordered(year), bws=c(0.75),
              bandwidth.compute=FALSE)
summary(bw)
# Sleep for 5 seconds so that we can examine the output...
Sys.sleep(5)
# Treat year as continuous and supply your own scaling factor c in
# c sigma n^{-1/(2p+q)}
bw <- npregbw(formula=gdp~year, bws=c(1.06),
              bandwidth.compute=FALSE, 
              bwscaling=TRUE)
summary(bw)
# Note - see also the example for npudensbw() for more extensive
# multiple illustrations of how to change the kernel function, kernel
# order, bandwidth type and so forth.
detach(Italy)
# EXAMPLE 1 (INTERFACE=DATA FRAME): For this example, we compute a
# Bivariate nonparametric regression estimate for Giovanni Baiocchi's
# Italian income panel (see Italy for details)
data("Italy")
attach(Italy)
# Compute the least-squares cross-validated bandwidths for the local
# constant estimator (default)
bw <- npregbw(xdat=ordered(year), ydat=gdp)
summary(bw)
# Sleep for 5 seconds so that we can examine the output...
Sys.sleep(5)
# Supply your own bandwidth...
bw <- npregbw(xdat=ordered(year), ydat=gdp, bws=c(0.75),
              bandwidth.compute=FALSE)
summary(bw)
# Sleep for 5 seconds so that we can examine the output...
Sys.sleep(5)
# Treat year as continuous and supply your own scaling factor c in
# c sigma n^{-1/(2p+q)}
bw <- npregbw(xdat=year, ydat=gdp, bws=c(1.06),
              bandwidth.compute=FALSE, 
              bwscaling=TRUE)
summary(bw)
# Note - see also the example for npudensbw() for more extensive
# multiple illustrations of how to change the kernel function, kernel
# order, bandwidth type and so forth.
detach(Italy)Run the code above in your browser using DataLab