r - ggplot GLMM binary outcome -


i'm looking way plot glmm has binary outcome variable either responded correctly or incorrectly (response) , 1 factor 8 levels (level) each repeated 24 times 20 people (id).

i'd produce plot probability of responding correctly level on y-axis , each person plotted different coloured dot on x-axis containing levels. sort of getting me in ballpark it's not want , i'm pretty sure isn't proper way it. 20 people colour becomes gradient , it's impossible tell where. appreciated.

ggplot(df, aes(x = level, y = response, group = id, colour = id)) +        geom_point() + stat_smooth(method = "glm", family= "binomial", se = false)  

here small reproducible example 3 people , 2 levels.

df <- data.frame("id"=c(rep(1,10), rep(2,10), rep(3,10)),        "level"=c(1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2),       "response"=c(1,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,0,0,0,1,1,0,1))        df$level <- factor(df$level)        df$id <- factor(df$id) 

enter image description here


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -