HMFA

44 views
Skip to first unread message

Kristian Sandahl

unread,
Apr 5, 2022, 10:06:23 AM4/5/22
to FactoMineR users
Dear FactoMineR Users

I'm working on a dataset where my patients have been examined four times, with 86 variables at each time point.
As suggested, I've used HMFA to analyse my data.

My data setup is in the wide format as:
First five variables are categorical and should be supplementary.
Next variables are numerical and are repeated at every visit, i.e. three times.
Last variable is age and I've used as the top of my hierarchy. Could also be visit 1to 3- if this works better. 
Looks like
       |cat1|cat2|cat3|cat4|cat5 | var1_visit_a |var2_visit_a |...| var1_visit_b | var2_visit_b ....
1
2
3

The top hierarchy is the last three "age" variables. 

My code is working and is as follows:
hierar <- list(c(5,6,3,4,4,4,9,1,10,6,3,4,4,4,9,1,10,6,3,4,4,4,9,1,10,3),
               c(1,8,8,8,1),
               c(1,3,1),
               c(2,1))

res.hmfa <- HMFA(tt.hmfa,
                  H = hierar,
                  type = c("n","s","s","s","s","s","s","s","s","s",
 "s","s","s","s","s","s","s","s","s","s","s","s","s","s","s","s"),
                  graph = F)
dimdesc(res.hmfa)


I would like to keep the first five variables and 'nest' them under each visit along with my other explanatory variables. I hope that this is possible.
The codes works fine, however when i look at my results all my categorical variables are now treated as quantitative and there aren't any included categories anymore.

I would really appreciate som help on how to construct my hierarchy as I believe that this must be where the mistake lies. Or is it perhaps in the "type" statement? Or perhaps the first five categorical variables should be repeated under each visit?

I really hope that anyone can help with this as I'm quite confused at my problem!

Kind regards
Kristian 

Kristian Sandahl

unread,
Apr 5, 2022, 4:18:45 PM4/5/22
to FactoMineR users
I should clarify: The five categorical variables can't change between visits but are predefined before the study period. Thus, they are traits that are stable and specific for each person. 

Kind regards 
Kristian
Reply all
Reply to author
Forward
0 new messages