Run_real/Plot_timedata.R

library(ggplot2)
library(directlabels)
library(reshape2)
library(reshape)

l <- 2
matplot(sseq, t(X.comp[l,, ]))
matplot(sseq, t(X.comp[1,1:10,]))
apply(Z_ITG, 2, sd)
effec

A3 <- melt(Z_t.full, id = c("Subject_ID", "TIME"))
A2 <- Z_t.full %>% select(Subject_ID, TIME, X1)
A2 <- melt(A2, id = c("Subject_ID", "TIME"))
timemeans2 <- cast(A2, TIME~variable, mean)
timemeans3 <- cast(A3, TIME~variable, mean)
timesds3 <- cast(A3, TIME~variable, sd)

#names(timemeans3)
timemeans3.1 <- melt(timemeans3, id = "TIME")
q <- ggplot(aes(x = TIME, y = value, group = variable, colour = variable), data = timemeans3.1)
q <- q + geom_line() #+  scale_x_continuous(breaks = seq(5, 30, by = 5), labels = c("5", "10", "15", "20", "25", "30"))
q + geom_dl(aes(label = variable), method = list(dl.combine("first.points", "last.points"), cex = 0.8)) + 
  scale_colour_discrete(guide = 'none') 


timesds3.1 <- melt(timesds3, id = "TIME")
q.sd <- ggplot(aes(x = TIME, y = value, group = variable, colour = variable), data = timesds3.1)
q.sd <- q.sd + geom_line() +  scale_x_continuous(breaks = seq(5, 30, by = 5), labels = c("5", "10", "15", "20", "25", "30"))
q.sd + geom_dl(aes(label = variable), method = list(dl.combine("first.points", "last.points"), cex = 0.8)) + 
  scale_colour_discrete(guide = 'none') 

timemeans3.2 <- timemeans3.1 %>% filter((variable %in% paste0("X", 10:20)))
q2 <- ggplot(aes(x = TIME, y = value, group = variable, colour = variable), data = timemeans3.2)
q2 <- q2 + geom_line() #+  scale_x_continuous(breaks = seq(5, 30, by = 5), labels = c("5", "10", "15", "20", "25", "30"))
q2 + geom_dl(aes(label = variable), method = list(dl.combine("first.points", "last.points"), cex = 0.8)) + 
  scale_colour_discrete(guide = 'none') 


A2 <- Z_t.full %>% select(Subject_ID, TIME, X1)
A2 <- melt(A2, id = c("Subject_ID", "TIME"))
q3 <- ggplot(aes(x = TIME, y = value, group = Subject_ID, colour = Subject_ID), data = A2 %>% filter(Subject_ID %in% 1:10))
q3 <- q3 + geom_line() #+  scale_x_continuous(breaks = seq(5, 30, by = 5), labels = c("5", "10", "15", "20", "25", "30"))
# q2 + geom_dl(aes(label = variable), method = list(dl.combine("first.points", "last.points"), cex = 0.8)) + 
#   scale_colour_discrete(guide = 'none') 
q3

apply(Z_t.obs[, -(1:2)], 2, mean)
matplot(sseq, t(X.comp[13,c(1:2) , ]))
jiji6454/Rpac_compReg documentation built on May 31, 2019, 5:01 a.m.