| Name | semopy JSON |
| Version |
2.3.11
JSON |
| download |
| home_page | https://semopy.com |
| Summary | Structural Equation Modeling Optimization in Python. |
| upload_time | 2024-01-04 09:42:10 |
| maintainer | |
| docs_url | None |
| author | Georgy Meshcheryakov |
| requires_python | >=3.7 |
| license | |
| keywords |
|
| VCS |
|
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# semopy
[Visit our website for a detailed introduction](https://semopy.com)
**semopy** is a Python package that includes numerous Structural Equation Modelling (SEM) techniques.
## Features
- Write down a model description in a user-friendly syntax
- Estimate model's parameters using a variety of objective functions
- Estimate models with population structure via random effects
- Restricted Maximum Likelihood
- Integration with gaussian processes/mixture models to tackle huge variety of phenomena
- Calculate numerous statistics and fit indices
- Estimate model's parameters in presence of ordinal variables
- A vast number of settings to fit a researcher's needs
- Fast and accurate
- Automatically create fancy HTML reports
## Installation
**semopy** is available at PyPi and can be installed by typing the following line into terminal:
`pip install semopy`
## Syntax
To specify SEM models, The **semopy** uses the syntax, which is natural to describe regression models in R. The syntax supports three operator symbols characterising relationships between variables:
- ~ to specify structural part,
- =~ to specify measurement part,
- ~~ to specify common variance between variables.
For example, let a linear equation in the structural part of SEM model take the form:
`y = β1 x1 + β2 x2 + ε`
Then, in **semopy** syntax it becomes:
`y ~ x1 + x2`
Parameters β1, β2 are to be estimated by **semopy**. In some cases a user might want to fix some of parameters to particular value. For instance, let's assume that we want β1 to stay equal to 2.0 and we are only interested in estimating β2:
`y ~ 2*x1 + x2`
Likewise, if a latent variable η is explained by manifest variables y1, y2, y3, then in **semopy** syntax it can be written down this way:
`eta =~ y1 + y2 + y3`
## Quickstart
The pipeline for working with SEM models in **semopy** consists of three steps:
1. Specifying a model
2. Loading a dataset.
3. Estimating parameters of the model.
Main object required for scpecifying and estimating an SEM model is `Model`.
`Model` is responsible for setting up a model from the proposed SEM syntax:
~~~
# The first step
from semopy import Model
mod = """ x1 ~ x2 + x3
x3 ~ x2 + eta1
eta1 =~ y1 + y2 + y3
eta1 ~ x1
"""
model = Model(mod)
~~~
Then a dataset should be provided:
~~~
# The second step
from pandas import read_csv
data = read_csv("my_data_file.csv", index_col=0)
~~~
To estimate parameters of the model we run a `fit` method with the dataset as an argument:
~~~
# The third step
model.fit(data)
~~~
The default objective function for estimating parameters is the likelihood function and the optimisation method is SLSQP (Sequential Least-Squares Quadratic Programming). However, the *semopy* supports a wide range of other objective functions and optimisation schemes being specified as parameters in the `fit` method.
Finally, user can `inspect` parameters' estimates:
~~~
model.inspect()
~~~
## Would you like to know more?
Tutorial and overview of **semopy** features are available at the [project's website](https://semopy.com).
## Requirements
**numpy**, **pandas**, **scipy**, **sympy**, **sklearn**, **statmodels**
## Authors
* **Mescheryakov A. Georgy** - *Developer* - [georgy.m](https://gitlab.org/georgy.m) - student, SPbPU
* **Igolkina A. Anna** - *Supervisor* - [iganna](https://github.com/iganna) - Engineer, SPbPU
## License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Raw data
{
"_id": null,
"home_page": "https://semopy.com",
"name": "semopy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Georgy Meshcheryakov",
"author_email": "iam@georgy.top",
"download_url": "https://files.pythonhosted.org/packages/f2/d5/7cd2dcd8d24670f902794695986be856f0fa2bc695484f8746df066c7535/semopy-2.3.11.tar.gz",
"platform": null,
"description": "# semopy\n[Visit our website for a detailed introduction](https://semopy.com)\n\n\n**semopy** is a Python package that includes numerous Structural Equation Modelling (SEM) techniques. \n\n## Features\n - Write down a model description in a user-friendly syntax\n - Estimate model's parameters using a variety of objective functions\n - Estimate models with population structure via random effects\n - Restricted Maximum Likelihood\n - Integration with gaussian processes/mixture models to tackle huge variety of phenomena\n - Calculate numerous statistics and fit indices\n - Estimate model's parameters in presence of ordinal variables\n - A vast number of settings to fit a researcher's needs\n - Fast and accurate\n - Automatically create fancy HTML reports\n\n## Installation\n**semopy** is available at PyPi and can be installed by typing the following line into terminal:\n\n`pip install semopy`\n\n\n## Syntax\nTo specify SEM models, The **semopy** uses the syntax, which is natural to describe regression models in R. The syntax supports three operator symbols characterising relationships between variables:\n\n- ~ to specify structural part,\n- =~ to specify measurement part,\n- ~~ to specify common variance between variables.\n\nFor example, let a linear equation in the structural part of SEM model take the form:\n\n`y = \u03b21 x1 + \u03b22 x2 + \u03b5` \n\nThen, in **semopy** syntax it becomes:\n\n`y ~ x1 + x2`\n\nParameters \u03b21, \u03b22 are to be estimated by **semopy**. In some cases a user might want to fix some of parameters to particular value. For instance, let's assume that we want \u00ce\u00b21 to stay equal to 2.0 and we are only interested in estimating \u03b22:\n\n`y ~ 2*x1 + x2`\n\n\nLikewise, if a latent variable \u00ce\u00b7 is explained by manifest variables y1, y2, y3, then in **semopy** syntax it can be written down this way:\n\n`eta =~ y1 + y2 + y3`\n\n## Quickstart\n\nThe pipeline for working with SEM models in **semopy** consists of three steps:\n1. Specifying a model\n2. Loading a dataset.\n3. Estimating parameters of the model.\n\nMain object required for scpecifying and estimating an SEM model is `Model`.\n\n`Model` is responsible for setting up a model from the proposed SEM syntax:\n~~~\n# The first step\nfrom semopy import Model\nmod = \"\"\" x1 ~ x2 + x3\n x3 ~ x2 + eta1\n eta1 =~ y1 + y2 + y3\n eta1 ~ x1\n \"\"\"\nmodel = Model(mod)\n~~~\nThen a dataset should be provided:\n~~~\n# The second step\nfrom pandas import read_csv\ndata = read_csv(\"my_data_file.csv\", index_col=0)\n~~~\n\n\nTo estimate parameters of the model we run a `fit` method with the dataset as an argument:\n~~~\n# The third step\nmodel.fit(data)\n~~~\n\nThe default objective function for estimating parameters is the likelihood function and the optimisation method is SLSQP (Sequential Least-Squares Quadratic Programming). However, the *semopy* supports a wide range of other objective functions and optimisation schemes being specified as parameters in the `fit` method.\n\nFinally, user can `inspect` parameters' estimates:\n\n~~~\nmodel.inspect()\n~~~\n## Would you like to know more?\nTutorial and overview of **semopy** features are available at the [project's website](https://semopy.com).\n\n## Requirements\n**numpy**, **pandas**, **scipy**, **sympy**, **sklearn**, **statmodels**\n## Authors\n\n* **Mescheryakov A. Georgy** - *Developer* - [georgy.m](https://gitlab.org/georgy.m) - student, SPbPU\n* **Igolkina A. Anna** - *Supervisor* - [iganna](https://github.com/iganna) - Engineer, SPbPU\n\n## License\nThis project is licensed under the MIT License - see the LICENSE.md file for details.\n",
"bugtrack_url": null,
"license": "",
"summary": "Structural Equation Modeling Optimization in Python.",
"version": "2.3.11",
"project_urls": {
"Homepage": "https://semopy.com"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f2d57cd2dcd8d24670f902794695986be856f0fa2bc695484f8746df066c7535",
"md5": "36b37dd779c7c9dec34bc00fb3652bcf",
"sha256": "eb6336f8438f0ea6fcfdceb91d448196c3940827ff11a0948889ce6755895653"
},
"downloads": -1,
"filename": "semopy-2.3.11.tar.gz",
"has_sig": false,
"md5_digest": "36b37dd779c7c9dec34bc00fb3652bcf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 1636397,
"upload_time": "2024-01-04T09:42:10",
"upload_time_iso_8601": "2024-01-04T09:42:10.446500Z",
"url": "https://files.pythonhosted.org/packages/f2/d5/7cd2dcd8d24670f902794695986be856f0fa2bc695484f8746df066c7535/semopy-2.3.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-04 09:42:10",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "semopy"
}