# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['tisane', 'tisane.gui']

package_data = \
{'': ['*'], 'tisane.gui': ['assets/*', 'example_inputs/*']}

install_requires = \
['Flask>=1.1.2,<2.0.0',
 'Sphinx>=4.1.2,<5.0.0',
 'coverage>=5.5,<6.0',
 'dash-bootstrap-components>=0.12.0,<0.13.0',
 'dash-daq>=0.5.0,<0.6.0',
 'dash>=1.20.0,<2.0.0',
 'h5>=0.4.1,<0.5.0',
 'h5py==3.3.0',
 'ipykernel>=6.3.1,<7.0.0',
 'jupyter-dash>=0.4.0,<0.5.0',
 'jupyter>=1.0.0,<2.0.0',
 'more-itertools>=8.7.0,<9.0.0',
 'networkx>=2.5.1,<3.0.0',
 'numpydoc>=1.1.0,<2.0.0',
 'pandas>=1.1.0,<2.0.0',
 'patsy>=0.5.1,<0.6.0',
 'plotly>=4.14.3,<5.0.0',
 'pydata-sphinx-theme>=0.6.3,<0.7.0',
 'pydot>=1.4.2,<2.0.0',
 'pymer4>=0.7.5,<0.8.0',
 'pytest-cov>=2.11.1,<3.0.0',
 'pytest>=6.2.4,<7.0.0',
 'sphinx-autoapi>=1.8.4,<2.0.0',
 'statsmodels>=0.12.2,<0.13.0',
 'toml>=0.10.2,<0.11.0',
 'tweedie>=0.0.7,<0.0.8']

