13
$\begingroup$

I have a bunch of variables which contain longitudinal data from day 0 to day 7. I am looking for an appropriate clustering approach which can cluster these longitudinal variables (not cases) into different groups. I tried to analyze this data set separately by time, but the result was pretty difficult to be reasonably explained.

I investigated the availability of a SAS procedure PROC SIMILARITY because there is an example on its website; however, I think it is not a right way. Some previous studies used exploratory factor analysis in each time point, but this is not an option in my study as well because of unreasonable results.

Hopefully some ideas can be provided here, and a compiled program, such as SAS or R, can be available to process. Any suggestion is appreciated!!


Here is a short example (sorry for the inconsistent position between data and variable names):

id time   V1  V2   V3   V4   V5   V6   V7   V8   V9   V10
2    0    8    7    3    7    6    6    0    0    5    2
2    1    3    5    2    6    5    5    1    1    4    2
2    2    2    3    2    4    4    2    0    0    2    2
2    3    6    4    2    5    3    2    1    2    3    3
2    4    5    3    4    4    3    3    4    3    3    3   
2    5    6    4    5    5    6    3    3    2    2    2
2    6    7    5    2    4    4    3    3    4    4    5
2    7    7    7    2    6    4    4    0    0    4    3
4    0   10    7    0    2    2    6    7    7    0    9
4    1    8    7    0    0    0    9    3    3    7    8
4    2    8    7    0    0    0    9    3    3    7    8
4    3    8    7    0    0    0    9    3    3    7    8
4    4    5    7    0    0    0    9    3    3    7    8
4    5    5    7    0    0    0    9    3    3    7    8
4    6    5    7    0    0    0    9    3    3    7    8
4    7    5    7    0    0    0    9    3    3    7    8
5    0    9    6    1    3    2    2    2    3    3    5
5    1    7    3    1    3    1    3    2    2    1    3
5    2    6    4    0    4    2    4    2    1    2    4
5    3    6    3    2    3    2    3    3    1    3    4
5    4    8    6    0    5    3    3    2    2    3    4
5    5    9    6    0    4    3    3    2    3    2    5
5    6    8    6    0    4    3    3    2    3    2    5
5    7    8    6    0    4    3    3    2    3    2    5
$\endgroup$
2
  • $\begingroup$ Could you explain the data a bit more or maybe provide a shortened sample? When you say the "variables contain longitudinal data" do you mean they are all repeated measurements on the same person or thing over 7 days (and thus likely to be correlated). $\endgroup$
    – user6666
    Commented Oct 31, 2011 at 23:04
  • $\begingroup$ To rosser: I've appended a part of data. As you mentioned, they are repeated measurements: each patient (ID) has 10 measurements (V1~V10) lasting several days (day0~day7). $\endgroup$
    – cchien
    Commented Nov 1, 2011 at 16:22

3 Answers 3

6
$\begingroup$

So, you have p variables measured each t times on same n individuals. One way to proceed is to compute t pXp (dis)similarity matrices and apply INDSCAL-model Multidimentional Scaling. It will give you two low-dimensional maps (say, of 2 dimensions). The first map shows the coordinates of p variables in the space of the dimensions and reflects groupings among them, if there are any. The second map shows weights (i.e. importance, or salience) of the dimensions in each matrix of t.

enter image description here

$\endgroup$
3
  • $\begingroup$ I also have the idea of converting n-dimension to 2-dimension, but just do not have any idea of specific method which can accomplish this. Now I found SAS may have a procedure can implement it. I will learn it to see its availability when using my data. $\endgroup$
    – cchien
    Commented Nov 1, 2011 at 16:40
  • $\begingroup$ What is the best way to interpret the weights? $\endgroup$
    – Ming K
    Commented Nov 10, 2011 at 0:37
  • $\begingroup$ The weight shows how much a dimension is relevant, or discriminative, for this particular source (sources are individuals or, as in this example, times). On the picture for time1, for example, dimension II is strong or relevant and dimension I is weak. $\endgroup$
    – ttnphns
    Commented Nov 10, 2011 at 6:36
6
$\begingroup$

I am not sure it is what you are looking for, but the package kml in R uses k-means to cluster sequences of repeated measures. Here is a link to the package page and to the paper (unfortunately, it is gated). It only works well if you have a fairly small dataset (a few hundred sequences).

Here is a non-gated version of the paper (without reference problems): http://christophe.genolini.free.fr/recherche/aTelecharger/genolini2011.pdf

$\endgroup$
4
  • $\begingroup$ I actually reviewed this method before posting this question. I assumed the kml approach is a cluster way to group individuals from some examples of its original paper. I will take a look at it again. Thanks!! $\endgroup$
    – cchien
    Commented Nov 1, 2011 at 16:30
  • $\begingroup$ @ccchien yes, they use it to cluster individual trajectories together, but you could assume that you have ten trajectories per individual (one for each of your variables). You would probably need to normalize your variables for the kml procedure to work properly. The problem is that, as far as I know, there is no way of telling kml that your trajectories are nested in individuals. So it might end up being not exactly fitted to what you are trying to achieve. $\endgroup$ Commented Nov 1, 2011 at 16:48
  • $\begingroup$ @greg121, thanks for the link to the freely available version of the paper. It seems the in-text references have been dropped, maybe the Latex file should be recompiled once more (the reference list is there though). $\endgroup$ Commented Oct 1, 2012 at 10:29
  • $\begingroup$ @AntoineVernet yes, you're right. But I couldn't find any other version $\endgroup$
    – greg121
    Commented Oct 30, 2012 at 16:49
5
$\begingroup$

In the R Hmisc package see the help file for the curveRep function, which stands for "representative curves." curveRep clusters on curve shapes, locations, and patterns of missing time points.

$\endgroup$
5
  • $\begingroup$ Thanks for your advice. It sounds doable. I will read its manual right away. $\endgroup$
    – cchien
    Commented Nov 1, 2011 at 16:44
  • $\begingroup$ Frank. The example in the manual doesnt seem to function. Is there a typo? I wanted to run the example to get a feel for it. Here is the code:set.seed(1) N <- 200 nc <- sample(1:10, N, TRUE) id <- rep(1:N, nc) x <- y <- id for(i in 1:N) { x[id==i] <- if(i y[id==i] <- i + 10*(x[id==i] - .5) + runif(nc[i], -10, 10) } $\endgroup$
    – B_Miner
    Commented Nov 1, 2011 at 23:27
  • 1
    $\begingroup$ Whoops. I forgot that a percent sign in an R help file needed to be escaped. This caused a line in the example to be truncated. Replace the incomplete line with: x[id==i] <- if(i %% 2) runif(nc[i]) else runif(nc[i], c(.25, .75)) $\endgroup$ Commented Nov 2, 2011 at 12:28
  • $\begingroup$ I'm not sure what "p: number of points at which to evaluate each curve for clustering" stands for in curveRep(x, y, id, kxdist=2, p=10) $\endgroup$
    – greg121
    Commented Mar 22, 2013 at 0:04
  • 1
    $\begingroup$ Each subject (curve) is profiled by fitting a lowess smooth to it and evaluating the smooth over a fixed grid of points, in case different curves had different sampling times. Two points would characterize a linear relationship, three a quadratic. $p>3$ is usually recommended and $p=10$ is not a bad choice. The interpolated ordinate at the grid of points is fed into the clustering algorithm along with maximum time gap, number of missing values, and other things. $p$ can be larger than needed without doing much harm; it's ok for some characterizations to be redundant. $\endgroup$ Commented Mar 22, 2013 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.