#Valores a revisar
dfLong %>% filter(value>10)
## # A tibble: 6 x 4
## Codigo Variable Tiempo value
## <chr> <int> <chr> <dbl>
## 1 526F 9 1 109
## 2 844g 50 1 33
## 3 844g 50 2 33
## 4 580k 21 1 22
## 5 008h 29 2 43
## 6 974j 65 2 99
Desde ahora en adelante se ignoran esos valores
dfLong=dfLong %>% filter (value<=10)
dfLong %>% count(Tiempo,Variable,value) %>%ggplot(aes(x=value,y=n,fill=Tiempo))+
geom_col(position="dodge")+
facet_wrap(~Variable)
dfPar=dfLong %>% filter(Tiempo=="1") %>% select(-Tiempo) %>% rename(pre=value) %>% inner_join(dfLong %>% filter(Tiempo=="2") %>% select(-Tiempo)%>%rename(post=value)) %>% mutate(dif=post-pre,media=(post+pre/2))
## Joining, by = c("Codigo", "Variable")
dfPar %>% ggplot(aes(x=pre,y=post,colour=Variable)) +
geom_jitter(alpha=0.5)+
geom_smooth(method="lm",se = F)+
geom_abline(intercept = 0,slope = 1)
## `geom_smooth()` using formula 'y ~ x'
dfPar %>% ggplot(aes(x=pre,y=post)) +
geom_jitter(alpha=0.5)+
geom_smooth(method="lm",se=F)+
geom_abline(intercept = 0,slope = 1)+
facet_wrap(~ Variable)
## `geom_smooth()` using formula 'y ~ x'
En los gráficos de Bland Altman, si alguien no cambia dif=0, donde dif=post-pre. Si los valores son mayores que cero, la persona a aumentado su puntuación.
dfPar %>% ggplot(aes(x=media,y=dif)) +
geom_jitter(alpha=0.5)+
geom_smooth(method="lm",se = F)+
geom_hline(yintercept=0)+
facet_wrap(~ Variable)+ggtitle("Bland Altman")
## `geom_smooth()` using formula 'y ~ x'
Vamos a centrarnos sobre todo en la zona de cambios de dos puntos arriba o abajo de dif=0. La línea de color nos da más detalle de como es dif con respecto a cero (linea negra)
dfPar %>% ggplot(aes(x=media,y=dif)) +
geom_jitter(alpha=0.5)+
geom_smooth(method="lm",se = F)+
geom_hline(yintercept=0)+
facet_wrap(~ Variable)+ggtitle("Bland Altman")+
coord_cartesian(ylim=c(-2,2))
## `geom_smooth()` using formula 'y ~ x'