1

I am looking for a way to compare the results from two lmRob() functions statistically.

Would that be a possible option for me:

lmrob_female <- robust::lmRob(Y ~ X_binary + covariate1 + covariate2 + covariate3, data = df_original, subset=sex==0)

lmrob_male <- robust::lmRob(Y ~ X_binary + covariate1 + covariate2 + covariate3, data = df_original, subset=sex==1)

predicted_lmrob_female <- predict(lmrob_female) predicted_lmrob_male <- predict(lmrob_male)

predicted_lmrob_data <- data.frame( predicted_values = c(predicted_lmrob_female, predicted_lmrob_male), sex = factor(rep(c("female", "male"), times = c(length(predicted_lmrob_female), length(predicted_lmrob_male))) ))

comparison <- aov(predicted_values ~ sex, data = predicted_lmrob_data) summary(comparison)

Here is an explanation what I am trying to do: My professor wants me to compare the results of two ancovas (one for each sex) in another anova with each other. But based on my assumptions for the ancovas, I need to use a robust model -> lmRob()

Emil
  • 21
  • 2
    What is the reason you are fitting two models separately rather than including gender as a term in a single model? – whuber Jan 19 '24 at 19:38
  • See https://stats.stackexchange.com/questions/373890/separate-models-vs-flags-in-the-same-model and follow the advice there – kjetil b halvorsen Jan 19 '24 at 22:45
  • This specific case can be handled as suggested above be the mods. If you have more complicated situations in mind for which you wish to compare two robust fits, then I’m afraid this not possible. – utobi Jan 19 '24 at 23:07
  • @utobi I believe a comparison is possible, but how one goes about it depends on what "compare the results ... statistically" is intended to mean and what assumptions are adopted. – whuber Jan 20 '24 at 18:06

0 Answers0