marcox {marcox}R Documentation

Analysis for Cox Proportional Hazards Models

Description

This function performs marcox analysis for Cox proportional hazards models, incorporating clustered data and handling time-dependent covariates. It estimates coefficients, standard errors, and p-values based on the specified formula and dataset.

Usage

marcox(
  formula,
  data,
  method = "exchangeable",
  sep = NULL,
  col_id = "id",
  div = NULL,
  k_value = 1,
  plot_x = NULL,
  x_axis = "Time",
  y_axis = "Survival Rates",
  size = 0.5
)

Arguments

formula

A model formula that uses the Surv() function to define the survival outcome. It should include both continuous and categorical covariates, where categorical variables must be specified using the factormar() function.

data

The file path or the dataset(matrix) to be analyzed. If a file path is provided, the file will be loaded into a matrix. The file should be in a tabular format (e.g., .csv, .txt).

method

The method employed to solve the correlation coefficient:

  • Exchangeable correlation structure: method = 'exchangeable'

  • Autoregressive(AR-1): method = 'ar1'

  • K-dependent: method = 'kdependent'

  • Toeplitz: method = 'toeplitz'

  • Independent: method = 'independent'

sep

Character. The sep parameter specifies the character that separates the fields in each line of the file. For instance, for a comma-separated file, set sep = ",", and for a tab-separated file, set sep = "\t".

col_id

Character. The name of column that identifies the clusters.

div

Integer. The number of observation points per sample. If provided, the data will be divided accordingly. If the data has complex observational situations, please preprocess the data before using this function.

k_value

The k value only for k-dependent structure. The default value is 1.

plot_x

A character string specifying the column name of the covariate for which survival curves are generated; if not provided, no survival curves will be produced.

x_axis

A character string specifying the title for the x-axis.

y_axis

A character string specifying the title for the y-axis.

size

The size of the generated survival curve.

Details

The marcox() function is specifically designed for survival data analysis using Cox proportional hazards models. It handles both clustered and time-dependent covariates effectively. The survival outcome must be defined using the Surv() function in the model formula, and covariates can be included directly or by converting categorical variables with the factormar() function.

Value

A list containing the following components:

Examples

  formula <- Surv(time, cens) ~ sex + factormar('type', d_v=c(1,2,3))
  r <- marcox(formula, data = kidney_data, div = 2, method = 'exchangeable', plot_x = 'sex')
  print(r)
  print(r$plot)

[Package marcox version 1.0.0 Index]