Skip to content
/ pySFA Public

A Python Package for Stochastic Frontier Analysis (pySFA)

License

Notifications You must be signed in to change notification settings

gEAPA/pySFA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stochastic Frontier Analysis (SFA)

Installation

The pySFA package is now avaiable on PyPI and the latest development version can be installed from the Github repository pySFA. Please feel free to download and test it. We welcome any bug reports and feedback.

PyPI PyPI versionPyPI downloads

pip install pysfa

GitHub

pip install -U git+https://github.com/gEAPA/pySFA

Authors

  • Sheng Dai, PhD, Turku School of Economics, University of Turku, Finland.
  • Zhiqiang Liao, Doctoral Researcher, Aalto University School of Business, Finland.

Demo: Estimating a production function by pySFA

import numpy as np
import pandas as pd
from pysfa import SFA
from pysfa.dataset import load_Tim_Coelli_frontier


# import the data from Tim Coelli Frontier 4.1
df = load_Tim_Coelli_frontier(x_select=['labour', 'capital'],
                              y_select=['output'])
y = np.log(df.y)
x = np.log(df.x)

# Estimate SFA model
res = SFA.SFA(y, x, fun=SFA.FUN_PROD, method=SFA.TE_teJ)
res.optimize()

# print estimates
print(res.get_beta())
print(res.get_residuals())

# print estimated parameters
print(res.get_lambda())
print(res.get_sigma2())
print(res.get_sigmau2())
print(res.get_sigmav2())

# print statistics
print(res.get_pvalue())
print(res.get_tvalue())
print(res.get_std_err())

# OR print summary
print(res.summary())

# print TE
print(res.get_technical_efficiency())