I'm new to R - moved from SAS and I'm just not sure on the syntax.
I'm working on a dataset with one hundred patients examined at 4 different time points using eighty variables at each time point.
I've been using FactoMineR as hypothesis generation and done a PCA and MFA on the first examination, but I want to include all the data in my analysis.
I see two options:
- MFA: See: https://groups.google.com/g/factominer-users/c/6T3QD-aRtmY This functions plot module includes a chrono option. When TRUE it will connect the partial points of the same variables. My current data is in seperate dataframes as: Visit 1: |row | var 1 | Var 2 | Var 3| |:---|:--------:|:------:|-----:| |1 | a | aa | aaa | |2 | b | bb | bbb | |3 | c | cc | ccc |
Visit 2:
In order to do this my data should be:
| .. | .. | Visit 1| .. | .. |Visit2 | |
|:-------|:-----:|:------:|:-------:|:---------------:|-------:|
|rownames| Var1 | Var2 | Var 3 | Var1 | Var2 | Var3 |
1 | a | b | c | aa | bb | cc |
I've trouble displaing the table the correct way. Please see the link also.
How do i set this up so that the MFA recognizes the repeated variables as nested within each visit? My current code is:
res.mfa <- MFA (tt.a,
group = c(1, 1, 9, 4, 4, 6, 10, 3, 3, 5, 10),
type = c("s", "n", "s", "s", "s", "s", "s", "s", "n", "n", "s"),
name.group = c("age", "xxx", "......"),
num.group.sup = c(1,2),
ncp = nbdimFAMD$ncp,
graph = F)
- HMFA This could be used as defining each visit as a top level in a hierachy. But comming from SAS I simply just don't get the code in the vignettes example:
data(wine)
hierar <- list(c(2,5,3,10,9,2), c(4,2))
res.hmfa <- HMFA(wine, H = hierar, type=c("n",rep("s",5)))
I've run it in my console and it works perfectly. The interpretation however is difficult. But specifically - I dont understand what the list functions does and hence I can't create a hierachy on my own dataset. Do I create a list from each visit and then combine them in one dataframe?
It may be simple but new to the syntax and I'm still learning.
I hope you can help!
Kind regards