setup_kwargs = {
    'name': 'tisane',
    'version': '0.1.0',
    'description': '',
    'long_description': '# tisane\nTisane: Authoring Statistical Models via Formal Reasoning from Conceptual and Data Relationships\n\n**TL;DR:** Analysts can use Tisane to author generalized linear models with or without mixed effects. Tisane infers statistical models from variable relationships (from domain knowledge) that analysts specify. By doing so, Tisane helps analysts avoid common threats to external and statistical conclusion validity. Analysts do not need to be statistical experts! \n\n[Jump to see a tutorial here](TUTORIAL.md) or [see some examples here.](EXAMPLES.md) Below, we provide an overview of the API and language primitives. \n\n----\n\nTisane provides (i) a graph specification language for expressing relationships between variables and (ii) an interactive query and compilation process for inferring a valid statistical model from a set of variables in the graph.\n\n## Graph specification language\n### Variables\nThere are three types of variables: (i) Units, (ii) Measures, and (iii) SetUp, or environmental, variables. \n- ``Unit`` types represent entities that are observed (``observed units`` in the experimental design literature) or the recipients of experimental conditions (``experimental units``). \n\n```\n# There are 386 adults participating in a study on weight loss.\nadult = ts.Unit("member", cardinality=386)\n```\n\n- ``Measure`` types represent attributes of units that are proxies of underlying constructs. Measures can have one of the following data types: numeric, nominal, or ordinal. Numeric measures have values that lie on an interval or ratio scale. Nominal measures are categorical variables without an ordering between categories. Ordinal measures are categorical variables with an ordering between categories. \n\n```\n# Adults have motivation levels.\nmotivation_level = adult.ordinal("motivation", order=[1, 2, 3, 4, 5, 6])\n# Adults have pounds lost. \npounds_lost = adult.numeric("pounds_lost")\n# Adults have one of four racial identities in this study. \nrace = adult.nominal("race group", cardinality=4)\n```\n\n- ``SetUp`` types represent study or experimental settings that are global and unrelated to any of the units involved. For example, time is often an environmental variable that differentiates repeated measures but is neither a unit nor a measure. \n\n\n```\n# Researchers collected 12 weeks of data in this study. \nweek = ts.SetUp("Week", order=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n```\n\nDesign rationale: We derived this type system from how other software tools focused on study design separate their concerns.\n\n### Relationships between variables\nAnalysts can use Tisane to express (i) conceptual and (ii) data measurement relationships between variables.\n\nThere are three different types of conceptual relationships.\n- A variable can *cause* another variable. (e.g., ``motivation_level.causes(pounds_lost)``)\n- A variable can be *associated with* another variable. (e.g., ``race.associates_with(pounds_lost)``)\n- One or more variables can *moderate* the effect of a variable on another variable.  (e.g., ``age.moderates(moderator=[motivation_level], on=pounds_lost)``)\nCurrently, a variable, V1, can have a moderated relationship with a variable, V2, without also having a causal or associative relationship with V2.\n\n<!-- > FEEDBACK REQUESTED: Should this be the case? Initially, I though that moderation (which is later translated into an interaction effect) is another way/type of how two variables relate. At the same time, if V1 has a moderated effec on V2, it is implied that V1 has some kind of associative relationship with V2.  -->\n\nThese relationships are used to construct an internal graph representation of variables and their relationships with one another.\n\nInternally, Tisane constructs a graph representing these relationships. Graph representation is useufl for inferring statistical models (next section). \n\nFor example, the below graph represents the above relationships. Rectangular nodes are units. Elliptical nodes are measures and set-up variables. The colored node is the dependent variable in the query.The dotted edges connect units to their measures. The solid edges represent conceptual relationships, as labeled. \n![A graph representation created using DOT](examples/readme_dot_graph.png?raw=true)\n\n![A graph representation created using TikZ](examples/readme_graph_tikz.png?raw=true)\n\n## Interactive query and compilation \nAnalysts query the relationships they have specified (technically, the internal graph represenation) for a statistical model. For each query, analysts must specify (i) a dependent variable to explain using (ii) a set of independent variables. \n\n```\ndesign = ts.Design(dv=pounds_lost, ivs=[treatment_approach, motivation_level]).assign_data(df)\nts.infer_statistical_model_from_design(design=design)\n```\n\n*Query validation:* To be a valid query, Tisane verifies that the dependent variable does not cause an independent variable. It would be conceptually incorrect to explain a cause from an effect. \n\n### Interaction model \nA key aspect of Tisane that distinguishes it from other systems, such as [Tea](tea-lang.org/), is the importance of user interaction in guiding the statistical model that is inferred as output and ultimately fit. \n\nTisane generates a space of candidate statistical models and asks analysts disambiguation questions for (i) including additional main or interaction effects and, if applicable, correlating (or uncorrelating) random slopes and random intercepts as well as (ii) selecting among viable family/link function pairs.\n\nTo help analysts, Tisane provides text explanations and visualizations. For example, to show possible family functions, Tisane simulates data to fit a family function and visualizes it on top of a histogram of the analyst\'s data and explains to the how to use the visualization to compare family functions. \n\n### Statistical model inference\nAfter validating a query, Tisane traverses the internal graph representation in order to generate candidate generalized linear models with or without mixed effects. A generalized linear model consists of a model effects structure and a family/link function pair. \n\n\n## Query\nAnalysts query the relationships they have specified (technically, the internal graph represenation) for a statistical model. For each query, analysts must specify (i) a dependent variable to explain using (ii) a set of independent variables.\n\nQuery validation: To be a valid query, Tisane verifies that the dependent variable does not cause an independent variable. It would be conceptually incorrect to explain a cause from an effect.\n\n## Statistical model inference\nAfter validating a query, Tisane traverses the internal graph representation in order to generate candidate generalized linear models with or without mixed effects. A generalized linear model consists of a model effects structure and a family/link function pair.\n\n### Model effects structure\n<!-- generate possible statistical model effects structures and family/link functions.  -->\nTisane generates candidate main effects, interaction effects, and, if applicable, random effects based on analysts\' expressed relationships.\n\n- Tisane aims to direct analysts\' attention to variables, especially possible confounders, that the analyst may have overlooked. When generating main effects candidates, Tisane looks for other variables in the graph that may exert causal influence on the dependent variable and are related to the input independent variables.\n- Tisane aims to represent conceptual relationships between variables accurately. Based on the main effects analysts choose to include in their output statistical model, Tisane suggests interaction effects to include. Tisane relies on the moderate relationships analysts specified in their input program to infer interaction effects.\n- Tisane aims to increase the generalizability of statistical analyses and results by automatically detecting the need for and including random effects. Tisane follows the guidelines outlined in [] and [] to generat the maximal random effects structure.\n\n[INFERENCE.md](tisane/INFERENCE.md) explains all inference rules in greater detail.\n\n### Family/link function\nFamily and link functions depend on the data types of dependent variables and their distributions.\n\nBased on the data type of the dependent variable, Tisane suggests matched pairs of possible family and link functions to consider. Tisane ensures that analysts consider only valid pairs of family and link functions.\n\n<!-- Two aspects: \n- generating the space\n- narrowing the space -->\n\n----\n\n## Limitations\n- **Tisane is designed for researchers or analysts who are domain experts and can accurately express their domain knowledge and data measurement/collection details using the Tisane graph specification language.** We performed an initial evaluation of the expressive coverage of Tisane\'s language and found that it is useful for expressing a breadth of study designs common in HCI. \n\n<!-- Limitation: If user does not include any variables at one level, no random effects will be generated, cross-level interactions included. Is this justifiable? -->\n\n----\n\n## Benefits\n### Tisane helps analysts avoid common threats to statistical conclusion and external validity. \nSpecifically, Tisane helps analysts \n- avoid violations of GLM assumptions by inferring random effects and plausible family and link functions\n- fishing and false discovery due to conceptually incomplete statistical models\n- interaction of the causal relationships with units, interaction of the causal realtionships with settings due to not controlling for the appropriate clusters/non-independence of observations as random effects\n\nThese are four of the 37 threats to validity Shadish, Cook, and Campbell outline across internal, external, statistical conclusion, and construct validity [1]. \n\n---\n\n## Examples\n[Check out examples here!](EXAMPLES.md)\n\n## References \n[1] Cook, T. D., Campbell, D. T., & Shadish, W. (2002). Experimental and quasi-experimental designs for generalized causal inference. Boston, MA: Houghton Mifflin.\n',
    'author': 'Eunice Jun',
    'author_email': 'eunice.m.jun@gmail.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': None,
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.7.11,<4.0.0',
}


setup(**setup_kwargs)
