
# Example from the book by Coelli et al.
# d <- read.csv("c:/0work/rpack/front41Data.csv", header = TRUE, sep = ",")
# x <- cbind(log(d$capital), log(d$labour))
# y <- matrix(log(d$output))
n <- 50
x1 <- 1:50 + rnorm(50,0,10)
x2 <- 100 + rnorm(50,0,10)
x <- cbind(x1,x2)
y <- 0.5 + 1.5*x1 + 2*x2 + rnorm(n,0,1) - pmax(0,rnorm(n,0,1))
sfa(x,y)
summary(sfa(x,y))
# Estimate efficiency for each unit
o <- sfa(x,y)
te <- te.sfa(o)
te1 <- te1.sfa(o)
te2 <- te2.sfa(o)
cbind(te,te1,te2)[1:10,]
# Detailed calculations with out the method te.sfa
e <- o$residuals # Residuals
residuals(o)[1:10] # or
sigma2.sfa(o) # Estimated varians
lambda.sfa(o) # Estimated lambda
Run the code above in your browser using DataLab