When conducting independence tests among the variables, some exhibit significant correlations, yet the VIF analysis indicates no multicollinearity. Is this common, and what implications does it hold regarding the inclusion of these variables in the model?
> coxph_model <- coxph(Surv(time, death_event) ~ . , data = dataset, x = TRUE)
> coxph_model
Call:
coxph(formula = Surv(time, death_event) ~ ., data = dataset,
x = TRUE)
coef exp(coef) se(coef) z p
age 0.0415451 1.0424201 0.0086897 4.781 1.74e-06
anaemia1 0.3701085 1.4478917 0.2162295 1.712 0.08696
creatinine_phosphokinase 0.0002041 1.0002041 0.0001010 2.020 0.04335
high_blood_pressure1 0.4727181 1.6043490 0.2154819 2.194 0.02825
serum_creatinine 0.2469241 1.2800819 0.0591050 4.178 2.94e-05
serum_sodium -0.0680724 0.9341929 0.0208784 -3.260 0.00111
Likelihood ratio test=56.81 on 6 df, p=1.993e-10
n= 299, number of events= 96
> vif(coxph_model)
age anaemia creatinine_phosphokinase high_blood_pressure
1.007217 1.107797 1.067104 1.054431
serum_creatinine serum_sodium
1.059929 1.056776
Warning message:
In vif.default(coxph_model) : No intercept: vifs may not be sensible.
> # Define the variables for ANOVA
> continuous_variabless <- c("age", "creatinine_phosphokinase", "serum_creatinine", "serum_sodium")
>
> # Loop through each continuous variable and perform ANOVA
> for (continuous_var in continuous_vars) {
+ for (categorical_var in categorical_vars) {
+ # Create a formula for ANOVA
+ formula <- as.formula(paste(continuous_var, "~", categorical_var))
+
+ # Perform ANOVA
+ anova_result <- Anova(lm(formula, data = dataset))
+
+ # Print ANOVA results
+ print(paste("ANOVA for", continuous_var, "and", categorical_var))
+ print(anova_result)
+ }
+ }
[1] "ANOVA for creatinine_phosphokinase and anaemia"
Anova Table (Type II tests)
Response: creatinine_phosphokinase
Sum Sq Df F value Pr(>F)
anaemia 10207179 1 11.213 0.0009168 ***
Residuals 270347475 297
```