selbal: Looks for a highly-associated balance with a response...

View source: R/Selbal_Functions.R

selbalR Documentation

Looks for a highly-associated balance with a response variable

Description

Looks for a highly-associated balance with a response variable

Usage

selbal(x, y, th.imp = 0, covar = NULL, logit.acc = "AUC", logt = T,
  col = c("steelblue1", "tomato1"), tab = T, draw = T,
  maxV = 1e+10, zero.rep = "bayes")

Arguments

x

a matrix object with the information of variables (columns) for each sample (rows).

y

the response variable, either continuous or dichotomous.

th.imp

a numeric value indicating the minimum increment required in the association parameter between two consecutive steps in order to continue with the variable addition into the balance.

covar

data.frame with the variables to adjust for (columns).

logit.acc

when y is dichotomous, the measure to compute for the correlation between y and the proposed balance adjusting for covariates. One of the following values: "AUC" (default), "Dev", "Rsq" or "Tjur".

logt

logical value determining if x needs a log-transformation. TRUE if x contains raw counts or proportions.

col

vector of two colours for differentiate the variables appearing in the numerator and in the denominator of the balances.

tab

logical value. It specifies if a table with the variables included in the balance (ordered) and the evolution of the association parameter is demanded.

draw

logical value to concretif a plot with the balance value and the response variable is desired.

maxV

numeric value defining the maximum number of variables composing the balance. Default 1e10 to give prevalence to th.imp parameter.

zero.rep

a value defining the method to use for zero - replacement. "bayes" for BM-replacement or "one" to add one read tho each cell of the matrix.

opt.cri

parameter for selecting the method to determine the optimal number of variables. "max" to define this number as the number of variables which maximizes the association value or "1se" to take also the standard error into account.

Value

A list with the following objects:

  • FINAL.BAL the numeric values of the selected balance for each sample.

  • POS a vector with the variables appearing in the numerator of the balance.

  • NEG a vector with the variables appearing in the denominator of the balance.

  • INC.VAR a vector with both POS and NUM variables (included variables).

  • ACC.Bal a vector with the association value after each step of the algorithm.

  • EVOL a data.frame with the variables sorted as they have been added into the balance with the corresponding association value after their inclusion. Only returned if tab is TRUE.

  • FINAL.P the graphical representation of the results. Only showed if draw = T.

  • FIT.Final the regression model taking covariates and the final balance as the explanatory variables and y as the response variable.

Examples

# Load data set
  load("HIV.rda")
# Define x and y
  x <- HIV[,1:60]
  y <- HIV[,62]
# Run the algorithm
  Bal <- selbal(x,y)

malucalle/selbal documentation built on May 31, 2024, 2:36 p.m.