0

I need the power of the community!

I aim to plot curves from multivariate functional data in R but I don't even know where to start looking for help... I have a matrix (or data frame) including the values of 20 variables for almost 72,000 users (see picture).

enter image description here

Based on this data, I'd like to create a plot that presents curves for each user based on the values of the variables (y-axis) and where the x-axis represents the variables. Something that looks similar to this:

enter image description here

Best case, I'd also be able to color some of the curves in different colors based on a column in another data frame that explains the type of user.

Do you have any ideas or tips on how I could get started?

Thanks a lot, Jeanette

J001
  • 15
  • 4

1 Answers1

0

I managed to use the roahd package in order to create a multivariate functional dataset:

library(roahd)

#Normalize data from 0 to 1000 to support visualization
MUOD_norm <- apply(MUOD01_allVar_matrix, MARGIN = 2, FUN = 
function(x) (x - min(x)) / (max(x) - min(x)) * 1000)  

P = 20 #for my 20 variables
grid = seq(1,20,length.out = P)
mfd_MUOD <- mfData(grid, list(MUOD_norm))

str(mfd_MUOD)

plot(mfd_MUOD)

This produced the following outcome:

enter image description here

Do you know how I can change the colors of the curves based on groups that are defined in another data frame?

J001
  • 15
  • 4