outcome.predictor.var: Builds a black list of predictor and/or outcome variable

Description Usage Arguments Value Author(s) References Examples

View source: R/outcome.predictor.var.R

Description

This function receives a data set, an outcome/predictor variable, the type of variable and a black list. If this variable is classfied as type outcome the function builds a black list from it to all other variable. If it is classified as type predictor builds a list from all other variables to it. You can pass a previously black list and then this function will append a new list in the end of it.

Usage

1
outcome.predictor.var(data.to.work, var.name, type.var, black.list)

Arguments

data.to.work

is a data set containing the variables to build a list.

var.name

is the outcome/predictor variable name.

type.var

is a type of variable: <o>utcome or <p>redictor.

black.list

is a previous black list, it would be empty or loaded.

Value

a black list with from - to variables

Author(s)

Elias Carvalho

References

KATZ, M H. Multivariable analysis: a primer for readers of medical research. Annals of internal medicine, v. 138, n. 8, p. 644-650, 2003.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Clean environment
closeAllConnections()
rm(list=ls())
# Set enviroment
# setwd("To your working directory")
# Load packages
library(bnpa)
library(bnlearn)
# Load data sets from package
data(dataQuantC)
# Show first lines
head(dataQuantC)
# Create an empty list or fill it before start
black.list <- ""
# Setting the type of var as typical "outcome" what means it will not point to any var
type.var <- "o"
# Setting variable "A" as "outcome" will create a black from this variable to all others
var.name <- "A"
# Creating the black list
black.list <- outcome.predictor.var(dataQuantC, var.name, type.var, black.list)
black.list
# Setting the type of var as typical "predictor" it will not be pointed from any other var
type.var <- "p"
# Setting variable "D" as "predictor" will create a blacklist from all others to it
var.name <- "D"
# Creating the black list
black.list <- outcome.predictor.var(dataQuantC, var.name, type.var, black.list)
black.list

bnpa documentation built on Aug. 2, 2019, 1:05 a.m.