nl_causal.baseļ
Package Contentsļ
Classesļ
negative log uniform distribution |
Functionsļ
|
Remove multicollinearity features. |
|
Simulate data for the nonlinear causal IV model (see [1]). |
- nl_causal.base.calculate_vif_(X, thresh=2.5, verbose=0, method='best')ļ
Remove multicollinearity features.
- Parameters:
- X: {array-like, sparse matrix} of shape (n_samples, n_features)
Feature matrix
- Returns:
- X: return feature matrix by removing multicollinearity features.
- class nl_causal.base.neg_log_uniform(momtype=1, a=None, b=None, xtol=1e-14, badvalue=None, name=None, longname=None, shapes=None, seed=None)ļ
Bases:
scipy.stats.rv_continuousnegative log uniform distribution
- _cdf(x)ļ
cdf of the negative log uniform distribution
- nl_causal.base.sim(n, p, theta0, beta0, alpha0=0.0, case='log', feat='normal', IoR=None)ļ
Simulate data for the nonlinear causal IV model (see [1]).
- Parameters:
- nint
Number of samples.
- pint
Number of features (IVs).
- theta0array_like
True coefficients for the IVs to exposure.
- beta0float
True coefficient for the causal effect from exposure to outcome.
- alpha0float, optional
True coefficients for invalid IVs (default is 0.).
- casestr, optional
Type of nonlinear causal transformation (ālinearā, ālogā, ācube-rootā, āinverseā, āsigmoidā, āpiecewise_linearā), (default is ālogā).
- featstr, optional
Type of feature distribution (ānormalā, āAP-normalā, ālaplaceā, āuniformā, ācateā). (default is ānormalā).
- IoRarray_like or None, optional
The region of interest (default is None): checking the nonlinear causal transformation.
- Returns:
- Z{array-like} of shape (n, p)
n simluated data of IVs.
- X{array-like} of shape (n, )
n simluated data of exposure.
- y{array-like} of shape (n, )
n simluated data of outcome.
- phi{array-like} of shape (n, )
transformed exposure based on the transformation case.
- phi_ior{array-like} of shape (n, ) (if IoR is not None)
transformed region of intere (IoR) based on the transformation case.
References