tick.survival.
SimuCoxReg
(coeffs: numpy.ndarray, features: numpy.ndarray = None, n_samples: int = 200, times_distribution: str = 'weibull', shape: float = 1.0, scale: float = 1.0, censoring_factor: float = 2.0, features_type: str = 'cov_toeplitz', cov_corr: float = 0.5, features_scaling: str = 'none', seed: int = None, verbose: bool = True, dtype='float64')[source]¶Simulation of a Cox regression for proportional hazards
coeffs : numpy.ndarray
, shape=(n_coeffs,)
The array of coefficients of the model
features : numpy.ndarray
, shape=(n_samples, n_features), default=`None`
The features matrix to use. If None, it is simulated
n_samples : int
, default=200
Number of samples
times_distribution : str
, default=”weibull”
The distrubution of times. Only
"weibull"
is implemented for now
scale : float
, default=1.0
Scaling parameter to use in the distribution of times
shape : float
, default=1.0
Shape parameter to use in the distribution of times
censoring_factor : float
, default=2.0
Level of censoring. Increasing censoring_factor leads to less censored times and conversely.
features_type : str
, default=”cov_toeplitz”
The type of features matrix to simulate
If
"cov_toeplitz"
: a Gaussian distribution with Toeplitz correlation matrixIf
"cov_uniform"
: a Gaussian distribution with correlation matrix given by O.5 * (U + U.T), where U is uniform on [0, 1] and diagonal filled with ones.
cov_corr : float
, default=0.5
Correlation to use in the Toeplitz correlation matrix
features_scaling : str
, default=”none”
The way the features matrix is scaled after simulation
If
"standard"
: the columns are centered and normalizedIf
"min-max"
: remove the minimum and divide by max-minIf
"norm"
: the columns are normalized but not centeredIf
"none"
: nothing is done to the features
seed : int
, default=None
The seed of the random number generator. If
None
it is not seeded
verbose : bool
, default=True
If True, print things
features : numpy.ndarray
, shape=(n_samples, n_features)
The simulated (or given) features matrix
times : numpy.ndarray
, shape=(n_samples,)
Simulated times
censoring : numpy.ndarray
, shape=(n_samples,)
Simulated censoring indicator, where
censoring[i] == 1
indicates that the time of the i-th individual is a failure time, and wherecensoring[i] == 0
means that the time of the i-th individual is a censoring time
time_start : str
Start date of the simulation
time_elapsed : int
Duration of the simulation, in seconds
time_end : str
End date of the simulation
dtype : {'float64', 'float32'}
, default=’float64’
Type of the generated arrays. Used in the case features is None
Notes
There is no intercept in this model
__init__
(coeffs: numpy.ndarray, features: numpy.ndarray = None, n_samples: int = 200, times_distribution: str = 'weibull', shape: float = 1.0, scale: float = 1.0, censoring_factor: float = 2.0, features_type: str = 'cov_toeplitz', cov_corr: float = 0.5, features_scaling: str = 'none', seed: int = None, verbose: bool = True, dtype='float64')[source]¶Initialize self. See help(type(self)) for accurate signature.
simulate
()[source]¶Launch simulation of the data
features : numpy.ndarray
, shape=(n_samples, n_features)
The simulated (or given) features matrix
times : numpy.ndarray
, shape=(n_samples,)
Simulated times
censoring : numpy.ndarray
, shape=(n_samples,)
Simulated censoring indicator, where
censoring[i] == 1
indicates that the time of the i-th individual is a failure time, and wherecensoring[i] == 0
means that the time of the i-th individual is a censoring time
tick.survival.SimuCoxReg
¶