tisane.design.Design¶
- class tisane.design.Design(dv, ivs, source=None)¶
Bases:
object
Represents your study design
- Parameters
dv (AbstractVariable) – The dependent variable.
ivs (List[AbstractVariable]) – A list of the independent variable(s).
source (os.PathLike or pd.DataFrame, optional) – For internal use only.
- graph¶
The underlying graph representation of the variables in the design.
- Type
Graph
- dataset¶
The data for your study, if you have any.
- Type
Dataset
- dv¶
The dependent variable in the study design
- Type
- ivs¶
The independent variable(s), if any, in your study design
- Type
List[AbstractVariable]
Methods
assign_data
(source)Associate this study design with a dataset
set_dv
(dv)get_data
get_data_for_variable
get_design_vis
has_data
visualize_design
- assign_data(source)¶
Associate this study design with a dataset
Assigning data to the study design allows Tisane to perform some additional checks on your study design and variables, and ensures that everything makes sense.
It is optional to specify cardinality for variables, and the Design will automatically calculate the cardinality using the data.
When cardinality is specified, the Design will check to make sure that the cardinality of the variable and the cardinality in the data make sense.
- Parameters
source (os.PathLike or pandas.DataFrame) – How to get the data. This can be a string containing a path, such as “path/to/my/data.csv”, or some kind of path object, or simply a Pandas DataFrame. If it is a path, it must be a csv file.
- Returns
A reference to the object this was called on
- Return type
Examples
Our data is in a csv file called “rats_data.csv”.
>>> import tisane as ts >>> rat = ts.Unit("rat_id") >>> week = ts.SetUp("week_number") >>> weight = rat.numeric("rat_weight", number_of_instances=week) >>> exercise_condition = rat.nominal("exercise_condition") >>> design = ts.Design(ivs=[exercise_condition], dv=weight).assign_data("rats_data.csv")
Suppose instead we have a pandas DataFrame called rats_df.
>>> design = ts.Design(ivs=[exercise_condition], dv=weight).assign_data(rats_df)