Stata’s spagplot fails and plots vertical lines, but there is an easy solution in R.
library(foreign) data <- read.dta("C:/Users/hellmund/Documents/MyStataDataFile.dta") names(data) levels(data$group) #First column contains initial measurements, k’th column measurements at time k dataLong <- reshape(data, direction="long", varying=list(names(data)[1:10]), v.names=NULL,idvar=c("id"), timevar="Visit", times=1:10) png(file=”C:/Users/hellmund/Documents/spagplot.png”, bg=”transparent”) interaction.plot(dataLong$Visit,dataLong$id, dataLong$Size xlab=”Visit”, ylab=”Size(mm)”, legend=F,lty=1, ylim=c(30,70)) #Critical cut-off value is marked with a horizontal line abline(h=55) dev.off()
![](https://static.wixstatic.com/media/88f6e2_1265068e8e4f483a8e798c916e6f2a86~mv2.png/v1/fill/w_320,h_320,al_c,q_85,enc_auto/88f6e2_1265068e8e4f483a8e798c916e6f2a86~mv2.png)
Commenti