inst/scripts/dogs.q

with(dogs, {
Time <- c(1,3,5,7,9,11,13)
plot(c(1,13), c(3,6), type="n", xlab="time", ylab="potassium")
G <- as.numeric(dogs$Group)
for(i in 1:nrow(dogs))
      lines(Time,as.matrix(dogs[i,2:8]),lty=G[i],col=G[i])
title("Coronary sinus potassium")
cat("\nChoose two groups to compare (Group 1=control)\n")
G    <- ask("First group (1-4)")
id   <- (dogs$Group==G)
Title<- paste(c("Coronary sinus potassium - groups",
         as.character(G)))
gr1  <- as.matrix(dogs[id,2:8])
plot(c(1,13), c(3,6),xlab="time", ylab="potassium", type="n")
sm1  <- sm.rm(Time, gr1, display="se", add=TRUE)
points(Time, sm1$aux$mean, pch=G)
G    <- ask("Second group (1-4)")
id   <- (dogs$Group==G)
gr2  <- as.matrix(dogs[id,2:8])
sm2  <- sm.rm(Time, gr2, display="se", add=TRUE)
points(Time,sm2$aux$mean,pch=G)
Title <- paste(c(Title, "and", as.character(G)), collapse=" ")
title(Title)
})

Try the sm package in your browser

Any scripts or data that you put into this service are public.

sm documentation built on May 1, 2019, 8:06 p.m.