data("post")
x.post<- seq(post$xinput[100],max(post$xinput),
length.out=100)
# 1. When rho[x] is known and equal to 2, we set:
rho<-2
# To determine the sample fraction k=k[n](x)
# in hat(varphi[pick])(x).
best_kn.1<-kopt_momt_pick(post$xinput, post$yprod,
x.post, method="pickands", rho=rho)
# To compute the frontier estimates and confidence intervals:
res.pick.1<-dfs_pick(post$xinput, post$yprod, x.post,
rho=rho, k=best_kn.1)
# Representation
plot(yprod~xinput, data=post, xlab="Quantity of labor",
ylab="Volume of delivered mail")
lines(x.post, res.pick.1[,1], lty=1, col="cyan")
lines(x.post, res.pick.1[,2], lty=3, col="magenta")
lines(x.post, res.pick.1[,3], lty=3, col="magenta")
if (FALSE) {
# 2. rho[x] is unknown and estimated by
# the Pickands estimator hat(rho[x])
rho_pick<-rho_momt_pick(post$xinput, post$yprod,
x.post, method="pickands")
best_kn.2<-kopt_momt_pick(post$xinput, post$yprod,
x.post, method="pickands", rho=rho_pick)
res.pick.2<-dfs_pick(post$xinput, post$yprod, x.post,
rho=rho_pick, k=best_kn.2)
# 3. rho[x] is unknown independent of x and estimated
# by the (trimmed) mean of hat(rho[x])
rho_trimmean<-mean(rho_pick, trim=0.00)
best_kn.3<-kopt_momt_pick(post$xinput, post$yprod,
x.post, rho=rho_trimmean, method="pickands")
res.pick.3<-dfs_pick(post$xinput, post$yprod, x.post,
rho=rho_trimmean, k=best_kn.3)
# Representation
plot(yprod~xinput, data=post, col="grey", xlab="Quantity of labor",
ylab="Volume of delivered mail")
lines(x.post, res.pick.2[,1], lty=1, lwd=2, col="cyan")
lines(x.post, res.pick.2[,2], lty=3, lwd=4, col="magenta")
lines(x.post, res.pick.2[,3], lty=3, lwd=4, col="magenta")
plot(yprod~xinput, data=post, col="grey", xlab="Quantity of labor",
ylab="Volume of delivered mail")
lines(x.post, res.pick.3[,1], lty=1, lwd=2, col="cyan")
lines(x.post, res.pick.3[,2], lty=3, lwd=4, col="magenta")
lines(x.post, res.pick.3[,3], lty=3, lwd=4, col="magenta")
}
Run the code above in your browser using DataLab