rcluster-analysismixture-model

mixAK getProfiles bug?


From the vignette http://www.jstatsoft.org/v59/i12/paper, page 9...

library("mixAK")
data("PBC910", package = "mixAK")
tail(PBC910)[, c(1, 2, 3, 6:9)]

...all well and good so far, as this gives the documented output (page 9). Then the following is supposed to give one data.frame per subject (from page 11).

ip <- getProfiles(t = "month", y = c("lbili", "platelet", "spiders",    
     "jspiders"), id = "id", data = PBC910)

So to test that...

 ip[[1]]

correctly gives the first sub-set (albeit id=2, rather than maybe a more useful index).

However, digging a bit deeper, it looks like the sub-setting gets out of synch, at least for me. For example by inspecting the results of...

ip[[11]];ip[[12]];ip[[13]];ip[[14]];ip[[15]] 

Just showing here...

ip[[12]]

I get the following, which starts with the last entry of the previous sub-set. The end of subset spills over, and it all gets a bit messy.

              month      lbili       platelet  spiders    jspiders
           44 23.425051 -0.3566749   133       0          0.207410112
           45  0.000000 -0.2231436   295       0          0.003706764
           46  6.439425 -0.9162907   235       1          0.709859749
           47 12.024641 -0.2231436   268       0          0.146529978

Plotting the results shows the same effect...

 plotProfiles(ip = ip, data = PBC910, var = "lbili", tvar = "month", 
     main = "Log(bilirubin)", highlight = c(12), 
     xlab = "Time (months)", ylab = "Log(bilirubin)")

...showing a distinct reversal.

I must have missed something obvious somewhere....


Solution

  • This is a bug that was mistakenly created in version 4.1 of the package. It should be corrected in version 4.2 (available hopefully soon on CRAN).

    Arnost