开发者

Clusters over time in R

I have a series of data that I'm going to use clustering on, and I want to see how this data clusters over time.

So essentially everyone starts in a single group, as they have done nothing, but over time as they do different things they will be put into different groups based on their behavior, and I want to track this.

I've been looking for a way to do this in R (with some preprocessing of data in Python), and represent it graphically. The only way I can currently think of doing this is breaking the time period into say, 3 weeks, and then clustering each of the 3 weeks. The only problem with this is I don't really know how to track mov开发者_运维百科ements of people between clusters over those 3 weeks (e.g. to see if someones actions moves them from group A to group B). I could put it in a table, but it would be nice to somehow show it graphically (like red lines between cluster over time or something).

Any ideas on how to do this would be much appreciated, or if there is a good way to track clusters over time that I've been missing please point me towards it.


I've used the Mfuzz in R for clustering time-course microarray data sets. Mfuzz uses "soft-clustering". Basically, individuals can appear in more than one group. Here is an example with some simulated data:

library(Mfuzz)

tps = 6;cases = 90
d = rnorm(tps*cases, 1)  ##Poisson distribution with mean 1
m = matrix(d, ncol=tps, nrow=cases)

##First 30 individuals have increasing trends
m[1:30,] = t(apply(m[1:30,], 1, cumsum))

##Next 30 have decreasing trends
##A bit hacky, sorry
m[31:60,] = t(apply(t(apply(m[31:60,], 1, cumsum)), 1, rev))

##Last 30 individuals have random numbers from a Po(1)

##Create an expressionSet object
tmp_expr = new('ExpressionSet', exprs=m)

##Specify c=3 clusters
cl = mfuzz(tmp_expr, c=3, m=1.25)
mfuzz.plot(tmp_expr,cl=cl, mfrow=c(2, 2))

This gives:

Clusters over time in R

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