diff --git a/README.md b/README.md index 7bc69ad..6071a98 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # Análise de Dados projeto Fernando Pina (INTO-2017) +- Ângulo de torção x impacto no fêmur-acebatular +$$ torcao \~ alfa + ladodor $$ diff --git a/figures/AlfTor_CAM_D.png b/figures/AlfTor_CAM_D.png new file mode 100644 index 0000000..d08bb81 Binary files /dev/null and b/figures/AlfTor_CAM_D.png differ diff --git a/figures/AlfTor_CAM_E.png b/figures/AlfTor_CAM_E.png new file mode 100644 index 0000000..7263f44 Binary files /dev/null and b/figures/AlfTor_CAM_E.png differ diff --git a/figures/AlfTor_IMPACTO_D.png b/figures/AlfTor_IMPACTO_D.png new file mode 100644 index 0000000..8901804 Binary files /dev/null and b/figures/AlfTor_IMPACTO_D.png differ diff --git a/figures/AlfTor_IMPACTO_E.png b/figures/AlfTor_IMPACTO_E.png new file mode 100644 index 0000000..d8d8aee Binary files /dev/null and b/figures/AlfTor_IMPACTO_E.png differ diff --git a/figures/AlfTor_MISTO_D.png b/figures/AlfTor_MISTO_D.png new file mode 100644 index 0000000..48eee38 Binary files /dev/null and b/figures/AlfTor_MISTO_D.png differ diff --git a/figures/AlfTor_MISTO_E.png b/figures/AlfTor_MISTO_E.png new file mode 100644 index 0000000..32df59c Binary files /dev/null and b/figures/AlfTor_MISTO_E.png differ diff --git a/figures/AlfTor_PINCER_D.png b/figures/AlfTor_PINCER_D.png new file mode 100644 index 0000000..b2e70b4 Binary files /dev/null and b/figures/AlfTor_PINCER_D.png differ diff --git a/figures/AlfTor_PINCER_E.png b/figures/AlfTor_PINCER_E.png new file mode 100644 index 0000000..af7eb73 Binary files /dev/null and b/figures/AlfTor_PINCER_E.png differ diff --git a/figures/AlfTor_dor_D.png b/figures/AlfTor_dor_D.png new file mode 100644 index 0000000..a660416 Binary files /dev/null and b/figures/AlfTor_dor_D.png differ diff --git a/figures/AlfTor_dor_E.png b/figures/AlfTor_dor_E.png new file mode 100644 index 0000000..108e1c5 Binary files /dev/null and b/figures/AlfTor_dor_E.png differ diff --git a/figures/CAM_dor_lat.png b/figures/CAM_dor_lat.png new file mode 100644 index 0000000..88b9dac Binary files /dev/null and b/figures/CAM_dor_lat.png differ diff --git a/figures/CAM_sex.png b/figures/CAM_sex.png new file mode 100644 index 0000000..22ef89b Binary files /dev/null and b/figures/CAM_sex.png differ diff --git a/figures/CAM_sex_lat.png b/figures/CAM_sex_lat.png new file mode 100644 index 0000000..88727ca Binary files /dev/null and b/figures/CAM_sex_lat.png differ diff --git a/figures/MISTO_dor_lat.png b/figures/MISTO_dor_lat.png new file mode 100644 index 0000000..2f00e78 Binary files /dev/null and b/figures/MISTO_dor_lat.png differ diff --git a/figures/MISTO_sex.png b/figures/MISTO_sex.png new file mode 100644 index 0000000..456d797 Binary files /dev/null and b/figures/MISTO_sex.png differ diff --git a/figures/MISTO_sex_lat.png b/figures/MISTO_sex_lat.png new file mode 100644 index 0000000..611e394 Binary files /dev/null and b/figures/MISTO_sex_lat.png differ diff --git a/figures/PINCER_dor_lat.png b/figures/PINCER_dor_lat.png new file mode 100644 index 0000000..5e41b9d Binary files /dev/null and b/figures/PINCER_dor_lat.png differ diff --git a/figures/PINCER_sex.png b/figures/PINCER_sex.png new file mode 100644 index 0000000..4dc204c Binary files /dev/null and b/figures/PINCER_sex.png differ diff --git a/figures/PINCER_sex_lat.png b/figures/PINCER_sex_lat.png new file mode 100644 index 0000000..8d76797 Binary files /dev/null and b/figures/PINCER_sex_lat.png differ diff --git a/figures/painel_AlfTor_CAM.png b/figures/painel_AlfTor_CAM.png new file mode 100644 index 0000000..dde793c Binary files /dev/null and b/figures/painel_AlfTor_CAM.png differ diff --git a/figures/painel_AlfTor_IMPACTO.png b/figures/painel_AlfTor_IMPACTO.png new file mode 100644 index 0000000..4d8e1e6 Binary files /dev/null and b/figures/painel_AlfTor_IMPACTO.png differ diff --git a/figures/painel_AlfTor_IMPACTO2.png b/figures/painel_AlfTor_IMPACTO2.png new file mode 100644 index 0000000..f330191 Binary files /dev/null and b/figures/painel_AlfTor_IMPACTO2.png differ diff --git a/figures/painel_AlfTor_PINCER.png b/figures/painel_AlfTor_PINCER.png new file mode 100644 index 0000000..740b46a Binary files /dev/null and b/figures/painel_AlfTor_PINCER.png differ diff --git a/figures/painel_AlfTor_dor.png b/figures/painel_AlfTor_dor.png new file mode 100644 index 0000000..a3c1083 Binary files /dev/null and b/figures/painel_AlfTor_dor.png differ diff --git a/figures/painel_Alfa_Tor_dor.png b/figures/painel_Alfa_Tor_dor.png new file mode 100644 index 0000000..b37a51e Binary files /dev/null and b/figures/painel_Alfa_Tor_dor.png differ diff --git a/figures/painel_Alfa_Tor_dor2.png b/figures/painel_Alfa_Tor_dor2.png new file mode 100644 index 0000000..5ad6075 Binary files /dev/null and b/figures/painel_Alfa_Tor_dor2.png differ diff --git a/figures/painel_Alfa_Tor_sex.png b/figures/painel_Alfa_Tor_sex.png new file mode 100644 index 0000000..f5ed6ca Binary files /dev/null and b/figures/painel_Alfa_Tor_sex.png differ diff --git a/figures/painel_Alfa_Tor_sex2.png b/figures/painel_Alfa_Tor_sex2.png new file mode 100644 index 0000000..bcf8be9 Binary files /dev/null and b/figures/painel_Alfa_Tor_sex2.png differ diff --git a/figures/painel_Tor_HHS.png b/figures/painel_Tor_HHS.png new file mode 100644 index 0000000..eddc8a4 Binary files /dev/null and b/figures/painel_Tor_HHS.png differ diff --git a/figures/painel_Tor_impacto.png b/figures/painel_Tor_impacto.png new file mode 100644 index 0000000..22c2e1c Binary files /dev/null and b/figures/painel_Tor_impacto.png differ diff --git a/figures/painel_dor.png b/figures/painel_dor.png new file mode 100644 index 0000000..471b8a3 Binary files /dev/null and b/figures/painel_dor.png differ diff --git a/figures/painel_dor_lat.png b/figures/painel_dor_lat.png new file mode 100644 index 0000000..1c50291 Binary files /dev/null and b/figures/painel_dor_lat.png differ diff --git a/figures/painel_sex.png b/figures/painel_sex.png new file mode 100644 index 0000000..c61f577 Binary files /dev/null and b/figures/painel_sex.png differ diff --git a/figures/painel_sex_lat.png b/figures/painel_sex_lat.png new file mode 100644 index 0000000..eb228a3 Binary files /dev/null and b/figures/painel_sex_lat.png differ diff --git a/report/analise_dados_FP_2017.Rmd b/report/analise_dados_FP_2017.Rmd new file mode 100644 index 0000000..cf147ec --- /dev/null +++ b/report/analise_dados_FP_2017.Rmd @@ -0,0 +1,305 @@ +--- +title: "Análise Estatística de ..." +author: '**De:** Felipe Figueiredo **Para:** ___' +date: '**Data: ** dd/mm/aaaa' +output: + html_document: + fig_caption: yes + fig_height: 6 + fig_width: 6 + keep_md: yes + number_sections: yes + toc: yes + pdf_document: + number_sections: yes + toc: yes + word_document: + fig_caption: yes + fig_height: 6 + fig_width: 6 + reference_docx: misc/style.docx + toc: yes +subtitle: 'CÓDIGO: analise_dados_FP_2017' +toc-title: "Sumário" +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE) +knitr::opts_knit$set(root.dir = normalizePath("..")) +options(scipen = 999) +library(pander) +library(knitr) +library(philsfmisc) +panderOptions('table.style', 'rmarkdown') + +``` + +--- + +**Histórico do documento** + +```{r, echo = FALSE} +Version <- c("01") +Changes <- c("Versão inicial") +history <- cbind(Version, Changes) +colnames(history) <- c("Versão", "Alterações") +pander(history, split.cells = 70) +# kable(history) +``` + +--- + +# Lista de abreviaturas + +# Introdução + +## Objetivos + +## Recepção e tratamento dos dados + +# Metodologia + +## Diagnóstico sistemático + +As medidas obtidas por avaliação clínica e radiológica foram utilizadas para classificar sistematicamente o tipo de impacto. +Foram considerados impactos CAM aqueles participantes que tinham ângulo alfa maior que 50 graus. +Para classificar o impacto do tipo PINCER foi considerada qualquer uma das seguintes medidas: + +- índice acetabuar maior que 10 graus; +- ângulo centro-borda acetabular maior que 39 graus; +- índice de extrusão menor que 10 graus. + +Participantes que possuíam tanto impacto CAM quanto PINCER no mesmo lado do quadril foram posteriormente classificados como impacto MISTO. +Observe que isto não considera um paciente com CAM em um lado e PINCER no outro como um paciente de impacto MISTO. + +### Exceções + +**CAM** + +Um participante não teve seu ângulo alfa mensurado no lado direito, ele foi diagnosticado clinicamente como não possuindo impacto CAM. + +**PINCER** + +Um segundo participante não teve seu ângulo centro-borda cetabular mensurado no lado direito, e seu diagnóstico clínico foi de que não possuía PINCER. +Um terceiro participante não teve seus índices de extrusão mensurados em ambos os lados. +Seu diagnóstico clínico foi de que possuía PINCER apenas no quadril esquerdo. + +## Análises estatísticas + +As variáveis categóricas foram avaliadas quanto às suas frequências, sendo apresentadas em porcentagem. +Associações entre duas variáveis categóricas foram avaliadas usando-se o teste exato de Fisher. +As variáveis contínuas foram descritas com médias e desvio padrão. +As diferenças médias entre dois grupos de medidas foram avaliadas com o teste t de Student. + +Além dos testes de significância, diversos modelos estatísticos foram criados para avaliar hipóteses sobre a relação entre os desfechos de interesse e os ângulos mensurados, como torção. + + +Quando o desfecho era uma variável categória com 3 ou mais categorias, como por exemplo o lado doloroso (direito, esquerdo ou bilateral) usou-se o modelo de regressão multinomial. + +Esta estratégia de modelagem permite estimar a Razão de Chance de uma determinada combinação de fatores e medidas afetar a probabilidade de trocar de uma categoria para outra. +Por exemplo, o tipo de impacto que o participante apresenta pode aumentar a chance do participante sentir dor naquele lado, mas isso pode ocorrer de forma diferenciada para cada gênero, ou ser influenciada pelo ângulo de torção, IMC, etc. +Assim é possível controlar o efeito observado por outros fatores que possam estar relacionados. + +Para avaliar a influência de diversos fatores na medida do ângulo de torção, foram usados modelos de regressão linear múltipla, o que permite controlar a observação do efeito por fatores adicionais que possivelmente influenciam no valor deste ângulo. + +Todas as análises foram realizadas utilizando-se o software `R` versão `r getRversion()`. + + + +# Resultados + +```{r include=FALSE} +source('scripts/descritiva.R', encoding = 'UTF-8') +``` + +## Descrição dos participantes do estudo + +A Tabela 1 apresenta as características gerais dos participantes do estudo. + +```{r echo=FALSE} +pander(tab1) +``` + +Table: **Tabela 1** Descrição dos participantes do estudo (N = 26). +sd = Desvio padrão, +IMC = Índice de massa corpórea, +HHS = Harris hip score (modificado). + +```{r echo=FALSE} +pander(sum.lado) +panderOptions('table.split.table', 120) +``` + +Table: **Tabela 2** Descrição das mensurações avaliadas e os tipos de impacto em cada lado do quadril. +sd = Desvio padrão, +ALFA = ângulo alfa, +IA = índice acetabular, +ACB = ângulo centro-borda acetabular, +EXTRU = índice de extrusão. +p = teste t de Student para variáveis contínuas, e teste exato de Fisher para impacto. + +Observou-se que, na média, o ângulo alfa foi significativamente maior no lado direito dos pacientes que o medido no lado esquerdo (Tabela 2). +As outras mensurações parecem ser homogeneamente distribuídas em ambos os lados. +O mesmo ocorre com a distribuição de frequências doso tipos de impacto em ambos os quadris de cada paciente. + + + +```{r} +pander(sum.gen) +``` + +Table: **Tabela 3** Mensurações avaliadas e tipos de impacto observados por gênero. +sd = Desvio padrão, +IMC = Índice de massa corpórea, +p = teste t de Student para variáveis contínuas, e teste exato de Fisher para impacto. + +O IMC médio dos homens é significativamente maior que o das mulheres (tabela 3). +A idade média, lado doloroso e o tipo de impacto dos participantes de cada gênero apresentou boa homogeneidade. + + + +```{r} +pander(sum.dor) +``` + +Table: **Tabela 4** Descrição dos participantes quanto ao lado doloroso. +sd = Desvio padrão, +IMC = Índice de massa corpórea, +p = teste t de Student para variáveis contínuas, e teste exato de Fisher para impacto. + +Não houve associação significativa entre idade, IMC ou a dsitribuição dos tipos de impacto e o lado doloroso (Tabela 4). + +Além disso, os participantes brancos e de outras raças tem distribuições semelhantes de gênero +(p = `r format.pval(fisher.test(with(dados, table(RACA, SEXO)))$p.value, digits = 4)`), +idade +(p = `r format.pval(with(dados, t.test(IDADE~RACA))$p.value, digits = 4)`). +Os participantes brancos tem IMC ligeiramente menor que de outras raças +(p = `r format.pval(with(dados, t.test(IMC~RACA))$p.value, digits = 4)`). +Não houve diferença entre os participants brancos e de outras raças quanto à observação de CAM +(p = `r format.pval(fisher.test(with(dados, table(RACA, CAM)))$p.value, digits = 4)`), +PINCER +(p = `r format.pval(fisher.test(with(dados, table(RACA, PINCER)))$p.value, digits = 4)`) +ou impacto MISTO +(p = `r format.pval(fisher.test(with(dados, table(RACA, MISTO)))$p.value, digits = 4)`). + +## Frequências dos impactos + +```{r} +pander(with(impacto, table(CAM, PINCER))) +``` + +Table: Impactos CAM x PINCER, p-value = 0.2631 + +```{r} +pander(with(impacto.lat, table(CAM, PINCER))) +``` + +Table: Impactos CAM x PINCER, levando em conta lateralidade p-value = 0.1918 + +Há 2 participantes que tem simultaneamente CAM e PINCER, mas em lados diferentes (1 participante tem CAM D e PINCER E, e o outro tem CAM E e PINCER D). +Por isso, não são contabilizados como casos de impacto MISTO. + +![](../figures/painel_dor.png) + +## Por sexo + +Os impactos ocorrem de forma diferenciada por sexo? + +### Geral + +```{r} +pander(with(impacto, table(CAM, SEXO))) +``` + +Table: CAM p-value = 0.04682 + +```{r} +pander(with(impacto, table(PINCER, SEXO))) +``` + +Table: PINCER p-value = 0.3574 + +```{r} +pander(with(impacto, table(MISTO, SEXO))) +``` + +Table: MISTO p-value = 1.000 + +### Controlado pelo lado do impacto + +```{r} +pander(with(impacto.lat[CAM != "N"], table(CAM, SEXO))) +``` + +Table: CAM p-value = 0.7014 + +```{r} +pander(with(impacto.lat[PINCER != "N"], table(PINCER, SEXO))) +``` + +Table: PINCER p-value = 0.06238 + +```{r} +pander(with(impacto.lat[MISTO != "N"], table(MISTO, SEXO))) +``` + +Table: MISTO p-value = 1.000 + +![](../figures/painel_sex_lat.png) + + +## Por lado de dor + +O impacto é um bom preditor para em que lado o participante sente dor? + +### Geral + +```{r} +pander(with(impacto, table(CAM, DOR))) +``` + +Table: CAM p-value = 1.000 + +```{r} +pander(with(impacto, table(PINCER, DOR))) +``` + +Table: PINCER p-value = 0.8616 + +```{r} +pander(with(impacto, table(MISTO, DOR))) +``` + +Table: MISTO p-value = 0.5662 + +### Controlado pelo lado do impacto + +```{r} +pander(with(impacto.lat[CAM != "N"], table(CAM, DOR))) +``` + +Table: CAM p-value = 0.07675 + +```{r} +pander(with(impacto.lat[PINCER != "N"], table(PINCER, DOR))) +``` + +Table: PINCER p-value = 0.5243 + +```{r} +pander(with(impacto.lat[MISTO != "N"], table(MISTO, DOR))) +``` + +Table: MISTO p-value = 0.1333 + +![](../figures/painel_dor_lat.png) + + + +# Conclusões + + +# Referências + +# Apêndice + diff --git a/report/analise_dados_FP_2017.md b/report/analise_dados_FP_2017.md new file mode 100644 index 0000000..ee9d37e --- /dev/null +++ b/report/analise_dados_FP_2017.md @@ -0,0 +1,384 @@ +--- +title: "Análise Estatística de ..." +author: '**De:** Felipe Figueiredo **Para:** ___' +date: '**Data: ** dd/mm/aaaa' +output: + html_document: + fig_caption: yes + fig_height: 6 + fig_width: 6 + keep_md: yes + number_sections: yes + toc: yes + pdf_document: + number_sections: yes + toc: yes + word_document: + fig_caption: yes + fig_height: 6 + fig_width: 6 + reference_docx: misc/style.docx + toc: yes +subtitle: 'CÓDIGO: analise_dados_FP_2017' +toc-title: "Sumário" +--- + + + +--- + +**Histórico do documento** + + +| Versão | Alterações | +|:------:|:--------------:| +| 01 | Versão inicial | + +--- + +# Lista de abreviaturas + +# Introdução + +## Objetivos + +## Recepção e tratamento dos dados + +# Metodologia + +## Diagnóstico sistemático + +As medidas obtidas por avaliação clínica e radiológica foram utilizadas para classificar sistematicamente o tipo de impacto. +Foram considerados impactos CAM aqueles participantes que tinham ângulo alfa maior que 50 graus. +Para classificar o impacto do tipo PINCER foi considerada qualquer uma das seguintes medidas: + +- índice acetabuar maior que 10 graus; +- ângulo centro-borda acetabular maior que 39 graus; +- índice de extrusão menor que 10 graus. + +Participantes que possuíam tanto impacto CAM quanto PINCER no mesmo lado do quadril foram posteriormente classificados como impacto MISTO. +Observe que isto não considera um paciente com CAM em um lado e PINCER no outro como um paciente de impacto MISTO. + +### Exceções + +**CAM** + +Um participante não teve seu ângulo alfa mensurado no lado direito, ele foi diagnosticado clinicamente como não possuindo impacto CAM. + +**PINCER** + +Um segundo participante não teve seu ângulo centro-borda cetabular mensurado no lado direito, e seu diagnóstico clínico foi de que não possuía PINCER. +Um terceiro participante não teve seus índices de extrusão mensurados em ambos os lados. +Seu diagnóstico clínico foi de que possuía PINCER apenas no quadril esquerdo. + +## Análises estatísticas + +As variáveis categóricas foram avaliadas quanto às suas frequências, sendo apresentadas em porcentagem. +Associações entre duas variáveis categóricas foram avaliadas usando-se o teste exato de Fisher. +As variáveis contínuas foram descritas com médias e desvio padrão. +As diferenças médias entre dois grupos de medidas foram avaliadas com o teste t de Student. + +Além dos testes de significância, diversos modelos estatísticos foram criados para avaliar hipóteses sobre a relação entre os desfechos de interesse e os ângulos mensurados, como torção. + + +Quando o desfecho era uma variável categória com 3 ou mais categorias, como por exemplo o lado doloroso (direito, esquerdo ou bilateral) usou-se o modelo de regressão multinomial. + +Esta estratégia de modelagem permite estimar a Razão de Chance de uma determinada combinação de fatores e medidas afetar a probabilidade de trocar de uma categoria para outra. +Por exemplo, o tipo de impacto que o participante apresenta pode aumentar a chance do participante sentir dor naquele lado, mas isso pode ocorrer de forma diferenciada para cada gênero, ou ser influenciada pelo ângulo de torção, IMC, etc. +Assim é possível controlar o efeito observado por outros fatores que possam estar relacionados. + +Para avaliar a influência de diversos fatores na medida do ângulo de torção, foram usados modelos de regressão linear múltipla, o que permite controlar a observação do efeito por fatores adicionais que possivelmente influenciam no valor deste ângulo. + +Todas as análises foram realizadas utilizando-se o software `R` versão 3.4.3. + + + +# Resultados + + + +## Descrição dos participantes do estudo + +A Tabela 1 apresenta as características gerais dos participantes do estudo. + + +|   | level | Overall | +|:---------------------:|:------:|:-------------:| +| **n** | | 26 | +| **SEXO (%)** | F | 7 (26.9) | +| | M | 19 (73.1) | +| **IDADE (mean (sd))** | | 35.00 (6.70) | +| **RACA (%)** | Outros | 7 (26.9) | +| | Branca | 19 (73.1) | +| **IMC (mean (sd))** | | 24.02 (4.15) | +| **LADO DOR (%)** | D | 13 (50.0) | +| | E | 4 (15.4) | +| | B | 9 (34.6) | +| **HHS (mean (sd))** | | 67.12 (13.25) | + +Table: **Tabela 1** Descrição dos participantes do estudo (N = 26). +sd = Desvio padrão, +IMC = Índice de massa corpórea, +HHS = Harris hip score (modificado). + + +|   | level | D | E | p | +|:----------------------:|:------:|:-------------:|:-------------:|:-----:| +| **TORCAO (mean (sd))** | | 14.15 (10.30) | 15.00 (7.81) | 0.740 | +| **ALFA (mean (sd))** | | 63.84 (14.03) | 55.42 (12.04) | 0.026 | +| **IA (mean (sd))** | | 1.42 (4.94) | 0.73 (5.33) | 0.629 | +| **ACB (mean (sd))** | | 34.68 (8.93) | 32.00 (7.48) | 0.250 | +| **EXTRU (mean (sd))** | | 14.52 (10.76) | 14.92 (13.00) | 0.906 | +| **IMPACTO (%)** | NORMAL | 11 ( 42.3) | 9 ( 34.6) | 0.532 | +| | CAM | 9 ( 34.6) | 7 ( 26.9) | | +| | PINCER | 1 ( 3.8) | 4 ( 15.4) | | +| | MISTO | 5 ( 19.2) | 6 ( 23.1) | | + +Table: **Tabela 2** Descrição das mensurações avaliadas e os tipos de impacto em cada lado do quadril. +sd = Desvio padrão, +ALFA = ângulo alfa, +IA = índice acetabular, +ACB = ângulo centro-borda acetabular, +EXTRU = índice de extrusão. +p = teste t de Student para variáveis contínuas, e teste exato de Fisher para impacto. + +Observou-se que, na média, o ângulo alfa foi significativamente maior no lado direito dos pacientes que o medido no lado esquerdo (Tabela 2). +As outras mensurações parecem ser homogeneamente distribuídas em ambos os lados. +O mesmo ocorre com a distribuição de frequências doso tipos de impacto em ambos os quadris de cada paciente. + + + + +|   | level | F | M | p | +|:---------------------:|:-------:|:------------:|:------------:|:------:| +| **n** | | 7 | 19 | | +| **IDADE (mean (sd))** | | 35.00 (6.38) | 35.00 (6.98) | 1.000 | +| **IMC (mean (sd))** | | 19.54 (2.44) | 25.67 (3.36) | <0.001 | +| **DOR (%)** | D | 4 ( 57.1) | 9 ( 47.4) | 0.603 | +| | E | 0 ( 0.0) | 4 ( 21.1) | | +| | B | 3 ( 42.9) | 6 ( 31.6) | | +| **CAM (%)** | N | 3 ( 42.9) | 1 ( 5.3) | 0.112 | +| | D | 2 ( 28.6) | 4 ( 21.1) | | +| | E | 0 ( 0.0) | 2 ( 10.5) | | +| | B | 2 ( 28.6) | 12 ( 63.2) | | +| **PINCER (%)** | N | 1 ( 14.3) | 8 ( 42.1) | 0.044 | +| | D | 0 ( 0.0) | 4 ( 21.1) | | +| | E | 0 ( 0.0) | 3 ( 15.8) | | +| | B | 6 ( 85.7) | 4 ( 21.1) | | +| **MISTO (%)** | Simples | 4 ( 57.1) | 11 ( 57.9) | 0.909 | +| | D | 1 ( 14.3) | 3 ( 15.8) | | +| | E | 0 ( 0.0) | 2 ( 10.5) | | +| | B | 2 ( 28.6) | 3 ( 15.8) | | + +Table: **Tabela 3** Mensurações avaliadas e tipos de impacto observados por gênero. +sd = Desvio padrão, +IMC = Índice de massa corpórea, +p = teste t de Student para variáveis contínuas, e teste exato de Fisher para impacto. + +O IMC médio dos homens é significativamente maior que o das mulheres (tabela 3). +A idade média, lado doloroso e o tipo de impacto dos participantes de cada gênero apresentou boa homogeneidade. + + + + +|   | level | D | E | B | p | +|:---------------------:|:-------:|:------------:|:------------:|:------------:|:-----:| +| **n** | | 13 | 4 | 9 | | +| **IDADE (mean (sd))** | | 35.23 (8.08) | 33.75 (6.24) | 35.22 (5.17) | 0.927 | +| **IMC (mean (sd))** | | 24.24 (4.85) | 24.35 (2.76) | 23.57 (3.91) | 0.925 | +| **CAM (%)** | N | 2 ( 15.4) | 1 ( 25.0) | 1 ( 11.1) | 0.147 | +| | D | 4 ( 30.8) | 0 ( 0.0) | 2 ( 22.2) | | +| | E | 0 ( 0.0) | 2 ( 50.0) | 0 ( 0.0) | | +| | B | 7 ( 53.8) | 1 ( 25.0) | 6 ( 66.7) | | +| **PINCER (%)** | N | 4 ( 30.8) | 1 ( 25.0) | 4 ( 44.4) | 0.711 | +| | D | 3 ( 23.1) | 1 ( 25.0) | 0 ( 0.0) | | +| | E | 1 ( 7.7) | 1 ( 25.0) | 1 ( 11.1) | | +| | B | 5 ( 38.5) | 1 ( 25.0) | 4 ( 44.4) | | +| **MISTO (%)** | Simples | 6 ( 46.2) | 3 ( 75.0) | 6 ( 66.7) | 0.237 | +| | D | 4 ( 30.8) | 0 ( 0.0) | 0 ( 0.0) | | +| | E | 1 ( 7.7) | 1 ( 25.0) | 0 ( 0.0) | | +| | B | 2 ( 15.4) | 0 ( 0.0) | 3 ( 33.3) | | + +Table: **Tabela 4** Descrição dos participantes quanto ao lado doloroso. +sd = Desvio padrão, +IMC = Índice de massa corpórea, +p = teste t de Student para variáveis contínuas, e teste exato de Fisher para impacto. + +Não houve associação significativa entre idade, IMC ou a dsitribuição dos tipos de impacto e o lado doloroso (Tabela 4). + +Além disso, os participantes brancos e de outras raças tem distribuições semelhantes de gênero +(p = 0.1338), +idade +(p = 0.2929). +Os participantes brancos tem IMC ligeiramente menor que de outras raças +(p = 0.03479). +Não houve diferença entre os participants brancos e de outras raças quanto à observação de CAM +(p = 0.9087), +PINCER +(p = 0.6153) +ou impacto MISTO +(p = 1). + +## Frequências dos impactos + + +|   | Ausente | PINCER | +|:-----------:|:-------:|:------:| +| **Ausente** | 0 | 4 | +| **CAM** | 9 | 13 | + +Table: Impactos CAM x PINCER, p-value = 0.2631 + + +|   | N | D | E | B | +|:------:|:-:|:-:|:-:|:-:| +| **N** | 0 | 0 | 0 | 4 | +| **D** | 2 | 2 | 1 | 1 | +| **E** | 1 | 1 | 0 | 0 | +| **B** | 6 | 1 | 2 | 5 | + +Table: Impactos CAM x PINCER, levando em conta lateralidade p-value = 0.1918 + +Há 2 participantes que tem simultaneamente CAM e PINCER, mas em lados diferentes (1 participante tem CAM D e PINCER E, e o outro tem CAM E e PINCER D). +Por isso, não são contabilizados como casos de impacto MISTO. + +![](../figures/painel_dor.png) + +## Por sexo + +Os impactos ocorrem de forma diferenciada por sexo? + +### Geral + + +|   | F | M | +|:-----------:|:-:|:--:| +| **Ausente** | 3 | 1 | +| **CAM** | 4 | 18 | + +Table: CAM p-value = 0.04682 + + +|   | F | M | +|:-----------:|:-:|:--:| +| **Ausente** | 1 | 8 | +| **PINCER** | 6 | 11 | + +Table: PINCER p-value = 0.3574 + + +|   | F | M | +|:-----------:|:-:|:--:| +| **SIMPLES** | 4 | 11 | +| **MISTO** | 3 | 8 | + +Table: MISTO p-value = 1.000 + +### Controlado pelo lado do impacto + + +|   | F | M | +|:------:|:-:|:--:| +| **N** | 0 | 0 | +| **D** | 2 | 4 | +| **E** | 0 | 2 | +| **B** | 2 | 12 | + +Table: CAM p-value = 0.7014 + + +|   | F | M | +|:------:|:-:|:-:| +| **N** | 0 | 0 | +| **D** | 0 | 4 | +| **E** | 0 | 3 | +| **B** | 6 | 4 | + +Table: PINCER p-value = 0.06238 + + +|   | F | M | +|:-----------:|:-:|:--:| +| **Simples** | 4 | 11 | +| **D** | 1 | 3 | +| **E** | 0 | 2 | +| **B** | 2 | 3 | + +Table: MISTO p-value = 1.000 + +![](../figures/painel_sex_lat.png) + + +## Por lado de dor + +O impacto é um bom preditor para em que lado o participante sente dor? + +### Geral + + +|   | D | E | B | +|:-----------:|:--:|:-:|:-:| +| **Ausente** | 2 | 1 | 1 | +| **CAM** | 11 | 3 | 8 | + +Table: CAM p-value = 1.000 + + +|   | D | E | B | +|:-----------:|:-:|:-:|:-:| +| **Ausente** | 4 | 1 | 4 | +| **PINCER** | 9 | 3 | 5 | + +Table: PINCER p-value = 0.8616 + + +|   | D | E | B | +|:-----------:|:-:|:-:|:-:| +| **SIMPLES** | 6 | 3 | 6 | +| **MISTO** | 7 | 1 | 3 | + +Table: MISTO p-value = 0.5662 + +### Controlado pelo lado do impacto + + +|   | D | E | B | +|:------:|:-:|:-:|:-:| +| **N** | 0 | 0 | 0 | +| **D** | 4 | 0 | 2 | +| **E** | 0 | 2 | 0 | +| **B** | 7 | 1 | 6 | + +Table: CAM p-value = 0.07675 + + +|   | D | E | B | +|:------:|:-:|:-:|:-:| +| **N** | 0 | 0 | 0 | +| **D** | 3 | 1 | 0 | +| **E** | 1 | 1 | 1 | +| **B** | 5 | 1 | 4 | + +Table: PINCER p-value = 0.5243 + + +|   | D | E | B | +|:-----------:|:-:|:-:|:-:| +| **Simples** | 6 | 3 | 6 | +| **D** | 4 | 0 | 0 | +| **E** | 1 | 1 | 0 | +| **B** | 2 | 0 | 3 | + +Table: MISTO p-value = 0.1333 + +![](../figures/painel_dor_lat.png) + + + +# Conclusões + + +# Referências + +# Apêndice + diff --git a/report/misc/style.docx b/report/misc/style.docx new file mode 100755 index 0000000..fab8854 Binary files /dev/null and b/report/misc/style.docx differ diff --git a/results/dor.csv b/results/dor.csv new file mode 100644 index 0000000..1710f11 --- /dev/null +++ b/results/dor.csv @@ -0,0 +1,16 @@ +"";"level";"D";"E";"B";"p" +"n";"";" 13";" 4";" 9";"" +"IDADE (mean (sd))";"";"35.23 (8.08)";"33.75 (6.24)";"35.22 (5.17)";" 0.927" +"IMC (mean (sd))";"";"24.24 (4.85)";"24.35 (2.76)";"23.57 (3.91)";" 0.925" +"CAM (%)";"N";" 2 ( 15.4) ";" 1 ( 25.0) ";" 1 ( 11.1) ";" 0.147" +"";"D";" 4 ( 30.8) ";" 0 ( 0.0) ";" 2 ( 22.2) ";"" +"";"E";" 0 ( 0.0) ";" 2 ( 50.0) ";" 0 ( 0.0) ";"" +"";"B";" 7 ( 53.8) ";" 1 ( 25.0) ";" 6 ( 66.7) ";"" +"PINCER (%)";"N";" 4 ( 30.8) ";" 1 ( 25.0) ";" 4 ( 44.4) ";" 0.711" +"";"D";" 3 ( 23.1) ";" 1 ( 25.0) ";" 0 ( 0.0) ";"" +"";"E";" 1 ( 7.7) ";" 1 ( 25.0) ";" 1 ( 11.1) ";"" +"";"B";" 5 ( 38.5) ";" 1 ( 25.0) ";" 4 ( 44.4) ";"" +"MISTO (%)";"Simples";" 6 ( 46.2) ";" 3 ( 75.0) ";" 6 ( 66.7) ";" 0.237" +"";"D";" 4 ( 30.8) ";" 0 ( 0.0) ";" 0 ( 0.0) ";"" +"";"E";" 1 ( 7.7) ";" 1 ( 25.0) ";" 0 ( 0.0) ";"" +"";"B";" 2 ( 15.4) ";" 0 ( 0.0) ";" 3 ( 33.3) ";"" diff --git a/results/gen.csv b/results/gen.csv new file mode 100644 index 0000000..c6404d2 --- /dev/null +++ b/results/gen.csv @@ -0,0 +1,19 @@ +"";"level";"F";"M";"p" +"n";"";" 7";" 19";"" +"IDADE (mean (sd))";"";"35.00 (6.38)";"35.00 (6.98)";" 1.000" +"IMC (mean (sd))";"";"19.54 (2.44)";"25.67 (3.36)";"<0.001" +"DOR (%)";"D";" 4 ( 57.1) ";" 9 ( 47.4) ";" 0.603" +"";"E";" 0 ( 0.0) ";" 4 ( 21.1) ";"" +"";"B";" 3 ( 42.9) ";" 6 ( 31.6) ";"" +"CAM (%)";"N";" 3 ( 42.9) ";" 1 ( 5.3) ";" 0.112" +"";"D";" 2 ( 28.6) ";" 4 ( 21.1) ";"" +"";"E";" 0 ( 0.0) ";" 2 ( 10.5) ";"" +"";"B";" 2 ( 28.6) ";" 12 ( 63.2) ";"" +"PINCER (%)";"N";" 1 ( 14.3) ";" 8 ( 42.1) ";" 0.044" +"";"D";" 0 ( 0.0) ";" 4 ( 21.1) ";"" +"";"E";" 0 ( 0.0) ";" 3 ( 15.8) ";"" +"";"B";" 6 ( 85.7) ";" 4 ( 21.1) ";"" +"MISTO (%)";"Simples";" 4 ( 57.1) ";" 11 ( 57.9) ";" 0.909" +"";"D";" 1 ( 14.3) ";" 3 ( 15.8) ";"" +"";"E";" 0 ( 0.0) ";" 2 ( 10.5) ";"" +"";"B";" 2 ( 28.6) ";" 3 ( 15.8) ";"" diff --git a/results/lado.csv b/results/lado.csv new file mode 100644 index 0000000..0149fb4 --- /dev/null +++ b/results/lado.csv @@ -0,0 +1,10 @@ +"";"level";"D";"E";"p" +"TORCAO (mean (sd))";"";"14.15 (10.30)";"15.00 (7.81)";" 0.740" +"ALFA (mean (sd))";"";"63.84 (14.03)";"55.42 (12.04)";" 0.026" +"IA (mean (sd))";"";" 1.42 (4.94)";" 0.73 (5.33)";" 0.629" +"ACB (mean (sd))";"";"34.68 (8.93)";"32.00 (7.48)";" 0.250" +"EXTRU (mean (sd))";"";"14.52 (10.76)";"14.92 (13.00)";" 0.906" +"IMPACTO (%)";"NORMAL";" 11 ( 42.3) ";" 9 ( 34.6) ";" 0.532" +"";"CAM";" 9 ( 34.6) ";" 7 ( 26.9) ";"" +"";"PINCER";" 1 ( 3.8) ";" 4 ( 15.4) ";"" +"";"MISTO";" 5 ( 19.2) ";" 6 ( 23.1) ";"" diff --git a/results/raca.csv b/results/raca.csv new file mode 100644 index 0000000..05f7cc0 --- /dev/null +++ b/results/raca.csv @@ -0,0 +1,21 @@ +"";"level";"Outros";"Branca";"p" +"n";"";" 7";" 19";"" +"SEXO (%)";"F";" 0 ( 0.0) ";" 7 ( 36.8) ";" 0.134" +"";"M";" 7 (100.0) ";" 12 ( 63.2) ";"" +"IDADE (mean (sd))";"";"37.57 (7.41)";"34.05 (6.36)";" 0.243" +"IMC (mean (sd))";"";"26.70 (3.30)";"23.04 (4.06)";" 0.043" +"DOR (%)";"D";" 3 ( 42.9) ";" 10 ( 52.6) ";" 0.697" +"";"E";" 2 ( 28.6) ";" 2 ( 10.5) ";"" +"";"B";" 2 ( 28.6) ";" 7 ( 36.8) ";"" +"CAM (%)";"N";" 1 ( 14.3) ";" 3 ( 15.8) ";" 0.909" +"";"D";" 1 ( 14.3) ";" 5 ( 26.3) ";"" +"";"E";" 1 ( 14.3) ";" 1 ( 5.3) ";"" +"";"B";" 4 ( 57.1) ";" 10 ( 52.6) ";"" +"PINCER (%)";"N";" 4 ( 57.1) ";" 5 ( 26.3) ";" 0.615" +"";"D";" 1 ( 14.3) ";" 3 ( 15.8) ";"" +"";"E";" 0 ( 0.0) ";" 3 ( 15.8) ";"" +"";"B";" 2 ( 28.6) ";" 8 ( 42.1) ";"" +"MISTO (%)";"Simples";" 5 ( 71.4) ";" 10 ( 52.6) ";" 1.000" +"";"D";" 1 ( 14.3) ";" 3 ( 15.8) ";"" +"";"E";" 0 ( 0.0) ";" 2 ( 10.5) ";"" +"";"B";" 1 ( 14.3) ";" 4 ( 21.1) ";"" diff --git a/results/tab1.csv b/results/tab1.csv new file mode 100644 index 0000000..35bd569 --- /dev/null +++ b/results/tab1.csv @@ -0,0 +1,12 @@ +"";"level";"Overall" +"n";"";" 26" +"SEXO (%)";"F";" 7 (26.9) " +"";"M";" 19 (73.1) " +"IDADE (mean (sd))";"";"35.00 (6.70)" +"RACA (%)";"Outros";" 7 (26.9) " +"";"Branca";" 19 (73.1) " +"IMC (mean (sd))";"";"24.02 (4.15)" +"LADO DOR (%)";"D";" 13 (50.0) " +"";"E";" 4 (15.4) " +"";"B";" 9 (34.6) " +"HHS (mean (sd))";"";"67.12 (13.25)" diff --git a/scripts/descritiva.R b/scripts/descritiva.R new file mode 100644 index 0000000..cfbbc9d --- /dev/null +++ b/scripts/descritiva.R @@ -0,0 +1,101 @@ +source('scripts/input.R', encoding = 'UTF-8') + +library(tableone) + +tab1 <- print(CreateTableOne(data = dados[, c(2:7)]), showAllLevels = TRUE, printToggle = FALSE) +sum.lado <- print(CreateTableOne(data = med.num,strata = "LADO"), showAllLevels = TRUE, exact = TRUE, printToggle = FALSE) +sum.gen <- print(CreateTableOne(data = dados[, .(SEXO, IDADE, IMC, DOR = `LADO DOR`, CAM, PINCER, MISTO)], strata = "SEXO"), exact = TRUE, showAllLevels = TRUE, printToggle = FALSE) +sum.dor <- print(CreateTableOne(data = dados[, .(IDADE, IMC, DOR = `LADO DOR`, CAM, PINCER, MISTO)], strata = "DOR"), exact = TRUE, showAllLevels = TRUE, printToggle = FALSE) +sum.rac <- print(CreateTableOne(data = dados[, .(SEXO, RACA, IDADE, IMC, DOR = `LADO DOR`, CAM, PINCER, MISTO)], strata = "RACA"), exact = TRUE, showAllLevels = TRUE, printToggle = FALSE) + +# remover variável de estratificação, filtrar colunas +sum.lado <- sum.lado[-c(1:3), 1:4] +sum.gen <- sum.gen[-c(2:3), 1:4] +sum.dor <- sum.dor[-c(4:6), 1:5] +sum.rac <- sum.rac[-c(4:5), 1:4] + +write.csv2(tab1, "results/tab1.csv") +write.csv2(sum.lado, "results/lado.csv") +write.csv2(sum.gen, "results/gen.csv") +write.csv2(sum.dor, "results/dor.csv") +write.csv2(sum.rac, "results/raca.csv") + +png("figures/painel_Alfa_Tor_dor.png") +par(mfrow = c(2,2)) +stripchart(`ALFA D` ~ `LADO DOR`, data = dados, method = "stack", vertical = TRUE, ylim = c(30, 100), pch = 19) +stripchart(`ALFA E` ~ `LADO DOR`, data = dados, method = "stack", vertical = TRUE, ylim = c(30, 100), pch = 19) +stripchart(`TORCAO D` ~ `LADO DOR`, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19) +stripchart(`TORCAO E` ~ `LADO DOR`, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19) +dev.off() + +png("figures/painel_Alfa_Tor_dor2.png") +par(mfrow = c(2,2)) +with(dados, plot(`ALFA D` ~ `LADO DOR`, ylim = c(30, 100))) +stripchart(`ALFA D` ~ `LADO DOR`, data = dados, method = "stack", vertical = TRUE, ylim = c(30, 100), pch = 19, add = TRUE) +with(dados, plot(`ALFA E` ~ `LADO DOR`, ylim = c(30, 100))) +stripchart(`ALFA E` ~ `LADO DOR`, data = dados, method = "stack", vertical = TRUE, ylim = c(30, 100), pch = 19, add = TRUE) +with(dados, plot(`TORCAO D` ~ `LADO DOR`, ylim = c(0, 40))) +stripchart(`TORCAO D` ~ `LADO DOR`, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19, add = TRUE) +with(dados, plot(`TORCAO E` ~ `LADO DOR`, ylim = c(0, 40))) +stripchart(`TORCAO E` ~ `LADO DOR`, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19, add = TRUE) +dev.off() + +CreateTableOne( + data = dados[, .(`ALFA D`, `ALFA E`, `TORCAO D`, `TORCAO E`, DOR = `LADO DOR`, SEXO)], + strata = "DOR" + ) + +png("figures/painel_Alfa_Tor_sex2.png") +par(mfrow = c(2,2)) +with(dados, plot(`ALFA D` ~ SEXO, ylim = c(30, 100))) +stripchart(`ALFA D` ~ SEXO, data = dados, method = "stack", vertical = TRUE, ylim = c(30, 100), pch = 19, add = TRUE) +with(dados, plot(`ALFA E` ~ SEXO, ylim = c(30, 100))) +stripchart(`ALFA E` ~ SEXO, data = dados, method = "stack", vertical = TRUE, ylim = c(30, 100), pch = 19, add = TRUE) +with(dados, plot(`TORCAO D` ~ SEXO, ylim = c(0, 40))) +stripchart(`TORCAO D` ~ SEXO, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19, add = TRUE) +with(dados, plot(`TORCAO E` ~ SEXO, ylim = c(0, 40))) +stripchart(`TORCAO E` ~ SEXO, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19, add = TRUE) +dev.off() + +png("figures/painel_Alfa_Tor_sex.png") +par(mfrow = c(2,2)) +stripchart(`ALFA D` ~ SEXO, data = dados, method = "stack", vertical = TRUE, ylim = c(30, 100), pch = 19) +stripchart(`ALFA E` ~ SEXO, data = dados, method = "stack", vertical = TRUE, ylim = c(30, 100), pch = 19) +stripchart(`TORCAO D` ~ SEXO, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19) +stripchart(`TORCAO E` ~ SEXO, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19) +dev.off() + +CreateTableOne( + data = dados[, .(`ALFA D`, `ALFA E`, `TORCAO D`, `TORCAO E`, DOR = `LADO DOR`, SEXO)], + strata = "SEXO" + ) + +# IMPACTO (geral) +fisher.test(with(impacto, table(SEXO, CAM))) +fisher.test(with(impacto, table(SEXO, PINCER))) +fisher.test(with(impacto, table(SEXO, MISTO))) + +fisher.test(with(impacto, table(CAM, SEXO))) +fisher.test(with(impacto, table(PINCER, SEXO))) +fisher.test(with(impacto, table(MISTO, SEXO))) + +# controlando pelo lado do impacto +fisher.test(with(impacto.lat[CAM != "N"], table(CAM, SEXO))) +fisher.test(with(impacto.lat[PINCER != "N"], table(PINCER, SEXO))) +fisher.test(with(impacto.lat[MISTO != "Simples"], table(MISTO, SEXO))) + +# png("figures/impactos_sexo.png", 1200, 500) +# par(mfrow = c(1,3)) +# mybarplot(with(impacto, table(CAM, SEXO)), "GENERO", "Impacto", ylim = c(0,20)) +# mybarplot(with(impacto, table(PINCER, SEXO)), "GENERO", "Impacto", ylim = c(0,20)) +# mybarplot(with(impacto, table(MISTO, SEXO)), "GENERO", "Impacto", ylim = c(0,20)) +# dev.off() + +# Lado de dor é um bom preditor para impacto? +fisher.test(with(impacto, table(DOR, CAM))) +fisher.test(with(impacto, table(DOR, PINCER))) +fisher.test(with(impacto, table(DOR, MISTO))) + +fisher.test(with(impacto.lat[CAM != "N"], table(DOR, CAM))) +fisher.test(with(impacto.lat[PINCER != "N"], table(DOR, PINCER))) +fisher.test(with(impacto.lat[MISTO != "Simples"], table(DOR, MISTO))) diff --git a/scripts/graficos.R b/scripts/graficos.R new file mode 100644 index 0000000..6c2da71 --- /dev/null +++ b/scripts/graficos.R @@ -0,0 +1,382 @@ +source('scripts/input.R', encoding = 'UTF-8') + +library(ggplot2) + +ggplot(dados, aes(`ALFA D`, `TORCAO D`, col = `LADO DOR`)) + + geom_point() + theme(legend.position = "bottom") + + # geom_smooth(method = "lm", se = F) + geom_smooth(method = "lm", se = F, mapping = aes(col = `LADO DOR`)) +ggsave("figures/AlfTor_dor_D.png") + +ggplot(dados, aes(`ALFA E`, `TORCAO E`, col = `LADO DOR`)) + + geom_point(aes(`ALFA E`, `TORCAO E`, col = `LADO DOR`)) + theme(legend.position = "bottom") + + geom_smooth(method = "lm", se = F, mapping = aes(col = `LADO DOR`)) +ggsave("figures/AlfTor_dor_E.png") + +ggplot(dados[`CAM D` == "CAM"], aes(`ALFA D`, `TORCAO D`)) + + ggtitle("CAM D") + + geom_point() + theme(legend.position = "none") + + geom_smooth(method = "lm", se = F) +ggsave("figures/AlfTor_CAM_D.png") + +ggplot(dados[`CAM E` == "CAM"], aes(`ALFA E`, `TORCAO E`)) + + ggtitle("CAM E") + + geom_point() + theme(legend.position = "bottom") + + geom_smooth(method = "lm", se = F) +ggsave("figures/AlfTor_CAM_E.png") + +ggplot(dados[`PINCER D` == TRUE], aes(`ALFA D`, `TORCAO D`)) + + ggtitle("PINCER D") + + geom_point() + theme(legend.position = "bottom") + + geom_smooth(method = "lm", se = F) +ggsave("figures/AlfTor_PINCER_D.png") + +ggplot(dados[`PINCER E` == TRUE], aes(`ALFA E`, `TORCAO E`)) + + ggtitle("PINCER E") + + geom_point() + theme(legend.position = "bottom") + + geom_smooth(method = "lm", se = F) +ggsave("figures/AlfTor_PINCER_E.png") + +ggplot(dados[`MISTO D` == TRUE], aes(`ALFA D`, `TORCAO D`)) + + ggtitle("MISTO D") + + geom_point() + theme(legend.position = "bottom") + + geom_smooth(method = "lm", se = F) +ggsave("figures/AlfTor_MISTO_D.png") + +ggplot(dados[`MISTO E` == TRUE], aes(`ALFA E`, `TORCAO E`)) + + ggtitle("MISTO E") + + geom_point() + theme(legend.position = "bottom") + + geom_smooth(method = "lm", se = F) +ggsave("figures/AlfTor_MISTO_E.png") + +# SEPARADO POR IMPACTO +ggplot(dados[`IMPACTO D` != "NORMAL"], aes(`ALFA D`, `TORCAO D`, col = `IMPACTO D`, shape = `IMPACTO D`)) + + geom_point(size = 2) + + theme(legend.position = "bottom") + + geom_smooth(method = "lm", se = F, size = .6) +ggsave("figures/AlfTor_IMPACTO_D.png") + +ggplot(dados[`IMPACTO E` != "NORMAL"], aes(`ALFA E`, `TORCAO E`, col = `IMPACTO E`, shape = `IMPACTO E`)) + + geom_point(size = 2) + + theme(legend.position = "bottom") + + geom_smooth(method = "lm", se = F, size = .6) +ggsave("figures/AlfTor_IMPACTO_E.png") + +# paineis por lado + +ggplot(d.num, aes(ALFA, TORCAO, col = DOR)) + + theme(legend.position = "bottom") + + geom_point() + + geom_smooth(method = "lm", se = FALSE) + + facet_grid(~ LADO) +ggsave("figures/painel_AlfTor_dor.png") + +# ggplot(d.num[d$CAM != "N",], aes(ALFA, TORCAO, col = CAM)) + +ggplot(d.num, aes(ALFA, TORCAO, col = CAM)) + + theme(legend.position = "bottom") + + geom_point() + + geom_smooth(method = "lm", se = FALSE) + + facet_grid(~ LADO) +ggsave("figures/painel_AlfTor_CAM.png") + +# ggplot(d.num[d$PINCER != "N",], aes(ALFA, TORCAO, col = PINCER)) + +ggplot(d.num, aes(ALFA, TORCAO, col = PINCER)) + + theme(legend.position = "bottom") + + geom_point() + + geom_smooth(method = "lm", se = FALSE) + + facet_grid(~ LADO) +ggsave("figures/painel_AlfTor_PINCER.png") + +# ggplot(d.num[d$IMPACTO != "NORMAL",], aes(ALFA, TORCAO, col = IMPACTO)) + +ggplot(d.num, aes(ALFA, TORCAO, col = IMPACTO)) + + theme(legend.position = "bottom") + + geom_point() + + geom_smooth(method = "lm", se = FALSE) + + facet_grid(~ LADO) +ggsave("figures/painel_AlfTor_IMPACTO.png") + +ggplot(d.num[d.num$IMPACTO != "NORMAL",], aes(ALFA, TORCAO)) + + theme(legend.position = "bottom") + + geom_point() + + geom_smooth(method = "lm", se = FALSE) + + facet_grid(IMPACTO ~ LADO, margins = "IMPACTO") +ggsave("figures/painel_AlfTor_IMPACTO2.png") + +# ggplot(gather(dados[, .(SEXO, `IMPACTO D`, `IMPACTO E`)], LADO, IMPACTO, `IMPACTO D`, `IMPACTO E`, -SEXO), aes(IMPACTO)) + geom_bar(aes(fill = SEXO)) +# ggplot(dados, aes(`IMPACTO D`)) + geom_bar(aes(fill = SEXO), position = "dodge") +# ggplot(dados, aes(`IMPACTO E`)) + geom_bar(aes(fill = SEXO), position = "dodge") +# ggplot(dados, aes(`CAM D`)) + geom_bar(aes(fill = SEXO), position = "dodge") +# ggplot(dados, aes(`CAM E`)) + geom_bar(aes(fill = SEXO), position = "dodge") +# ggplot(dados, aes(`PINCER D`)) + geom_bar(aes(fill = SEXO), position = "dodge") +# ggplot(dados, aes(`PINCER E`)) + geom_bar(aes(fill = SEXO), position = "dodge") +# ggplot(dados, aes(`MISTO D`)) + geom_bar(aes(fill = SEXO), position = "dodge") +# ggplot(dados, aes(`MISTO E`)) + geom_bar(aes(fill = SEXO), position = "dodge") + +# ggplot(dados, aes(CAM)) + geom_bar(aes(fill = SEXO), position = "dodge") + scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + ylab("Participantes") +# ggplot(dados, aes(CAM)) + geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO), position = "dodge") + scale_y_continuous(labels = percent, limits = c(0, 1)) + ylab("Participantes") +# ggplot(dados, aes(CAM)) + geom_bar(aes(fill = SEXO)) + scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + ylab("Participantes") +# ggsave("figures/CAM.png") + +# ggplot(dados, aes(PINCER)) + geom_bar(aes(fill = SEXO)) + scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + ylab("Participantes") +# ggplot(dados, aes(PINCER)) + geom_bar(aes(fill = SEXO), position = "dodge") + scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + ylab("Participantes") +# ggplot(dados, aes(PINCER)) + geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO), position = "dodge") + scale_y_continuous(labels = percent, limits = c(0, 1)) + ylab("Participantes") +# ggsave("figures/PINCER.png") + +# ggplot(dados, aes(MISTO)) + geom_bar(aes(fill = SEXO)) + scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + ylab("Participantes") +# ggplot(dados, aes(MISTO)) + geom_bar(aes(fill = SEXO), position = "dodge") + scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + ylab("Participantes") +# ggplot(dados, aes(MISTO)) + geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO), position = "dodge") + scale_y_continuous(labels = percent, limits = c(0, 1)) + ylab("Participantes") +# ggplot(dados, aes(MISTO)) + geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO)) + scale_y_continuous(labels = percent, limits = c(0, 1)) + ylab("Participantes") +# ggsave("figures/MISTO.png") + +# ggplot(impacto.lat[CAM != "N"], aes(CAM)) + +# geom_bar(aes(fill = SEXO), position = "dodge") + +# scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ylab("Participantes") + ggtitle("Casos positivos") +# ggsave("figures/CAM_pos1.png") + +# ggplot(impacto.lat[CAM != "N"], aes(CAM)) + +# geom_bar(aes(fill = SEXO)) + +# scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ylab("Participantes") + ggtitle("Casos positivos") +# ggsave("figures/CAM_pos2.png") + +# ggplot(impacto.lat[CAM != "N"], aes(CAM)) + +# geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO), position = "dodge") + +# scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ylab("Participantes") + ggtitle("Casos positivos") +# ggsave("figures/CAM_pos3.png") + +ggplot(impacto.lat, aes(CAM)) + + geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO)) + + scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + + theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + + ylab("Participantes") +ggsave("figures/CAM_sex_lat.png") + +ggplot(impacto.lat, aes(CAM)) + + geom_bar(aes(y = (..count..)/sum(..count..), fill = DOR)) + + scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + + theme(legend.position = "bottom") + scale_fill_discrete(name = "Dor") + + ylab("Participantes") +ggsave("figures/CAM_dor_lat.png") + +# ggplot(data.table(gather(dados[, .(SEXO, `CAM D`, `CAM E`)], CAM, IMPACTO, -SEXO))[IMPACTO == "CAM"], aes(CAM)) + +# geom_bar(aes(fill = SEXO)) + +# scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ylab("Participantes") + ggtitle("Casos positivos") + +# ggsave("figures/CAM_pos.png") + +# ggplot(impacto.lat[PINCER != "N"], aes(PINCER)) + +# geom_bar(aes(fill = SEXO), position = "dodge") + +# scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ylab("Participantes") + ggtitle("Casos positivos") + +# ggplot(impacto.lat[PINCER != "N"], aes(PINCER)) + +# geom_bar(aes(fill = SEXO)) + +# scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ylab("Participantes") + ggtitle("Casos positivos") + +# ggplot(data.table(gather(dados[PINCER %in% c("D", "E"), .(SEXO, `PINCER D`, `PINCER E`)], PINCER, IMPACTO, -SEXO))[IMPACTO == TRUE], aes(PINCER)) + +# geom_bar(aes(fill = SEXO)) + +# scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ylab("Participantes") + ggtitle("Casos positivos") + +# ggsave("figures/PINCER_pos.png") + +ggplot(impacto.lat, aes(PINCER)) + + geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO)) + + scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + + theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + + ylab("Participantes") +ggsave("figures/PINCER_sex_lat.png") + +ggplot(impacto.lat, aes(PINCER)) + + geom_bar(aes(y = (..count..)/sum(..count..), fill = DOR)) + + scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + + theme(legend.position = "bottom") + scale_fill_discrete(name = "Dor") + + ylab("Participantes") +ggsave("figures/PINCER_dor_lat.png") + +# ggplot(impacto.lat[MISTO != "Simples"], aes(MISTO)) + +# geom_bar(aes(fill = SEXO), position = "dodge") + +# scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ggtitle("Casos positivos") + +# ggplot(impacto.lat[MISTO != "Simples"], aes(MISTO)) + +# geom_bar(aes(fill = SEXO)) + +# scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ggtitle("Casos positivos") + +# ggplot(data.table(gather(dados[MISTO != "B", .(SEXO, `MISTO D`, `MISTO E`)], MISTO, IMPACTO, -SEXO))[IMPACTO == TRUE], aes(MISTO)) + +# geom_bar(aes(fill = SEXO)) + +# scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# ggtitle("Casos positivos") + +# ggplot(data.table(gather(dados[, .(SEXO, `MISTO D`, `MISTO E`)], MISTO, IMPACTO, -SEXO))[IMPACTO == TRUE], aes(MISTO)) + geom_bar(aes(fill = SEXO), position = "dodge") + scale_y_continuous(limits = c(0, ceiling(nrow(dados)/10)*10)) + ggtitle("Casos positivos") + +# ggsave("figures/MISTO_pos_lat.png") + +ggplot(impacto.lat, aes(MISTO)) + + geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO)) + + scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + + theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + + ylab("Participantes") +ggsave("figures/MISTO_sex_lat.png") + +ggplot(impacto.lat, aes(MISTO)) + + geom_bar(aes(y = (..count..)/sum(..count..), fill = DOR)) + + scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + + theme(legend.position = "bottom") + scale_fill_discrete(name = "Dor") + + ylab("Participantes") +ggsave("figures/MISTO_dor_lat.png") + +# gg.bar.freq <- scale_y_continuous(limits = c(0, ceiling(nrow(impacto)/10)*10)) + +# theme(legend.position = "bottom", legend.title = element_blank()) + +# ylab("Participantes") +# gg.bar.prop <- scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# xlab("") + ylab("Participantes") + +# ggplot(impacto, aes(SEXO)) + +# ggtitle("Impacto CAM") + +# geom_bar(aes(fill = CAM), position = "dodge") + +# scale_y_continuous(limits = c(0, ceiling(nrow(impacto)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Impacto") + +# xlab("Gênero") + ylab("Participantes") + +ggplot(impacto, aes(SEXO)) + + ggtitle("Impacto CAM") + + # geom_bar(aes(y = (..count..)/sum(..count..), fill = CAM), position = "dodge") + + geom_bar(aes(y = (..count..)/sum(..count..), fill = CAM)) + + scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + + theme(legend.position = "bottom") + scale_fill_discrete(name = "Impacto") + + xlab("Gênero") + ylab("Participantes") + +# ggplot(impacto, aes(CAM)) + +# ggtitle("Impacto CAM") + +# geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO), position = "dodge") + +# scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# xlab("") + ylab("Participantes") + +# ggplot(impacto, aes(CAM)) + +# ggtitle("Impacto CAM") + +# geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO)) + +# scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# xlab("") + ylab("Participantes") + +ggsave("figures/CAM_sex.png") + +# ggplot(impacto, aes(SEXO)) + +# ggtitle("Impacto PINCER") + +# geom_bar(aes(fill = PINCER), position = "dodge") + +# scale_y_continuous(limits = c(0, ceiling(nrow(impacto)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Impacto") + +# xlab("Gênero") + ylab("Participantes") + +ggplot(impacto, aes(SEXO)) + + ggtitle("Impacto PINCER") + + # geom_bar(aes(y = (..count..)/sum(..count..), fill = PINCER), position = "dodge") + + geom_bar(aes(y = (..count..)/sum(..count..), fill = PINCER)) + + scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + + theme(legend.position = "bottom") + scale_fill_discrete(name = "Impacto") + + xlab("Gênero") + ylab("Participantes") + +# ggplot(impacto, aes(PINCER)) + +# ggtitle("Impacto PINCER") + +# geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO), position = "dodge") + +# scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# xlab("") + ylab("Participantes") + +# ggplot(impacto, aes(PINCER)) + +# ggtitle("Impacto PINCER") + +# geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO)) + +# scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# xlab("") + ylab("Participantes") + +ggsave("figures/PINCER_sex.png") + +# ggplot(impacto, aes(SEXO)) + +# ggtitle("Impacto MISTO") + +# geom_bar(aes(fill = MISTO), position = "dodge") + +# scale_y_continuous(limits = c(0, ceiling(nrow(impacto)/10)*10)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Impacto") + +# xlab("Gênero") + ylab("Participantes") + +ggplot(impacto, aes(SEXO)) + + ggtitle("Impacto MISTO") + + # geom_bar(aes(y = (..count..)/sum(..count..), fill = MISTO), position = "dodge") + + geom_bar(aes(y = (..count..)/sum(..count..), fill = MISTO)) + + scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + + theme(legend.position = "bottom") + scale_fill_discrete(name = "Impacto") + + xlab("Gênero") + ylab("Participantes") + +# ggplot(impacto, aes(MISTO)) + +# ggtitle("Impacto MISTO") + +# geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO), position = "dodge") + +# scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# xlab("") + ylab("Participantes") + +# ggplot(impacto, aes(MISTO)) + +# ggtitle("Impacto MISTO") + +# geom_bar(aes(y = (..count..)/sum(..count..), fill = SEXO)) + +# scale_y_continuous(labels = scales::percent, limits = c(0, 1)) + +# theme(legend.position = "bottom") + scale_fill_discrete(name = "Genero") + +# xlab("") + ylab("Participantes") + +ggsave("figures/MISTO_sex.png") + +library(tidyr) +impacto.m <- gather(impacto[, 2:6], TIPO, IMPACTO, CAM, PINCER, MISTO) +impacto.m$IMPACTO <- factor(impacto.m$IMPACTO) +levels(impacto.m$IMPACTO) <- c("Ausente", "Presente", "Presente", "Presente", "Ausente") +impacto.m$TIPO <- factor(impacto.m$TIPO, levels = c("CAM", "PINCER", "MISTO")) + +impacto.m.lat <- gather(impacto.lat[, 2:6], TIPO, IMPACTO, CAM, PINCER, MISTO) +impacto.m.lat$IMPACTO <- factor(impacto.m.lat$IMPACTO) +levels(impacto.m.lat$IMPACTO) <- c("B", "D", "E", "N", "N") +impacto.m.lat$IMPACTO <- relevel(impacto.m.lat$IMPACTO, "N") +impacto.m.lat$TIPO <- factor(impacto.m.lat$TIPO, levels = c("CAM", "PINCER", "MISTO")) + +ggplot(impacto.m, aes(IMPACTO, fill = SEXO)) + + geom_bar(aes(y = (..count..)/sum(..count..))) + facet_grid(~ TIPO) + + scale_y_continuous(labels = scales::percent, limits = c(0, .3)) + + xlab("") + ylab("") + + theme(legend.position = "bottom") +ggsave("figures/painel_sex.png") + +ggplot(impacto.m, aes(IMPACTO, fill = DOR)) + + geom_bar(aes(y = (..count..)/sum(..count..))) + facet_grid(~ TIPO) + + scale_y_continuous(labels = scales::percent, limits = c(0, .3)) + + xlab("") + ylab("") + + theme(legend.position = "bottom") +ggsave("figures/painel_dor.png") + +ggplot(impacto.m.lat, aes(IMPACTO, fill = SEXO)) + + geom_bar(aes(y = (..count..)/sum(..count..))) + facet_grid(~ TIPO) + + scale_y_continuous(labels = scales::percent, limits = c(0, .3)) + + xlab("") + ylab("") + + theme(legend.position = "bottom") +ggsave("figures/painel_sex_lat.png") + +ggplot(impacto.m.lat, aes(IMPACTO, fill = DOR)) + + geom_bar(aes(y = (..count..)/sum(..count..))) + facet_grid(~ TIPO) + + scale_y_continuous(labels = scales::percent, limits = c(0, .3)) + + xlab("") + ylab("") + + theme(legend.position = "bottom") +ggsave("figures/painel_dor_lat.png") diff --git a/scripts/input.R b/scripts/input.R new file mode 100644 index 0000000..b175a61 --- /dev/null +++ b/scripts/input.R @@ -0,0 +1,137 @@ +library(readxl) +library(data.table) + +dados <- data.table(read_excel("dataset/Cabral FMP dados 2018-06-06.xlsx")) +dados <- dados[, c(1:19,24:26)] +names(dados) <- c("ID", "SEXO", "IDADE", "RACA", "IMC", "LADO DOR", "HHS", + "TORCAO D", "TORCAO E", "TONNIS D", "TONNIS E", + "ACB D", "ACB E", "IA D", "IA E", "ACD D", "ACD E", + "ALFA D", "ALFA E", "I. EXTRU D", "I. EXTRU E", + "TIPO DE PATOLOGIA") +dados <- transform(dados, ID = factor(ID), + SEXO = factor(SEXO), + RACA = factor(RACA), + `LADO DOR` = factor(`LADO DOR`), + `TONNIS D` = ordered(`TONNIS D`), + `TONNIS E` = ordered(`TONNIS E`), + `TIPO DE PATOLOGIA` = factor(`TIPO DE PATOLOGIA`), + IMC = IMC) +levels(dados$RACA) <- c("Branca", "Outros") +dados$RACA <- relevel(dados$RACA, "Outros") +levels(dados$`LADO DOR`) <- c("D","E","B") +levels(dados$SEXO) <- c("M", "F") +dados$SEXO <- relevel(dados$SEXO, "F") + +# CAM #### +dados$`CAM D` <- cut(dados$`ALFA D`, breaks = c(0,50,Inf), labels = c("NORMAL", "CAM")) +dados$`CAM E` <- cut(dados$`ALFA E`, breaks = c(0,50,Inf), labels = c("NORMAL", "CAM")) + +# exceção: P17 sem ALFA D +dados[ID == "P17"]$`CAM D` <- "NORMAL" + +CAM <- rep(NA, nrow(dados)) +CAM[dados$`CAM D` == "CAM"] <- "D" +CAM[dados$`CAM E` == "CAM"] <- "E" +CAM[dados$`CAM D` == "CAM" & dados$`CAM E` == "CAM"] <- "B" +CAM[dados$`CAM D` == "NORMAL" & dados$`CAM E` == "NORMAL"] <- "N" +CAM <- factor(CAM, levels = c("N", "D", "E", "B")) +# CAM <- relevel(CAM, "N") +dados$CAM <- CAM +rm(CAM) + +# PINCER #### +dados[, `PINCER D` := `IA D` > 10 | `ACB D` > 39 | `I. EXTRU D` < 10] +dados[, `PINCER E` := `IA E` > 10 | `ACB E` > 39 | `I. EXTRU E` < 10] +PINCER <- rep(NA, nrow(dados)) + +# exceção: P15 sem ACB D +# dados[ID == "P15", `PINCER D` := `IA D` > 10 | `I. EXTRU D` < 10] +dados[ID == "P15"]$`PINCER D` <- FALSE + +# exceção: P28 sem I Extru D e E +dados[ID == "P28"]$`PINCER D` <- FALSE +dados[ID == "P28"]$`PINCER E` <- TRUE + +PINCER[dados$`PINCER D` == TRUE] <- "D" +PINCER[dados$`PINCER E` == TRUE] <- "E" +PINCER[dados$`PINCER D` == TRUE & dados$`PINCER E` == TRUE] <- "B" +PINCER[dados$`PINCER D` == FALSE & dados$`PINCER E` == FALSE] <- "N" +PINCER <- factor(PINCER, levels = c("N", "D", "E", "B")) +# PINCER <- relevel(PINCER, "N") +dados$PINCER <- PINCER +rm(PINCER) + +# MISTO +dados[, `MISTO D` := `CAM D` == "CAM" & `PINCER D` == TRUE] +dados[, `MISTO E` := `CAM E` == "CAM" & `PINCER E` == TRUE] +MISTO <- rep(NA, nrow(dados)) +MISTO[dados$`MISTO D` == TRUE] <- "D" +MISTO[dados$`MISTO E` == TRUE] <- "E" +MISTO[dados$`MISTO D` == TRUE & dados$`MISTO E` == TRUE] <- "B" +MISTO[is.na(MISTO)] <- "Simples" +dados$MISTO <- factor(MISTO, levels = c("Simples", "D", "E", "B")) +# dados$MISTO <- relevel(dados$MISTO, "N") +rm(MISTO) + +# IMPACTO D +`IMPACTO D` <- rep(NA, nrow(dados)) +`IMPACTO D`[dados$`PINCER D` == TRUE] <- "PINCER" +`IMPACTO D`[dados$`CAM D` == "CAM"] <- "CAM" +`IMPACTO D`[dados$`MISTO D` == TRUE] <- "MISTO" +`IMPACTO D`[is.na(`IMPACTO D`)] <- "NORMAL" +dados$`IMPACTO D` <- factor(`IMPACTO D`, levels = c("NORMAL", "CAM", "PINCER", "MISTO")) +# dados$`IMPACTO D` <- relevel(dados$`IMPACTO D`, "NORMAL") +rm(`IMPACTO D`) + +# IMPACTO E +`IMPACTO E` <- rep(NA, nrow(dados)) +`IMPACTO E`[dados$`PINCER E` == TRUE] <- "PINCER" +`IMPACTO E`[dados$`CAM E` == "CAM"] <- "CAM" +`IMPACTO E`[dados$`MISTO E` == TRUE] <- "MISTO" +`IMPACTO E`[is.na(`IMPACTO E`)] <- "NORMAL" +dados$`IMPACTO E` <- factor(`IMPACTO E`, levels = c("NORMAL", "CAM", "PINCER", "MISTO")) +# dados$`IMPACTO E` <- relevel(dados$`IMPACTO E`, "NORMAL") +rm(`IMPACTO E`) + +# influentes: checar valores de ALFA D +print(dados[(ID %in% c("P22", "P30", "P36")), .(ID, `LADO DOR`, `TORCAO D`, `ALFA D`)]) +# dados <- dados[!(ID %in% c("P22", "P30", "P36"))] + +# PINCER influentes: TORCAO muito pequena? +print(dados[(ID %in% c("P3" )),.(ID, `IMPACTO D`, `TORCAO D`, `ALFA D`)]) +print(dados[(ID %in% c("P17")),.(ID, `IMPACTO E`, `TORCAO E`, `ALFA E`)]) +# dados <- dados[!(ID %in% c("P3", "P17"))] + +impacto.lat <- dados[, .(ID, SEXO, `LADO DOR`, CAM, PINCER, MISTO)] +names(impacto.lat)[3] <- "DOR" + +impacto <- impacto.lat +levels(impacto$CAM) <- c("Ausente", "CAM", "CAM", "CAM") +levels(impacto$PINCER) <- c("Ausente", "PINCER", "PINCER", "PINCER") +levels(impacto$MISTO) <- c("SIMPLES", "MISTO", "MISTO", "MISTO") + +# dados numéricos +d.num <- data.frame( + LADO = rep(c("D", "E"), each = 26), + SEXO = rep(dados$SEXO, 2), + RACA = rep(dados$RACA, 2), + DOR = rep(dados$`LADO DOR`, 2), + TORCAO = c(dados$`TORCAO D`, dados$`TORCAO E`), + ALFA = c(dados$`ALFA D`, dados$`ALFA E`), + CAM = rep(dados$CAM, 2), + PINCER = rep(dados$PINCER, 2), + MISTO = rep(dados$MISTO, 2), + IMPACTO = c(as.character(dados$`IMPACTO D`), as.character(dados$`IMPACTO E`)) +) +levels(d.num$IMPACTO) <- c("NORMAL", "CAM", "PINCER", "MISTO") + +# medições numéricas +med.num <- data.frame( + LADO = rep(c("D", "E"), each = 26), + TORCAO = c(dados$`TORCAO D`, dados$`TORCAO E`), + ALFA = c(dados$`ALFA D`, dados$`ALFA E`), + IA = c(dados$`IA D`, dados$`IA E`), + ACB = c(dados$`ACB D`, dados$`ACB E`), + EXTRU = c(dados$`I. EXTRU D`, dados$`I. EXTRU E`), + IMPACTO = d.num$IMPACTO +) diff --git a/scripts/modelos.R b/scripts/modelos.R new file mode 100644 index 0000000..b9ffc72 --- /dev/null +++ b/scripts/modelos.R @@ -0,0 +1,237 @@ +source('scripts/input.R', encoding = 'UTF-8') + +summary(lm(`TORCAO D` ~ `LADO DOR`, data = dados)) +summary(lm(`TORCAO E` ~ `LADO DOR`, data = dados)) +# summary(lm(`TORCAO D` ~ `ALFA D` + `LADO DOR` - 1, data = dados)) +# summary(lm(`TORCAO E` ~ `ALFA E` + `LADO DOR` - 1, data = dados)) +summary(lm(`TORCAO D` ~ `ALFA D` + `LADO DOR`, data = dados)) +summary(lm(`TORCAO E` ~ `ALFA E` + `LADO DOR`, data = dados)) + +summary(lm(`TORCAO D` ~ `ALFA D`, data = dados)) +summary(lm(`TORCAO E` ~ `ALFA E`, data = dados)) + +# summary(lm(IMC ~ `LADO DOR`, data = dados)) +summary(lm(IMC ~ CAM, data = dados)) +summary(lm(IMC ~ PINCER, data = dados)) +summary(lm(IMC ~ MISTO, data = dados)) + +summary(lm(IMC ~ CAM + `LADO DOR`, data = dados)) +summary(lm(IMC ~ PINCER + `LADO DOR`, data = dados)) +summary(lm(IMC ~ MISTO + `LADO DOR`, data = dados)) + + +# summary(lm(`TORCAO D` ~ IMC, data = dados)) +# summary(lm(`TORCAO E` ~ IMC, data = dados)) +# summary(lm(`TORCAO D` ~ `ALFA D` + IMC, data = dados)) +# summary(lm(`TORCAO E` ~ `ALFA E` + IMC, data = dados)) + +summary(lm(`ALFA D` ~ `LADO DOR`, data = dados)) +summary(lm(`ALFA E` ~ `LADO DOR`, data = dados)) + +summary(lm(`ALFA D` ~ CAM, data = dados)) +summary(lm(`ALFA E` ~ CAM, data = dados)) +summary(lm(`ALFA D` ~ PINCER, data = dados)) +summary(lm(`ALFA E` ~ PINCER, data = dados)) +summary(lm(`ALFA D` ~ MISTO, data = dados)) +summary(lm(`ALFA E` ~ MISTO, data = dados)) + +summary(lm(`ALFA D` ~ CAM+PINCER, data = dados)) +summary(lm(`ALFA E` ~ CAM+PINCER, data = dados)) +summary(lm(`ALFA D` ~ CAM*PINCER, data = dados)) +summary(lm(`ALFA E` ~ CAM*PINCER, data = dados)) +summary(lm(`ALFA D` ~ CAM+PINCER+`LADO DOR`, data = dados)) +summary(lm(`ALFA E` ~ CAM+PINCER+`LADO DOR`, data = dados)) + + +# ## casos positivos +# summary(lm(`ALFA D` ~ CAM, data = dados[CAM != "NORMAL"] )) +# summary(lm(`ALFA E` ~ CAM, data = dados[CAM != "NORMAL"])) +# summary(lm(`ALFA D` ~ PINCER, data = dados[PINCER != "N"])) +# summary(lm(`ALFA E` ~ PINCER, data = dados[PINCER != "N"])) +# summary(lm(`ALFA D` ~ MISTO, data = dados[MISTO != "Simples"])) +# summary(lm(`ALFA E` ~ MISTO, data = dados[MISTO != "Simples"])) + +## ANOVAs +summary(aov(`TORCAO D` ~ CAM, dados)) +TukeyHSD(aov(`TORCAO D` ~ CAM, dados)) + +summary(aov(`TORCAO D` ~ PINCER, dados)) +TukeyHSD(aov(`TORCAO D` ~ PINCER, dados)) + +summary(aov(`TORCAO D` ~ MISTO, dados)) +TukeyHSD(aov(`TORCAO D` ~ MISTO, dados)) + +# correlação sem filtro --------------------------------------------------- + +with(dados, cor.test(`TORCAO D` , `ALFA D`)) +with(dados, cor.test(`TORCAO E` , `ALFA E`)) + + +# correlação com filtro de lateralidade ----------------------------------- + +with(dados[`LADO DOR` %in% c("D", "B")], cor.test(`TORCAO D` , `ALFA D`)) +with(dados[`LADO DOR` %in% c("E", "B")], cor.test(`TORCAO E` , `ALFA E`)) + + +# desfecho categórico ----------------------------------------------------- + +library(nnet) + +# summary(glm(CAM ~ SEXO -1, binomial(link = "logit"), impacto)) +# cam.sex.coef <- round(exp(coef(glm(CAM ~ SEXO -1, binomial(link = "logit"), impacto))), 1) +# OR.M.CAM <- cam.sex.coef[1]/cam.sex.coef[2] +# +# summary(glm(PINCER ~ SEXO -1, binomial(link = "logit"), impacto)) +# pinc.sex.coef <- round(exp(coef(glm(PINCER ~ SEXO -1, binomial(link = "logit"), impacto))), 1) +# OR.F.pinc <- pinc.sex.coef[2]/pinc.sex.coef[1] +# +# summary(glm(MISTO ~ SEXO -1, binomial(link = "logit"), impacto)) +# mst.sex.coef <- round(exp(coef(glm(MISTO ~ SEXO -1, binomial(link = "logit"), impacto))), 1) +# OR.M.misto <- mst.sex.coef[1]/mst.sex.coef[2] +# +# summary(glm(CAM ~ DOR, binomial(link = "logit"), impacto)) +# summary(glm(PINCER ~ DOR, binomial(link = "logit"), impacto)) +# summary(glm(MISTO ~ DOR, binomial(link = "logit"), impacto)) +# +# round(exp(coef(glm(CAM ~ DOR, binomial(link = "logit"), impacto))), 1) +# round(exp(coef(multinom(CAM ~ DOR, impacto.lat))), 1) +# +# round(exp(coef(glm(PINCER ~ DOR, binomial(link = "logit"), impacto))), 1) +# round(exp(coef(multinom(PINCER ~ DOR -1, impacto.lat))), 1) +# +# round(exp(coef(glm(MISTO ~ DOR -1, binomial(link = "logit"), impacto))), 1) +# round(exp(coef(multinom(MISTO ~ DOR -1, impacto.lat))), 1) + +## Desfecho Impacto +impacto.subsetcols <- dados[, .(`TORCAO D`, `TORCAO E`, `LADO DOR`, `IMPACTO D`, `IMPACTO E`, HHS)] + +# Tipo de impacto +multi.imp.tor.d <- multinom(`IMPACTO D` ~ `TORCAO D`, dados) +multi.imp.tor.dor.d <- multinom(`IMPACTO D` ~ `TORCAO D` + `LADO DOR`, dados) + +multi.imp.tor.e <- multinom(`IMPACTO E` ~ `TORCAO E`, dados) +multi.imp.tor.dor.e <- multinom(`IMPACTO E` ~ `TORCAO E` + `LADO DOR`, dados) + +png("figures/painel_Tor_impacto.png") +par(mfrow = c(2,1)) +with(dados, plot(`TORCAO D` ~ `IMPACTO D`, ylim = c(0, 40))) +abline(h=c(5,25), lty = 4) +stripchart(`TORCAO D` ~ `IMPACTO D`, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19, add = TRUE) +with(dados, plot(`TORCAO E` ~ `IMPACTO E`, ylim = c(0, 40))) +abline(h=c(5,25), lty = 4) +stripchart(`TORCAO E` ~ `IMPACTO E`, data = dados, method = "stack", vertical = TRUE, ylim = c(0, 40), pch = 19, add = TRUE) +dev.off() + +# HHS +lm.hhs.tor.d <- lm(HHS ~ `TORCAO D`, dados) +lm.hhs.tor.e <- lm(HHS ~ `TORCAO E`, dados) + +lm.hhs.tor.dor.d <- lm(HHS ~ `TORCAO D` + `LADO DOR`, dados) +lm.hhs.tor.dor.e <- lm(HHS ~ `TORCAO E` + `LADO DOR`, dados) + +png("figures/painel_Tor_HHS.png") +par(mfrow = c(2,1)) +with(dados, plot(`TORCAO D`, HHS, xlim = c(1, 36))) +abline(v=c(5,25), lty = 4) +with(dados, plot(`TORCAO E`, HHS, xlim = c(1, 36))) +abline(v=c(5,25), lty = 4) +dev.off() + +## Desfecho DOR + +dor.cam <- multinom(DOR ~ CAM, impacto) +dor.cam.lat <- multinom(DOR ~ CAM, impacto.lat) + +summary(dor.cam) +exp(coef(dor.cam)) +summary(dor.cam.lat) +exp(coef(dor.cam.lat)) + +dor.pinc <- multinom(DOR ~ PINCER, impacto) +dor.pinc.lat <- multinom(DOR ~ PINCER, impacto.lat) + +summary(dor.pinc) +exp(coef(dor.pinc)) +summary(dor.pinc.lat) +exp(coef(dor.pinc.lat)) + +dor.mst <- multinom(DOR ~ MISTO, impacto) +dor.mst.lat <- multinom(DOR ~ MISTO, impacto.lat) + +summary(dor.mst) +exp(coef(dor.mst)) +summary(dor.mst.lat) +exp(coef(dor.mst.lat)) + +mult.imp <- multinom(DOR ~ CAM + PINCER, impacto) +mult.imp.lat <- multinom(DOR ~ CAM + PINCER, impacto.lat) + +summary(mult.imp) +exp(coef(mult.imp)) +summary(mult.imp.lat) +exp(coef(mult.imp.lat)) + +z <- summary(mult.imp)$coefficients/summary(mult.imp)$standard.errors +# z +p <- (1 - pnorm(abs(z), 0, 1)) * 2 +p +p < 0.05 + +# exp(coef(mult.imp)) + +mult.imp2 <- multinom(DOR ~ CAM + PINCER -1, impacto.lat) +summary(mult.imp2) + +z2 <- summary(mult.imp2)$coefficients/summary(mult.imp2)$standard.errors +# z2 +p2 <- (1 - pnorm(abs(z2), 0, 1)) * 2 +p2 +p2 < 0.05 + +exp(coef(mult.imp2)) + +mult.imp.sex <- multinom(DOR ~ CAM + PINCER + SEXO -1, impacto) +summary(mult.imp.sex) + +zs <- summary(mult.imp.sex)$coefficients/summary(mult.imp.sex)$standard.errors +# zs +ps <- (1 - pnorm(abs(zs), 0, 1)) * 2 +ps +ps < 0.05 + +exp(coef(mult.imp.sex)) + +mult.imp.sex2 <- multinom(DOR ~ CAM + PINCER + SEXO, impacto.lat) +summary(mult.imp.sex2) + +zs2 <- summary(mult.imp.sex2)$coefficients/summary(mult.imp.sex2)$standard.errors +# zs2 +ps2 <- (1 - pnorm(abs(zs2), 0, 1)) * 2 +ps2 +ps2 < 0.05 + +exp(coef(mult.imp.sex2)) + + +mult.cam <- multinom(DOR ~ CAM -1, impacto) +summary(mult.cam) + +zc <- summary(mult.cam)$coefficients/summary(mult.cam)$standard.errors +# zc +pc <- (1 - pnorm(abs(zc), 0, 1)) * 2 +pc +pc < 0.05 + +exp(coef(mult.cam)) + +mult.cam2 <- multinom(DOR ~ CAM -1, impacto.lat) +summary(mult.cam2) + +zc2 <- summary(mult.cam2)$coefficients/summary(mult.cam2)$standard.errors +# zc2 +pc2 <- (1 - pnorm(abs(zc2), 0, 1)) * 2 +pc2 +pc2 < 0.05 + +exp(coef(mult.cam2)) + diff --git a/scripts/reuniao.R b/scripts/reuniao.R new file mode 100644 index 0000000..3d835ed --- /dev/null +++ b/scripts/reuniao.R @@ -0,0 +1,11 @@ +prop.table(table(dados$SEXO)) +library(Hmisc) +describe(dados) +with(dados, cor.test(`TORCAO D`, `ALFA D`)) +with(dados, cor.test(`TORCAO E`, `ALFA E`)) +lm(`TORCAO D` ~ `ALFA D` + `LADO DOR`, data = dados) +summary(lm(`TORCAO D` ~ `ALFA D` + `LADO DOR`, data = dados)) +with(dados, boxplot(`ALFA D` ~ `LADO DOR`, main = "ALFA D x LADO DOR")) +with(dados, boxplot(`ALFA E` ~ `LADO DOR`, main = "ALFA E x LADO DOR")) +with(dados, boxplot(`TORCAO D` ~ `LADO DOR`, main = "TORCAO D x LADO DOR")) +with(dados, boxplot(`TORCAO E` ~ `LADO DOR`, main = "TORCAO E x LADO DOR"))