subgroups {zebu} | R Documentation |
Identifies if the local association between variables (named associated variables)
is dependent on the value of an another variable (named interacting variable).
Associated variables are specified by las
. Interacting variable(s)
values are specified by x
.
subgroups( las, x, select, continuous, breaks, default_breaks = 4, thresholds = c(-0.05, 0.05), significance, alpha = 0.01 )
las |
|
x |
data.frame or matrix. Corresponds to interacting variable(s) specified by |
select |
optional vector of column numbers or column names specifying a subset of data to be used.
By default, uses all colnames in |
continuous |
optional vector of column numbers or column names specifying continuous variables that should be discretized. By default, assumes that every variable is categorical. |
breaks |
numeric vector or list passed on to |
default_breaks |
default break points for discretizations.
Same syntax as in |
thresholds |
vector specifying respectively the negative and the positive association threshold. Local association values between these thresholds are considered independent. Values not contained in this range are classified as independent. |
significance |
optional logical value specifying if only non-significant local association
values should be considered as independent.
Only available if |
alpha |
alpha error level. Local association with p-values above this value are considered
as independent. Only available if |
Associated variables events are recoded into a subgroup variable according to local
association values (and eventually significance) into 'positive', 'negative' and 'independent'.
This is specified by the thresholds
, significance
and alpha
arguments.
The local (and global) association between the new subgroup variable
and the interacting variable is then estimated using lassie
.
An instance of S3 class lassie
.
Significance can be accessed using a permutation test: permtest
.
# In this example, we will use the zebu 'trial' dataset. # See vignette example for more detailed explanation # 'trial' corresponds to a simulated clinical trial where patient recovery # is dependent on drug intake ('drug') and resistance status ('resistance'). # Patient recovery is monitored by a biomarker (continuous variable from 0 to 1) # Patients with post-treatment biomarker ('postbiom') above 0.7 is have recovered. # Load 'trial' dataset data(trial) # Compute the association between drug intake and patient recovery las <- lassie(trial, select = c("drug", "postbiom"), continuous = c("postbiom"), breaks = c(0, 0.7, 1)) # Permuation test # Access significance of global and local association las <- permtest(las) # Global association between drug intake and recovery but not for all patients # Being in the drug group is locally independent of having not recovered print(las) # Local association subgroup analysis sub <- subgroups(las, trial, select = "resistance", alpha = 0.01) # Variable 'resistance' explains differences between sensitive and resistance patients print(sub)