# Stochastic Frontier Analysis (SFA)
## Installation
The [`pySFA`](https://pypi.org/project/pysfa/) package is now avaiable on PyPI and the latest development version can be installed from the Github repository [`pySFA`](https://github.com/gEAPA/pySFA). Please feel free to download and test it. We welcome any bug reports and feedback.
#### PyPI [![PyPI version](https://img.shields.io/pypi/v/pysfa.svg?maxAge=3600)](https://pypi.org/project/pysfa/)[![PyPI downloads](https://img.shields.io/pypi/dm/pysfa.svg?maxAge=21600)](https://pypistats.org/packages/pysfa)
pip install pysfa
#### GitHub
pip install -U git+https://github.com/gEAPA/pySFA
## Authors
- [Sheng Dai](https://daisheng.io), PhD, Turku School of Economics, University of Turku, Finland.
- [Zhiqiang Liao](https://liaozhiqiang.com), Doctoral Researcher, Aalto University School of Business, Finland.
## Demo: Estimating a production function by `pySFA`
```python
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())
```
Raw data
{
"_id": null,
"home_page": "https://github.com/gEAPA/pySFA",
"name": "pysfa",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "SFA,MLE,TE",
"author": "Sheng Dai, Zhiqiang Liao",
"author_email": "sheng.dai@utu.fi",
"download_url": "https://files.pythonhosted.org/packages/77/a3/0bae4b30b7b5b216bc3c3e1088146f69b8efab261e452480674bf1417c51/pysfa-0.8.tar.gz",
"platform": null,
"description": "# Stochastic Frontier Analysis (SFA)\n\n## Installation\n\nThe [`pySFA`](https://pypi.org/project/pysfa/) package is now avaiable on PyPI and the latest development version can be installed from the Github repository [`pySFA`](https://github.com/gEAPA/pySFA). Please feel free to download and test it. We welcome any bug reports and feedback.\n\n#### PyPI [![PyPI version](https://img.shields.io/pypi/v/pysfa.svg?maxAge=3600)](https://pypi.org/project/pysfa/)[![PyPI downloads](https://img.shields.io/pypi/dm/pysfa.svg?maxAge=21600)](https://pypistats.org/packages/pysfa)\n\n pip install pysfa\n\n#### GitHub\n\n pip install -U git+https://github.com/gEAPA/pySFA\n\n## Authors\n\n- [Sheng Dai](https://daisheng.io), PhD, Turku School of Economics, University of Turku, Finland.\n- [Zhiqiang Liao](https://liaozhiqiang.com), Doctoral Researcher, Aalto University School of Business, Finland.\n\n## Demo: Estimating a production function by `pySFA`\n\n```python\nimport numpy as np\nimport pandas as pd\nfrom pysfa import SFA\nfrom pysfa.dataset import load_Tim_Coelli_frontier\n\n\n# import the data from Tim Coelli Frontier 4.1\ndf = load_Tim_Coelli_frontier(x_select=['labour', 'capital'],\n y_select=['output'])\ny = np.log(df.y)\nx = np.log(df.x)\n\n# Estimate SFA model\nres = SFA.SFA(y, x, fun=SFA.FUN_PROD, method=SFA.TE_teJ)\nres.optimize()\n# print estimates\nprint(res.get_beta())\nprint(res.get_residuals())\n\n# print estimated parameters\nprint(res.get_lambda())\nprint(res.get_sigma2())\nprint(res.get_sigmau2())\nprint(res.get_sigmav2())\n\n# print statistics\nprint(res.get_pvalue())\nprint(res.get_tvalue())\nprint(res.get_std_err())\n\n# OR print summary\nprint(res.summary())\n\n# print TE\nprint(res.get_technical_efficiency())\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python Package for Stochastic Frontier Analysis",
"version": "0.8",
"project_urls": {
"Download": "https://pypi.org/project/pysfa/",
"Homepage": "https://github.com/gEAPA/pySFA"
},
"split_keywords": [
"sfa",
"mle",
"te"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3f8f0b200061d4502344efb9a058935045b3af87a2ec95189618ebf514a59ebc",
"md5": "febc0c6d9e6b1fb2f1b8065f9fd25160",
"sha256": "c1465042bb6cdee06d1dbd77789239f4f929cf86917dae1cdf7a47979e8460e5"
},
"downloads": -1,
"filename": "pysfa-0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "febc0c6d9e6b1fb2f1b8065f9fd25160",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9797,
"upload_time": "2023-05-14T17:37:06",
"upload_time_iso_8601": "2023-05-14T17:37:06.821195Z",
"url": "https://files.pythonhosted.org/packages/3f/8f/0b200061d4502344efb9a058935045b3af87a2ec95189618ebf514a59ebc/pysfa-0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "77a30bae4b30b7b5b216bc3c3e1088146f69b8efab261e452480674bf1417c51",
"md5": "51dfada59f8a23c9b2c5339ca02c7a08",
"sha256": "2bef85a409513695463e95c83a7477b77ee8ed95bddcc123e1332c4966d914c4"
},
"downloads": -1,
"filename": "pysfa-0.8.tar.gz",
"has_sig": false,
"md5_digest": "51dfada59f8a23c9b2c5339ca02c7a08",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9914,
"upload_time": "2023-05-14T17:37:08",
"upload_time_iso_8601": "2023-05-14T17:37:08.475854Z",
"url": "https://files.pythonhosted.org/packages/77/a3/0bae4b30b7b5b216bc3c3e1088146f69b8efab261e452480674bf1417c51/pysfa-0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-14 17:37:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gEAPA",
"github_project": "pySFA",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pysfa"
}