data <- matrix(scan(),ncol=3,byrow=TRUE) 1 1 42.5 1 1 43.3 1 1 42.9 1 2 42.2 1 2 41.4 1 2 41.8 2 3 48.0 2 3 44.6 2 3 43.7 2 4 42.0 2 4 42.8 2 4 42.8 3 5 41.7 3 5 43.4 3 5 42.5 3 6 40.6 3 6 41.8 3 6 41.8 data table77 <- data.frame(data) colnames(table77) <- c("day","run","glucose") rm(data) table77$day <- as.factor(table77$day) table77$run <- as.factor(table77$run) # this model assumes that day is random # Note: SINCE run IS CODED CORRECTLY, R handles it correctly library(afex) table77.afex1 <- mixed(glucose ~ (1|day) + (1|run), data=table77) summary(table77.afex1) # this model assumes that day is fixed table77.afex2 <- mixed(glucose ~ day + (1|run), data=table77) summary(table77.afex2) nice(table77.afex2) # mean estimates and correct standard errors library(emmeans) emmeans(table77.afex2, ~day)