nl_causal.base.sim_dataď
Module Contentsď
Functionsď
|
Simulate data for the nonlinear causal IV model (see [1]). |
|
Apply a transformation to the input based on the specified case. |
|
Print message-box with optional title. |
- nl_causal.base.sim_data.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
- nl_causal.base.sim_data.sim_phi(X, case='linear')ď
Apply a transformation to the input based on the specified case.
- Parameters:
- Xarray_like
Input data to be transformed.
- casestr, optional
Type of transformation to be applied (default is âlinearâ). Supported cases are: âlinearâ, âlogâ, âcube-rootâ, âinverseâ, âsigmoidâ, and âpiecewise_linearâ.
- Returns:
- array_like
The transformed data based on the specified case.
- nl_causal.base.sim_data.print_msg_box(msg, indent=1, width=None, title=None)ď
Print message-box with optional title.