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 |
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:
|
sep |
Character. The |
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:
-
coef
- The estimated regression coefficients. -
exp(coef)
- The exponentiated coefficients (hazard ratios). -
se(coef)
- The standard errors of the estimated coefficients. -
z
- The z-statistics for testing the significance of the coefficients. -
p
- The p-values associated with the coefficients. (hidden).correlation - Correlation coefficients of the data.
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)