plotForestMV: Calculates multivariate analysis and creates a forest plot

View source: R/plotForestMV.R

plotForestMVR Documentation

Calculates multivariate analysis and creates a forest plot

Description

Calculates a multivariate analysis, either utilizing all provided variables supplied in the data data.frame (default), using the step function for model selection to obtain variables (selection takes values expected by the direction parameter of step) or retaining only variables which show a likelhood ratio p-value below a supplied cutoff in the univariate analysis. Errors might occur if the graphic devices dimension is too small (foresplot() fails).

Usage

plotForestMV(
  srv,
  data,
  subject = NULL,
  selection = F,
  title = "",
  col = c("royalblue", "darkblue", "royalblue"),
  MDPI = F
)

Arguments

srv

Survival object as created by survival::Surv() function, each observation is linked to one row of the data parameter

data

data.frame containing all variables which will be analyzed. The class of each column determined the type of analysis: numeric cols will be treated as continous variable, factor and character as factors.

subject

vector identifying independent subjects. Does not work with automatic model selection.

title

Plot title

col

Color vector as expected by the forestplot() function

MDPI

adhere to MDPI requirements

Examples

require(survival)
times <- c(100, 87, 96, 20)
status <- c(1,1,0,1)
srv <- Surv(times, status)
data <- data.frame(Surgery=c("yes","yes","no","no"),
		Drug=c("no","yes","yes","yes"),
		Sex=c("M","F","F","F"),
		Age=c(60,65,50,75))
subjectIDs <- c(1,2,3,3)

#Use all variables
#plotForestMV(srv,data)

#Univariate Cutoff of p-val < 0.2
#plotForestMV(srv, data, selection=0.2)

#Automatic modell selection
#plotForestMV(srv, data, selection="both")

#Observatons from the same individual
#plotForestMV(srv, data, subject=subjectIDs)

mknoll/dataAnalysisMisc documentation built on Feb. 4, 2024, 8:16 a.m.