---
title: "Modelo Linear Generalizado Hierárquico - *Mixed Effects Models*"
author: "Caio Vallio & Vitor Vallio"
date: last-modified
format:
html:
self-contained: true
df-print: paged
toc: true
toc-depth: 5
number-sections: true
number-depth: 5
code-fold: true
code-tools: true
code-line-numbers: true
execute:
echo: true
warning: false
lang: en
bibliography: bibliografia.bib
---
<br>
<br>
<p style='text-align: justify;'>
**Análises realizadas:** Para as medidas de efeito, foram aplicados modelos lineares generalizados hierárquicos (*mixed models*), considerando a alocação dos grupos com base na análise por intenção de tratamento. O resultado do modelo é a diferença média (mean difference) entre grupos da diferença intragrupo. A incerteza sobre as diferenças médias são apresentadas em intervalo de confiança 95% (IC95%). Os efeitos fixos foram compostos por variáveis dummy indicando o tempo (pré tratamento e pós tratamento) e os termos de interação com os grupos (tempo$\times$grupo). Esta estratégia foi implementada para ajustar possíveis diferenças entre os grupos na avaliação pré tratamento para corrigir o viés de regressão para a média. Foram adicionados para os efeitos randômicos a identificação de cada participante, essa estratégia ajusta o modelo para medidas repetidas, considerando a dependência entre as avaliações de pré e pós tratamento para cada participante.[ @twisk_2019; @twisk_2013 ]
</p>
<p style='text-align: justify;'>
**Software utilizado para as análises:** R Core Team (2024). _R: A Language and Environment for Statistical Computing_. R Foundation for Statistical Computing, Vienna, Austria. URL: https://www.R-project.org.
</p>
```{r}
library (readxl)
library (dplyr)
library (gtsummary)
library (gt)
library (qqplotr)
library (nortest)
library (parameters)
library (performance)
library (lme4)
library (lmerTest)
library (emmeans)
library (ggplot2)
library (plotly)
library (DT)
library (jtools)
df_fw1 <- readxl:: read_excel (
# "data/_Coleta de dados - projeto dor lombar oficial (8).xlsx",
"data/Coleta de dados PLANILHA FINAL revisada.xlsx" ,
sheet = 1
) |>
janitor:: clean_names () |>
select (
nome,
intensidade_da_dor_0_10, # Dor
rm_result, # Roland Morris (função)
x1_av_epegp, # Efeito global percebido
etc_result, # cinesiofobia
eaf_final, # Autoeficácia
media_fmmmiie, # Força Extensão MMII
final_fmiif, # Força Flexão MMII
x1_av_fabs, # Força de abdominal
fpmd_result, # Força de preensao palmar direita
fpme_result, # Força de preensao palmar esquerda
randomiz,
genero,
estado_civil,
escolaridade,
idade_anos,
imc_kg_m2
) |>
rename (
grupo = randomiz,
idade = idade_anos,
imc = imc_kg_m2,
dor = intensidade_da_dor_0_10,
rm = rm_result,
epegp = x1_av_epegp,
cinesiofobia = etc_result,
autoeficacia = eaf_final,
fmmmiie = media_fmmmiie,
fmmmiif = final_fmiif,
fabs = x1_av_fabs,
fpmd = fpmd_result,
fpme = fpme_result
) |>
filter (! is.na (dor)) |>
mutate (
nome = nome |>
tolower () |>
stringr:: str_remove_all ("[^a-zA-Z0-9 \\ s]" ) |>
stringr:: str_trim () |>
stringr:: str_replace_all (" \\ s+" , "_" ),
tempo = 0
)
df_fw2 <- readxl:: read_excel (
# "data/_Coleta de dados - projeto dor lombar oficial (8).xlsx",
"data/Coleta de dados PLANILHA FINAL revisada.xlsx" ,
sheet = 2
) |>
janitor:: clean_names () |>
select (
nome,
intensidade_da_dor_0_10,
rm_2_result,
x1_av_epegp,
etc_2_result,
eaf_final,
media_fmmiie,
final_fmmif,
x1_av_fabs,
fpmd_result,
fpme_result
) |>
rename (
dor = intensidade_da_dor_0_10,
rm = rm_2_result,
epegp = x1_av_epegp,
cinesiofobia = etc_2_result,
autoeficacia = eaf_final,
fmmmiie = media_fmmiie,
fmmmiif = final_fmmif,
fabs = x1_av_fabs,
fpmd = fpmd_result,
fpme = fpme_result
) |>
filter (! is.na (dor) & ! is.na (rm)) |>
mutate (
nome = nome |>
tolower () |>
stringr:: str_remove_all ("[^a-zA-Z0-9 \\ s]" ) |>
stringr:: str_trim () |>
stringr:: str_replace_all (" \\ s+" , "_" ),
tempo = 1
) |>
left_join (
df_fw1 |>
select (nome, grupo, idade, imc, genero, estado_civil, escolaridade),
by = "nome"
)
df_fw3 <- readxl:: read_excel (
# "data/_Coleta de dados - projeto dor lombar oficial (8).xlsx",
"data/Coleta de dados PLANILHA FINAL revisada.xlsx" ,
sheet = 3
) |>
janitor:: clean_names () |>
select (
nome,
intensidade_da_dor_0_10,
rm_total,
x1_av_epegp,
etc_result,
eaf_final
) |>
rename (
dor = intensidade_da_dor_0_10,
rm = rm_total,
epegp = x1_av_epegp,
cinesiofobia = etc_result,
autoeficacia = eaf_final
) |>
filter (! is.na (dor) & ! is.na (rm)) |>
mutate (
nome = nome |>
tolower () |>
stringr:: str_remove_all ("[^a-zA-Z0-9 \\ s]" ) |>
stringr:: str_trim () |>
stringr:: str_replace_all (" \\ s+" , "_" ),
tempo = 2
) |>
left_join (
df_fw1 |>
select (nome, grupo, idade, imc, genero, estado_civil, escolaridade),
by = "nome"
)
df_model <- df_fw1 |>
bind_rows (
df_fw2 |>
mutate (
dor = as.double (dor),
rm = as.double (rm),
epegp = as.double (epegp),
cinesiofobia = as.double (cinesiofobia),
autoeficacia = as.double (autoeficacia),
fmmmiie = as.double (fmmmiie),
fmmmiif = as.double (fmmmiif),
fabs = as.double (fabs),
fpmd = as.double (fpmd),
fpme = as.double (fpme)
)
) |>
bind_rows (df_fw3)
df_model <- df_model |>
mutate (grupo = if_else (grupo == 2 , 0 , 1 ))
# Dummies para ajuste no baseline mantendo os dois follow-up
for (level in unique (df_model$ tempo)) {
df_model[paste ("tempo" , level, sep = "_" )] <- ifelse (
df_model$ tempo == level,
1 ,
0
)
}
# Interação grupo x tempo
df_model <- df_model |>
mutate (grupo_tempo_1 = grupo * tempo_1, grupo_tempo_2 = grupo * tempo_2)
```
# Variáveis demográficas
```{r}
df_model |>
filter (tempo == 0 ) |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
gtsummary:: tbl_summary (
include = c (
idade,
imc,
genero,
estado_civil,
escolaridade
),
by = grupo,
statistic = list (
gtsummary:: all_continuous () ~ "{mean} ({sd})" ,
gtsummary:: all_categorical () ~ "{n} ({p}%)"
),
missing_text = "Missing"
)
```
# Análises
## Desfechos Primários
### Dor
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (dor, na.rm = T), 2 ),
dp = round (sd (dor, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média da dor" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (dor, na.rm = T),
dp = sd (dor, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média da dor" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_1.1 <- lmer (
dor ~ factor (tempo) * factor (grupo) +
# idade +
# imc +
# genero +
# estado_civil +
# escolaridade +
(1 | nome),
data = df_model
)
tbl_1.1 <- modelo_1.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_1.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_1.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média da dor" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_1.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_1.1 ) |> plot ()
performance:: check_collinearity (modelo_1.1 )
```
:::
### Função (RM)
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (rm, na.rm = T), 2 ),
dp = round (sd (rm, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média da função" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (rm, na.rm = T),
dp = sd (rm, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média da função" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_2.1 <- lmer (
rm ~ factor (tempo) * factor (grupo) + (1 | nome),
data = df_model
)
tbl_2.1 <- modelo_2.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_2.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_2.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média da função" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_2.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_2.1 ) |> plot ()
performance:: check_collinearity (modelo_2.1 )
```
:::
## Desfechos Secundários
### Efeito global percebido
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (epegp, na.rm = T), 2 ),
dp = round (sd (epegp, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média do efeito global percebido" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (epegp, na.rm = T),
dp = sd (epegp, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média do efeito global percebido" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_3.1 <- lmer (
epegp ~ factor (tempo) * factor (grupo) + (1 | nome),
data = df_model
)
tbl_3.1 <- modelo_3.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_3.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_3.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média do efeito global percebido" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_3.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_3.1 ) |> plot ()
performance:: check_collinearity (modelo_3.1 )
```
:::
### Cinesiofobia
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (cinesiofobia, na.rm = T), 2 ),
dp = round (sd (cinesiofobia, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média da cinesiofobia" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (cinesiofobia, na.rm = T),
dp = sd (cinesiofobia, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média da cinesiofobia" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_4.1 <- lmer (
cinesiofobia ~ factor (tempo) * factor (grupo) + (1 | nome),
data = df_model
)
tbl_4.1 <- modelo_4.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_4.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_4.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média da cinesiofobia" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_4.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_4.1 ) |> plot ()
performance:: check_collinearity (modelo_4.1 )
```
:::
### Autoeficácia
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (autoeficacia, na.rm = T), 2 ),
dp = round (sd (autoeficacia, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média da autoeficácia" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (autoeficacia, na.rm = T),
dp = sd (autoeficacia, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média da autoeficácia" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_5.1 <- lmer (
autoeficacia ~ factor (tempo) * factor (grupo) + (1 | nome),
data = df_model
)
tbl_5.1 <- modelo_5.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_5.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_5.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média da autoeficácia" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_5.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_5.1 ) |> plot ()
performance:: check_collinearity (modelo_5.1 )
```
:::
### Força Extensão MMII
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (fmmmiie, na.rm = T), 2 ),
dp = round (sd (fmmmiie, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média da força extensão MMII" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (fmmmiie, na.rm = T),
dp = sd (fmmmiie, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média da força extensão MMII" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_6.1 <- lmer (
fmmmiie ~ factor (tempo) * factor (grupo) + (1 | nome),
data = df_model
)
tbl_6.1 <- modelo_6.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_6.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_6.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média da força extensão MMII" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_6.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_6.1 ) |> plot ()
performance:: check_collinearity (modelo_6.1 )
```
:::
### Força Flexão MMII
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (fmmmiif, na.rm = T), 2 ),
dp = round (sd (fmmmiif, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média da força flexão MMII" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (fmmmiif, na.rm = T),
dp = sd (fmmmiif, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média da força flexão MMII" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_7.1 <- lmer (
fmmmiif ~ factor (tempo) * factor (grupo) + (1 | nome),
data = df_model
)
tbl_7.1 <- modelo_7.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_7.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_7.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média da força flexão MMII" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_7.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_7.1 ) |> plot ()
performance:: check_collinearity (modelo_7.1 )
```
:::
### Força de abdominal
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (fabs, na.rm = T), 2 ),
dp = round (sd (fabs, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média da força de abdominal" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (fabs, na.rm = T),
dp = sd (fabs, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média da força de abdominal" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_8.1 <- lmer (
fabs ~ factor (tempo) * factor (grupo) + (1 | nome),
data = df_model
)
tbl_8.1 <- modelo_8.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_8.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_8.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média da força de abdominal" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_8.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_8.1 ) |> plot ()
performance:: check_collinearity (modelo_8.1 )
```
:::
### Força de preensão palmar direita
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (fpmd, na.rm = T), 2 ),
dp = round (sd (fpmd, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média da força de preensão palmar direita" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (fpmd, na.rm = T),
dp = sd (fpmd, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média da força de preensão palmar direita" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_9.1 <- lmer (
fpmd ~ factor (tempo) * factor (grupo) + (1 | nome),
data = df_model
)
tbl_9.1 <- modelo_9.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_9.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_9.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média da força de preensão palmar direita" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_9.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_9.1 ) |> plot ()
performance:: check_collinearity (modelo_9.1 )
```
:::
### Força de preensão palmar esquerda
#### Evolução
::: {.panel-tabset}
##### Tabela
```{r}
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
mutate (
tempo = if_else (
tempo == 0 ,
"Pré tratamento" ,
if_else (tempo == 1 , "Pós tratamento" , "Follow-up" )
),
tempo = factor (
tempo,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
group_by (tempo, grupo) |>
summarise (
média = round (mean (fpme, na.rm = T), 2 ),
dp = round (sd (fpme, na.rm = T), 2 ),
.groups = "drop"
) |>
gt () |>
tab_header (
title = "Média da força de preensão palmar esquerda" ,
subtitle = "Por grupo e tempo"
)
```
##### Gráfico
```{r}
ggplotly (
df_model |>
mutate (grupo = if_else (grupo == 0 , "Controle" , "Intervenção" )) |>
group_by (grupo, tempo) |>
summarise (
media = mean (fpme, na.rm = T),
dp = sd (fpme, na.rm = T),
.groups = "drop"
) |>
ggplot (aes (y = media, x = tempo, color = factor (grupo))) +
geom_point (position = position_dodge (0.1 ), stat = "identity" ) +
geom_line (position = position_dodge (0.1 ), stat = "identity" ) +
geom_errorbar (
aes (ymin = media - dp, ymax = media + dp, width = .2 ),
position = position_dodge (0.1 )
) +
theme_classic () +
scale_color_grey () +
ylab ("Média da força de preensão palmar esquerda" ) +
xlab (NULL ) +
labs (color = "Grupos" )
) |>
layout (
xaxis = list (
ticktext = list ("Pré tratamento" , "Pós tratamento" , "Follow-up" ),
tickvals = list (0 , 1 , 2 )
)
)
```
:::
#### Modelo
::: {.panel-tabset}
##### Resumo
```{r}
# Modelo com intercepto aleatório por paciente (modelo 1)
modelo_10.1 <- lmer (
fpme ~ factor (tempo) * factor (grupo) + (1 | nome),
data = df_model
)
tbl_10.1 <- modelo_10.1 |>
parameters:: parameters (effects = "fixed" ) |>
tibble ()
tbl_10.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
datatable (
rownames = FALSE ,
colnames = c (
"Acompanhamento" ,
"Diferença" ,
"IC 95% Inferior" ,
"IC 95% Superior" ,
"t" ,
"p"
),
extensions = "Buttons" ,
options = list (
dom = "Bt" ,
buttons = c ("copy" , "csv" , "excel" , "pdf" ),
pageLength = 20 ,
columnDefs = list (list (
className = "dt-center" ,
targets = c ("Coefficient" , "CI_low" , "CI_high" , "t" , "p" )
))
)
) |>
formatRound (c ("Coefficient" ), 2 ) |>
formatRound (c ("CI_low" , "CI_high" , "t" , "p" ), 3 )
```
##### Gráfico
```{r}
ggplotly (
tbl_10.1 |>
filter (stringr:: str_detect (Parameter, "factor \\ (grupo \\ )1" )) |>
mutate (
Parameter = case_when (
Parameter == "factor(grupo)1" ~ "Pré tratamento" ,
Parameter == "factor(tempo)1:factor(grupo)1" ~ "Pós tratamento" ,
Parameter == "factor(tempo)2:factor(grupo)1" ~ "Follow-up"
)
) |>
mutate (
Parameter = factor (
Parameter,
levels = c ("Pré tratamento" , "Pós tratamento" , "Follow-up" )
)
) |>
select (! c (df_error, SE, CI, Effects)) |>
ggplot (aes (x = Parameter, y = Coefficient)) +
geom_line () +
geom_errorbar (width = .1 , aes (ymin = CI_low, ymax = CI_high)) +
geom_point (shape = 21 , size = 3 , fill = "white" ) +
theme_classic () +
ylab ("Diferença média da força de preensão palmar esquerda" ) +
xlab (" " ) +
geom_hline (yintercept = 0 )
)
```
##### Tabela completa
```{r}
modelo_10.1 |> jtools:: summ (confint = TRUE , digits = 3 )
```
##### Avaliação de suposições
```{r}
DHARMa:: simulateResiduals (modelo_10.1 ) |> plot ()
performance:: check_collinearity (modelo_10.1 )
```
:::
<br>
<br>
<br>
<br>