leaspy.algo.simulate.simulate#
Classes#
Enum for different types of visit simulations. |
|
SimulationAlgorithm class for simulating longitudinal data using a Leaspy model. |
Module Contents#
- class VisitType[source]#
-
Enum for different types of visit simulations.
- Attributes:
- DATAFRAME = 'dataframe'#
- RANDOM = 'random'#
- class SimulationAlgorithm(settings)[source]#
Bases:
leaspy.algo.simulate.base.BaseSimulationAlgorithmSimulationAlgorithm class for simulating longitudinal data using a Leaspy model. This class extends the BaseSimulationAlgorithm and implements the simulation logic based on the provided model and settings.
- Attributes:
- name
str The name of the algorithm.
- family
AlgorithmType The type of algorithm, which is AlgorithmType.SIMULATE.
- PARAM_REQUIREMENTS
dict A dictionary defining the required parameters for different visit types. It specifies the expected types and constraints for each parameter.
- for visit_type “dataframe”:
- ‘df_visits’:
pandas.DataFrame DataFrame of visits, with a column “ID” and a column ‘TIME’. TIME and number of visits for each simulated patients (with specified ID) are given by a dataframe in dict_param.
- ‘df_visits’:
- for visit_type “random”:
- ‘patient_number’:
int Number of patients.
- ‘patient_number’:
- ‘first_visit_mean’:
float Mean of the first visit TIME.
- ‘first_visit_mean’:
- ‘first_visit_std’:
float Standard deviation of the first visit TIME.
- ‘first_visit_std’:
- ‘time_follow_up_mean’:
float Mean of the follow-up TIME.
- ‘time_follow_up_mean’:
- ‘time_follow_up_std’:
float Standard deviation of the follow-up TIME.
- ‘time_follow_up_std’:
- ‘distance_visit_mean’:
float Mean interval between two visits.
- ‘distance_visit_mean’:
- ‘distance_visit_std’:
float - Standard deviation of the intervals between visits.
Time interval between 2 visits is drawn in a normal distribution N(distance_visit_mean, distance_visit_std), thus setting distance_visit_std to 0 enable to simulate regularly spaced visits.
- ‘distance_visit_std’:
- ‘min_spacing_between_visits’:
float Minimum interval between two visits. This interval has to be in the same unit as the TIME column. If two visits are closer than this value, the second visit will be removed from the dataset. This is used to avoid too close visits in the simulated dataset. Default is 1/365 (1 day).
- ‘min_spacing_between_visits’:
- name
- Parameters:
settings (AlgorithmSettings)
- family: AlgorithmType#
- features#
- visit_type#
- verbose_warnings#