Code
library(tidyverse)
library(readxl)
library(ggpubr)
library(expss)
library(ggsci)
library(quantreg)
library(patchwork)
library(ggcorrplot)
library(gamlss)
library(gamlss.add)
library(gamlss.dist)
library(writexl)
library(haven)library(tidyverse)
library(readxl)
library(ggpubr)
library(expss)
library(ggsci)
library(quantreg)
library(patchwork)
library(ggcorrplot)
library(gamlss)
library(gamlss.add)
library(gamlss.dist)
library(writexl)
library(haven)palette_nejm <- c(
"#BC3C29FF", "#0072B5FF", "#E18727FF", "#20854EFF",
"#7876B1FF", "#6F99ADFF", "#FFDC91FF", "#EE4C97FF"
)
palette_nejmb <- c(
"#0072B5FF", "#EE4C97FF", "#20854EFF", "#7876B1FF",
"#6F99ADFF", "#FFDC91FF", "#E18727FF", "#BC3C29FF"
)x2005 <- read_excel("2005f.xlsx")
# Calcular FEF25-75/CVF
x2005$feffvc <- x2005$fef2575 / x2005$fvc
# Converter variáveis categóricas e padronizar rótulos de etnia
x2005 <- x2005 |>
mutate(
sexf = as.factor(sexf),
ethnic01 = as.factor(ethnic01),
ethnic = as.factor(ethnic),
protocol = as.factor(protocol),
ethnicf = case_when(
ethnicf == "Branco" ~ "Branca",
ethnicf == "Negro e Pardo" ~ "Negra e Parda",
TRUE ~ ethnicf
) |> as.factor(),
ethnicnpb = case_when(
ethnic == 1 ~ "Branca",
ethnic == 2 ~ "Negra",
ethnic == 5 ~ "Parda"
) |> as.factor()
)x2005 |> count(sexf)# A tibble: 2 × 2
sexf n
<fct> <int>
1 Feminino 1059
2 Masculino 931
x2005 |> count(ethnic)# A tibble: 4 × 2
ethnic n
<fct> <int>
1 1 1353
2 2 184
3 5 386
4 <NA> 67
x2005 |> count(protocol, sex, ethnic)# A tibble: 14 × 4
protocol sex ethnic n
<fct> <dbl> <fct> <int>
1 1 1 1 318
2 1 1 2 48
3 1 1 5 71
4 1 2 1 366
5 1 2 2 55
6 1 2 5 78
7 2 1 1 313
8 2 1 2 34
9 2 1 5 118
10 2 1 <NA> 29
11 2 2 1 356
12 2 2 2 47
13 2 2 5 119
14 2 2 <NA> 38
x2005 |> count(sexf, ethnic01)# A tibble: 6 × 3
sexf ethnic01 n
<fct> <fct> <int>
1 Feminino 0 722
2 Feminino 1 299
3 Feminino <NA> 38
4 Masculino 0 631
5 Masculino 1 271
6 Masculino <NA> 29
table1 <- x2005 |>
group_by(protocol, cidade) |>
summarise(count = n(), .groups = "drop") |>
arrange(protocol, desc(count))
table1 |> htmlTable()| protocol | cidade | count | |
|---|---|---|---|
| 1 | 1 | Porto Alegre | 224 |
| 2 | 1 | Recife | 176 |
| 3 | 1 | Sete Lagoas | 164 |
| 4 | 1 | São Luiz Gonzaga | 76 |
| 5 | 1 | Foz do Iguacu | 48 |
| 6 | 1 | Blumenau | 42 |
| 7 | 1 | Salvador | 42 |
| 8 | 1 | Campinas | 34 |
| 9 | 1 | Ribeirao Preto | 32 |
| 10 | 1 | Rio de Janeiro | 32 |
| 11 | 1 | Niteroi | 28 |
| 12 | 1 | Curitiba | 22 |
| 13 | 1 | Belo Horizonte | 16 |
| 14 | 2 | Porto Alegre | 555 |
| 15 | 2 | São Paulo | 266 |
| 16 | 2 | Rio Grande | 188 |
| 17 | 2 | Caxias do Sul | 45 |
# Com dados de etnia
x2005x <- x2005 |> filter(!is.na(ethnic))
# Por sexo (amostra completa)
mm <- x2005 |> filter(sex == 1)
ff <- x2005 |> filter(sex == 2)
# Por sexo, apenas com dados de etnia
mmx <- x2005x |> filter(sex == 1)
ffx <- x2005x |> filter(sex == 2)# Masculino — por etnia
VEF1m <- ggplot(mmx, aes(height, fev1))
CVFm <- ggplot(mmx, aes(height, fvc))
# Feminino — por etnia
VEF1f <- ggplot(ffx, aes(height, fev1))
CVFf <- ggplot(ffx, aes(height, fvc))
# Com cor por etnia
VEF1me <- ggplot(mmx, aes(height, fev1, colour = ethnicf))
CVFme <- ggplot(mmx, aes(height, fvc, colour = ethnicf))
VEF1fe <- ggplot(ffx, aes(height, fev1, colour = ethnicf))
CVFfe <- ggplot(ffx, aes(height, fvc, colour = ethnicf))
# Amostra completa — estratificada por sexo
VEF1s <- ggplot(x2005x, aes(height, fev1, colour = sexf))
CVFs <- ggplot(x2005x, aes(height, fvc, colour = sexf))
TIFFENAUs <- ggplot(x2005, aes(height, fev1fvc, colour = sexf))
FEF2575s <- ggplot(x2005, aes(height, fef2575, colour = sexf))
FEFFVCs <- ggplot(x2005, aes(height, feffvc, colour = sexf))
# Amostra completa — estratificada por etnia
VEF1e <- ggplot(x2005x, aes(height, fev1, colour = ethnicf))
CVFe <- ggplot(x2005x, aes(height, fvc, colour = ethnicf))
TIFFENAUe <- ggplot(x2005, aes(height, fev1fvc, colour = ethnicf))
FEF2575e <- ggplot(x2005, aes(height, fef2575, colour = ethnicf))
FEFFVCe <- ggplot(x2005, aes(height, feffvc, colour = ethnicf))
# Sem estratificação
TIFFENAU <- ggplot(x2005, aes(height, fev1fvc))
FEF2575 <- ggplot(x2005, aes(height, fef2575))modfev1mm <- rq(lnfev1 ~ lnheight + lnage + ethnic01, data = mmx, tau = c(0.5, 0.05))
modfvcmm <- rq(lnfvc ~ lnheight + lnage + ethnic01, data = mmx, tau = c(0.75, 0.5, 0.05))
modfev1fvcmm <- rq(fev1fvc ~ lnheight, data = mm, tau = c(0.5, 0.05))
modfefmm <- rq(lnfef2575 ~ lnheight + lnage, data = mm, tau = c(0.5, 0.05))
modfeffvcmm <- rq(feffvc ~ lnheight + ethnic01, data = mm, tau = c(0.5, 0.05))
summary(modfev1mm)
Call: rq(formula = lnfev1 ~ lnheight + lnage + ethnic01, tau = c(0.5,
0.05), data = mmx)
tau: [1] 0.05
Coefficients:
coefficients lower bd upper bd
(Intercept) -8.96018 -10.13539 -8.36167
lnheight 1.82020 1.67333 2.08426
lnage 0.20898 0.12530 0.26928
ethnic011 -0.02638 -0.07219 -0.01189
Call: rq(formula = lnfev1 ~ lnheight + lnage + ethnic01, tau = c(0.5,
0.05), data = mmx)
tau: [1] 0.5
Coefficients:
coefficients lower bd upper bd
(Intercept) -10.43423 -11.10533 -9.78236
lnheight 2.20761 2.05752 2.37066
lnage 0.11400 0.04048 0.16857
ethnic011 -0.03184 -0.05477 -0.00888
summary(modfvcmm)
Call: rq(formula = lnfvc ~ lnheight + lnage + ethnic01, tau = c(0.75,
0.5, 0.05), data = mmx)
tau: [1] 0.05
Coefficients:
coefficients lower bd upper bd
(Intercept) -9.32749 -9.65307 -8.08025
lnheight 1.89018 1.57641 1.98713
lnage 0.26892 0.16604 0.41522
ethnic011 -0.04238 -0.12322 -0.01624
Call: rq(formula = lnfvc ~ lnheight + lnage + ethnic01, tau = c(0.75,
0.5, 0.05), data = mmx)
tau: [1] 0.5
Coefficients:
coefficients lower bd upper bd
(Intercept) -11.35819 -12.03562 -10.60504
lnheight 2.41982 2.23702 2.57293
lnage 0.11548 0.05253 0.19788
ethnic011 -0.02874 -0.05973 -0.01165
Call: rq(formula = lnfvc ~ lnheight + lnage + ethnic01, tau = c(0.75,
0.5, 0.05), data = mmx)
tau: [1] 0.75
Coefficients:
coefficients lower bd upper bd
(Intercept) -11.82284 -12.95717 -10.80870
lnheight 2.55270 2.31368 2.83953
lnage 0.06855 -0.01628 0.14773
ethnic011 -0.02779 -0.04638 -0.01014
summary(modfev1fvcmm)
Call: rq(formula = fev1fvc ~ lnheight, tau = c(0.5, 0.05), data = mm)
tau: [1] 0.05
Coefficients:
coefficients lower bd upper bd
(Intercept) 1.94278 1.63377 2.11490
lnheight -0.23126 -0.26699 -0.16792
Call: rq(formula = fev1fvc ~ lnheight, tau = c(0.5, 0.05), data = mm)
tau: [1] 0.5
Coefficients:
coefficients lower bd upper bd
(Intercept) 1.76096 1.64941 1.97617
lnheight -0.17675 -0.22062 -0.15401
summary(modfefmm)
Call: rq(formula = lnfef2575 ~ lnheight + lnage, tau = c(0.5, 0.05),
data = mm)
tau: [1] 0.05
Coefficients:
coefficients lower bd upper bd
(Intercept) -5.35627 -9.50945 -2.81863
lnheight 1.08515 0.43035 2.12647
lnage 0.21102 -0.21392 0.48229
Call: rq(formula = lnfef2575 ~ lnheight + lnage, tau = c(0.5, 0.05),
data = mm)
tau: [1] 0.5
Coefficients:
coefficients lower bd upper bd
(Intercept) -6.95786 -8.18446 -5.13957
lnheight 1.52730 1.09681 1.78279
lnage 0.13865 0.05500 0.26662
summary(modfeffvcmm)
Call: rq(formula = feffvc ~ lnheight + ethnic01, tau = c(0.5, 0.05),
data = mm)
tau: [1] 0.05
Coefficients:
coefficients lower bd upper bd
(Intercept) 4.57902 3.26658 5.62751
lnheight -0.78661 -1.00030 -0.53760
ethnic011 0.03697 -0.06494 0.08569
Call: rq(formula = feffvc ~ lnheight + ethnic01, tau = c(0.5, 0.05),
data = mm)
tau: [1] 0.5
Coefficients:
coefficients lower bd upper bd
(Intercept) 6.18550 5.20489 6.93684
lnheight -1.04420 -1.19977 -0.84383
ethnic011 0.09330 0.05033 0.13009
modfev1ff <- rq(lnfev1 ~ lnheight + lnage + ethnic01, data = ffx, tau = c(0.5, 0.05))
modfvcff <- rq(lnfvc ~ lnheight + lnage + ethnic01, data = ffx, tau = c(0.75, 0.5, 0.05))
modfev1fvcff <- rq(fev1fvc ~ lnheight, data = ff, tau = c(0.5, 0.05))
modfefff <- rq(lnfef2575 ~ lnheight + lnage, data = ff, tau = c(0.5, 0.05))
modfeffvcff <- rq(feffvc ~ lnheight + ethnic01, data = ff, tau = c(0.5, 0.05))
summary(modfev1ff)
Call: rq(formula = lnfev1 ~ lnheight + lnage + ethnic01, tau = c(0.5,
0.05), data = ffx)
tau: [1] 0.05
Coefficients:
Value Std. Error t value Pr(>|t|)
(Intercept) -8.93402 1.03584 -8.62494 0.00000
lnheight 1.76804 0.25067 7.05335 0.00000
lnage 0.29073 0.09855 2.95024 0.00325
ethnic011 -0.05470 0.02847 -1.92099 0.05502
Call: rq(formula = lnfev1 ~ lnheight + lnage + ethnic01, tau = c(0.5,
0.05), data = ffx)
tau: [1] 0.5
Coefficients:
Value Std. Error t value Pr(>|t|)
(Intercept) -9.96774 0.40176 -24.81003 0.00000
lnheight 2.08895 0.09713 21.50691 0.00000
lnage 0.15039 0.03870 3.88621 0.00011
ethnic011 -0.04858 0.01062 -4.57370 0.00001
summary(modfvcff)
Call: rq(formula = lnfvc ~ lnheight + lnage + ethnic01, tau = c(0.75,
0.5, 0.05), data = ffx)
tau: [1] 0.05
Coefficients:
Value Std. Error t value Pr(>|t|)
(Intercept) -10.32588 0.82580 -12.50417 0.00000
lnheight 2.09870 0.19893 10.54981 0.00000
lnage 0.23022 0.07921 2.90636 0.00374
ethnic011 -0.07369 0.02529 -2.91342 0.00365
Call: rq(formula = lnfvc ~ lnheight + lnage + ethnic01, tau = c(0.75,
0.5, 0.05), data = ffx)
tau: [1] 0.5
Coefficients:
Value Std. Error t value Pr(>|t|)
(Intercept) -10.74193 0.46365 -23.16812 0.00000
lnheight 2.26198 0.11203 20.19077 0.00000
lnage 0.15684 0.04410 3.55614 0.00039
ethnic011 -0.04101 0.01360 -3.01651 0.00262
Call: rq(formula = lnfvc ~ lnheight + lnage + ethnic01, tau = c(0.75,
0.5, 0.05), data = ffx)
tau: [1] 0.75
Coefficients:
Value Std. Error t value Pr(>|t|)
(Intercept) -10.57651 0.50318 -21.01923 0.00000
lnheight 2.24407 0.12157 18.45839 0.00000
lnage 0.16611 0.04753 3.49477 0.00049
ethnic011 -0.03499 0.01263 -2.77017 0.00570
summary(modfev1fvcff)
Call: rq(formula = fev1fvc ~ lnheight, tau = c(0.5, 0.05), data = ff)
tau: [1] 0.05
Coefficients:
Value Std. Error t value Pr(>|t|)
(Intercept) 1.31315 0.14111 9.30602 0.00000
lnheight -0.10080 0.02855 -3.53023 0.00043
Call: rq(formula = fev1fvc ~ lnheight, tau = c(0.5, 0.05), data = ff)
tau: [1] 0.5
Coefficients:
Value Std. Error t value Pr(>|t|)
(Intercept) 1.43768 0.08328 17.26247 0.00000
lnheight -0.10621 0.01703 -6.23828 0.00000
summary(modfefff)
Call: rq(formula = lnfef2575 ~ lnheight + lnage, tau = c(0.5, 0.05),
data = ff)
tau: [1] 0.05
Coefficients:
coefficients lower bd upper bd
(Intercept) -7.85519 -10.11875 -4.84476
lnheight 1.67343 0.93487 2.31428
lnage 0.05613 -0.19595 0.40374
Call: rq(formula = lnfef2575 ~ lnheight + lnage, tau = c(0.5, 0.05),
data = ff)
tau: [1] 0.5
Coefficients:
coefficients lower bd upper bd
(Intercept) -7.38547 -8.43694 -6.60596
lnheight 1.59403 1.40070 1.86019
lnage 0.20358 0.09347 0.28041
summary(modfeffvcff)
Call: rq(formula = feffvc ~ lnheight + ethnic01, tau = c(0.5, 0.05),
data = ff)
tau: [1] 0.05
Coefficients:
coefficients lower bd upper bd
(Intercept) 3.91939 2.05014 5.80472
lnheight -0.64261 -1.03824 -0.26121
ethnic011 0.02763 -0.03038 0.08347
Call: rq(formula = feffvc ~ lnheight + ethnic01, tau = c(0.5, 0.05),
data = ff)
tau: [1] 0.5
Coefficients:
coefficients lower bd upper bd
(Intercept) 5.04175 4.44641 5.90341
lnheight -0.78577 -0.96336 -0.64930
ethnic011 0.04647 0.00349 0.08007
lm_modfev1mm <- lm(lnfev1 ~ lnheight + lnage + ethnic01, data = mmx)
lm_modfvcmm <- lm(lnfvc ~ lnheight + lnage + ethnic01, data = mmx)
lm_modfev1fvcmm <- lm(fev1fvc ~ lnheight, data = mm)
lm_modfefmm <- lm(lnfef2575 ~ lnheight + lnage, data = mm)
lm_modfeffvcmm <- lm(feffvc ~ lnheight + ethnic01, data = mm)
summary(lm_modfev1mm)
Call:
lm(formula = lnfev1 ~ lnheight + lnage + ethnic01, data = mmx)
Residuals:
Min 1Q Median 3Q Max
-0.54946 -0.08492 0.00029 0.09293 0.32176
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -10.461203 0.354234 -29.532 < 2e-16 ***
lnheight 2.220499 0.085019 26.118 < 2e-16 ***
lnage 0.096022 0.032125 2.989 0.00288 **
ethnic011 -0.022727 0.009471 -2.400 0.01662 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1284 on 889 degrees of freedom
(9 observations deleted due to missingness)
Multiple R-squared: 0.843, Adjusted R-squared: 0.8425
F-statistic: 1591 on 3 and 889 DF, p-value: < 2.2e-16
summary(lm_modfvcmm)
Call:
lm(formula = lnfvc ~ lnheight + lnage + ethnic01, data = mmx)
Residuals:
Min 1Q Median 3Q Max
-0.45933 -0.08810 0.00582 0.09153 0.41016
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -10.990665 0.374745 -29.328 < 2e-16 ***
lnheight 2.329277 0.089966 25.890 < 2e-16 ***
lnage 0.148168 0.033902 4.371 1.38e-05 ***
ethnic011 -0.032887 0.009958 -3.303 0.000995 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1362 on 898 degrees of freedom
Multiple R-squared: 0.8553, Adjusted R-squared: 0.8548
F-statistic: 1769 on 3 and 898 DF, p-value: < 2.2e-16
summary(lm_modfev1fvcmm)
Call:
lm(formula = fev1fvc ~ lnheight, data = mm)
Residuals:
Min 1Q Median 3Q Max
-0.160633 -0.031450 0.000162 0.036037 0.128664
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.80392 0.06619 27.25 <2e-16 ***
lnheight -0.18563 0.01355 -13.70 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.04988 on 912 degrees of freedom
(17 observations deleted due to missingness)
Multiple R-squared: 0.1706, Adjusted R-squared: 0.1697
F-statistic: 187.6 on 1 and 912 DF, p-value: < 2.2e-16
summary(lm_modfefmm)
Call:
lm(formula = lnfef2575 ~ lnheight + lnage, data = mm)
Residuals:
Min 1Q Median 3Q Max
-0.78772 -0.13297 0.00989 0.14964 0.72185
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -6.58183 0.63874 -10.304 <2e-16 ***
lnheight 1.44637 0.15343 9.427 <2e-16 ***
lnage 0.14416 0.05768 2.499 0.0126 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.224 on 822 degrees of freedom
(106 observations deleted due to missingness)
Multiple R-squared: 0.5049, Adjusted R-squared: 0.5037
F-statistic: 419.1 on 2 and 822 DF, p-value: < 2.2e-16
summary(lm_modfeffvcmm)
Call:
lm(formula = feffvc ~ lnheight + ethnic01, data = mm)
Residuals:
Min 1Q Median 3Q Max
-0.67462 -0.17563 -0.02313 0.16388 1.17774
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.61752 0.37321 17.732 < 2e-16 ***
lnheight -1.12713 0.07675 -14.686 < 2e-16 ***
ethnic011 0.06624 0.02039 3.248 0.00121 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2694 on 793 degrees of freedom
(135 observations deleted due to missingness)
Multiple R-squared: 0.2165, Adjusted R-squared: 0.2145
F-statistic: 109.5 on 2 and 793 DF, p-value: < 2.2e-16
lm_modfev1ff <- lm(lnfev1 ~ lnheight + lnage + ethnic01, data = ffx)
lm_modfvcff <- lm(lnfvc ~ lnheight + lnage + ethnic01, data = ffx)
lm_modfev1fvcff <- lm(fev1fvc ~ lnheight, data = ff)
lm_modfefff <- lm(lnfef2575 ~ lnheight + lnage, data = ff)
lm_modfeffvcff <- lm(feffvc ~ lnheight + ethnic01, data = ff)
summary(lm_modfev1ff)
Call:
lm(formula = lnfev1 ~ lnheight + lnage + ethnic01, data = ffx)
Residuals:
Min 1Q Median 3Q Max
-0.48255 -0.08864 -0.00205 0.08760 0.41210
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -10.039170 0.350143 -28.672 < 2e-16 ***
lnheight 2.095265 0.084787 24.712 < 2e-16 ***
lnage 0.169894 0.033672 5.046 5.37e-07 ***
ethnic011 -0.043425 0.009564 -4.540 6.30e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1369 on 1003 degrees of freedom
(14 observations deleted due to missingness)
Multiple R-squared: 0.833, Adjusted R-squared: 0.8325
F-statistic: 1668 on 3 and 1003 DF, p-value: < 2.2e-16
summary(lm_modfvcff)
Call:
lm(formula = lnfvc ~ lnheight + lnage + ethnic01, data = ffx)
Residuals:
Min 1Q Median 3Q Max
-0.41527 -0.09252 -0.00577 0.09298 0.45305
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -10.57518 0.36720 -28.799 < 2e-16 ***
lnheight 2.21994 0.08882 24.993 < 2e-16 ***
lnage 0.17866 0.03492 5.115 3.74e-07 ***
ethnic011 -0.04767 0.00997 -4.782 1.99e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1443 on 1017 degrees of freedom
Multiple R-squared: 0.8391, Adjusted R-squared: 0.8386
F-statistic: 1768 on 3 and 1017 DF, p-value: < 2.2e-16
summary(lm_modfev1fvcff)
Call:
lm(formula = fev1fvc ~ lnheight, data = ff)
Residuals:
Min 1Q Median 3Q Max
-0.166589 -0.032347 0.003639 0.039452 0.106032
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.42570 0.06265 22.757 < 2e-16 ***
lnheight -0.10451 0.01282 -8.153 1.02e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.05075 on 1036 degrees of freedom
(21 observations deleted due to missingness)
Multiple R-squared: 0.06029, Adjusted R-squared: 0.05939
F-statistic: 66.47 on 1 and 1036 DF, p-value: 1.018e-15
summary(lm_modfefff)
Call:
lm(formula = lnfef2575 ~ lnheight + lnage, data = ff)
Residuals:
Min 1Q Median 3Q Max
-0.72497 -0.15900 0.00571 0.15514 0.81326
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -7.37641 0.61169 -12.059 < 2e-16 ***
lnheight 1.60428 0.14791 10.846 < 2e-16 ***
lnage 0.17286 0.05792 2.984 0.00292 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2297 on 914 degrees of freedom
(142 observations deleted due to missingness)
Multiple R-squared: 0.5602, Adjusted R-squared: 0.5592
F-statistic: 582.1 on 2 and 914 DF, p-value: < 2.2e-16
summary(lm_modfeffvcff)
Call:
lm(formula = feffvc ~ lnheight + ethnic01, data = ff)
Residuals:
Min 1Q Median 3Q Max
-0.75071 -0.19173 -0.01626 0.16452 1.37370
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.71889 0.37674 15.180 <2e-16 ***
lnheight -0.92133 0.07746 -11.894 <2e-16 ***
ethnic011 0.05616 0.02126 2.641 0.0084 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2929 on 876 degrees of freedom
(180 observations deleted due to missingness)
Multiple R-squared: 0.1401, Adjusted R-squared: 0.1381
F-statistic: 71.37 on 2 and 876 DF, p-value: < 2.2e-16
modfev1mm2 <- lm(fev1 ~ lnheight + lnage + ethnic01, data = mmx)
modfvcmm2 <- lm(fvc ~ lnheight + lnage + ethnic01, data = mmx)
modfev1ff2 <- lm(fev1 ~ lnheight + lnage + ethnic01, data = ffx)
modfvcff2 <- lm(fvc ~ lnheight + lnage + ethnic01, data = ffx)
summary(modfev1mm2)
Call:
lm(formula = fev1 ~ lnheight + lnage + ethnic01, data = mmx)
Residuals:
Min 1Q Median 3Q Max
-0.89304 -0.17479 -0.00973 0.15983 1.20708
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -18.498405 0.730183 -25.334 <2e-16 ***
lnheight 4.177456 0.175249 23.837 <2e-16 ***
lnage -0.009394 0.066219 -0.142 0.887
ethnic011 -0.018437 0.019524 -0.944 0.345
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2648 on 889 degrees of freedom
(9 observations deleted due to missingness)
Multiple R-squared: 0.7839, Adjusted R-squared: 0.7831
F-statistic: 1075 on 3 and 889 DF, p-value: < 2.2e-16
summary(modfvcmm2)
Call:
lm(formula = fvc ~ lnheight + lnage + ethnic01, data = mmx)
Residuals:
Min 1Q Median 3Q Max
-0.95926 -0.20032 -0.01262 0.16863 1.74798
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -22.08664 0.88176 -25.048 <2e-16 ***
lnheight 4.94387 0.21169 23.355 <2e-16 ***
lnage 0.03149 0.07977 0.395 0.693
ethnic011 -0.03320 0.02343 -1.417 0.157
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3204 on 898 degrees of freedom
Multiple R-squared: 0.7878, Adjusted R-squared: 0.7871
F-statistic: 1111 on 3 and 898 DF, p-value: < 2.2e-16
summary(modfev1ff2)
Call:
lm(formula = fev1 ~ lnheight + lnage + ethnic01, data = ffx)
Residuals:
Min 1Q Median 3Q Max
-0.83812 -0.17791 -0.02568 0.16136 1.56884
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -18.28037 0.74523 -24.530 < 2e-16 ***
lnheight 4.09139 0.18046 22.672 < 2e-16 ***
lnage 0.06166 0.07167 0.860 0.38977
ethnic011 -0.05844 0.02036 -2.871 0.00418 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2914 on 1003 degrees of freedom
(14 observations deleted due to missingness)
Multiple R-squared: 0.7611, Adjusted R-squared: 0.7604
F-statistic: 1065 on 3 and 1003 DF, p-value: < 2.2e-16
summary(modfvcff2)
Call:
lm(formula = fvc ~ lnheight + lnage + ethnic01, data = ffx)
Residuals:
Min 1Q Median 3Q Max
-0.90481 -0.20752 -0.02727 0.18180 2.23525
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -21.01769 0.85158 -24.681 < 2e-16 ***
lnheight 4.69321 0.20599 22.784 < 2e-16 ***
lnage 0.05408 0.08100 0.668 0.50449
ethnic011 -0.06319 0.02312 -2.733 0.00638 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3347 on 1017 degrees of freedom
Multiple R-squared: 0.7637, Adjusted R-squared: 0.763
F-statistic: 1096 on 3 and 1017 DF, p-value: < 2.2e-16
ggplot(x2005, aes(age)) +
geom_histogram(binwidth = 1, fill = "#0072B5", color = "black") +
facet_wrap(~ sexf) +
theme_bw() +
labs(x = "Idade (anos)", y = "Número")ggplot(x2005, aes(height)) +
geom_histogram(binwidth = 10, fill = "#0072B5", color = "black") +
facet_wrap(~ sexf) +
theme_bw() +
labs(x = "Estatura (cm)", y = "Número")log_x_breaks <- c(90, 100, 110, 120, 130, 140, 150, 160, 170, 180)
log_y_breaks <- c(0.5, 0.75, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6)
a1 <- VEF1m +
geom_point(alpha = 0.2) +
facet_wrap(~ ethnicf) +
theme_bw() +
scale_color_manual(values = palette_nejm) +
scale_x_log10(name = "Estatura (cm)", breaks = log_x_breaks) +
scale_y_log10(name = "VEF1 (L)", breaks = log_y_breaks) +
theme(legend.position = "none") +
geom_quantile(quantiles = 0.5, color = "black", linewidth = 1) +
geom_quantile(quantiles = 0.05, color = "black")
a2 <- CVFm +
geom_point(alpha = 0.2) +
facet_wrap(~ ethnicf) +
theme_bw() +
scale_color_manual(values = palette_nejm) +
scale_x_log10(name = "Estatura (cm)", breaks = log_x_breaks) +
scale_y_log10(name = "CVF (L)", breaks = log_y_breaks) +
theme(legend.position = "none") +
geom_quantile(quantiles = 0.5, color = "black", linewidth = 1) +
geom_quantile(quantiles = 0.05, color = "black")
a3 <- VEF1f +
geom_point(alpha = 0.2) +
facet_wrap(~ ethnicf) +
theme_bw() +
scale_color_manual(values = palette_nejm) +
scale_x_log10(name = "Estatura (cm)", breaks = log_x_breaks) +
scale_y_log10(name = "VEF1 (L)", breaks = log_y_breaks) +
theme(legend.position = "none") +
geom_quantile(quantiles = 0.5, color = "black", linewidth = 1) +
geom_quantile(quantiles = 0.05, color = "black")
a4 <- CVFf +
geom_point(alpha = 0.2) +
facet_wrap(~ ethnicf) +
theme_bw() +
scale_color_manual(values = palette_nejm) +
scale_x_log10(name = "Estatura (cm)", breaks = log_x_breaks) +
scale_y_log10(name = "CVF (L)", breaks = log_y_breaks) +
theme(legend.position = "none") +
geom_quantile(quantiles = 0.5, color = "black", linewidth = 1) +
geom_quantile(quantiles = 0.05, color = "black")
figure1 <- ggarrange(a1, a2, a3, a4, labels = c("A", "B", "C", "D"), ncol = 2, nrow = 2)
figure1b1 <- TIFFENAU +
geom_point(alpha = 0.2) +
facet_wrap(~ sexf) +
theme_bw() +
scale_x_continuous(name = "Estatura (cm)", breaks = c(90, 100, 110, 120, 130, 140, 150, 160, 170, 180)) +
scale_y_continuous(name = "VEF1/CVF", breaks = c(0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1)) +
theme(legend.position = "none") +
geom_quantile(quantiles = 0.5, color = "black", linewidth = 1) +
geom_quantile(quantiles = 0.05, color = "black")
b2 <- FEF2575 +
geom_point(alpha = 0.2) +
facet_wrap(~ sexf) +
theme_bw() +
scale_x_log10(name = "Estatura (cm)", breaks = c(90, 100, 110, 120, 130, 140, 150, 160, 170, 180)) +
scale_y_log10(name = "FEF25-75% (L/s)", breaks = c(0.5, 0.75, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6)) +
theme(legend.position = "none") +
geom_quantile(quantiles = 0.5, color = "black", linewidth = 1) +
geom_quantile(quantiles = 0.05, color = "black")
figure2 <- ggarrange(b1, b2, labels = c("A", "B"), ncol = 1, nrow = 2)
figure2c1 <- ggplot(x2005x, aes(ethnicnpb, gpvef1, fill = ethnicnpb)) +
geom_boxplot(outlier.alpha = 0) +
labs(x = "", y = "Diferença percentual no VEF1") +
scale_fill_brewer(palette = "Blues") +
theme_bw() +
theme(legend.position = "none") +
ylim(-35, 60)
c2 <- ggplot(x2005x, aes(ethnicnpb, gpcvf, fill = ethnicnpb)) +
geom_boxplot(outlier.alpha = 0) +
labs(x = "", y = "Diferença percentual na CVF") +
scale_fill_brewer(palette = "Blues") +
theme_bw() +
theme(legend.position = "none") +
ylim(-35, 60)
c3 <- ggplot(x2005x, aes(ethnicnpb, ppvef1, fill = ethnicnpb)) +
geom_boxplot(outlier.alpha = 0) +
labs(x = "", y = "Diferença percentual no VEF1") +
scale_fill_brewer(palette = "Greens") +
theme_bw() +
theme(legend.position = "none") +
ylim(-35, 60)
c4 <- ggplot(x2005x, aes(ethnicnpb, ppcvf, fill = ethnicnpb)) +
geom_boxplot(outlier.alpha = 0) +
labs(x = "", y = "Diferença percentual na CVF") +
scale_fill_brewer(palette = "Greens") +
theme_bw() +
theme(legend.position = "none") +
ylim(-35, 60)
figure3 <- ggarrange(c1, c2, c3, c4, labels = c("A", "B", "C", "D"))
figure3c1 <- ggplot(x2005x, aes(ethnicnpb, gpvef1, fill = ethnicnpb)) +
geom_boxplot(outlier.alpha = 0) +
facet_wrap(~ sexf) +
labs(x = "", y = "Diferença percentual no VEF1") +
scale_fill_brewer(palette = "Blues") +
theme_bw() +
theme(legend.position = "none")
c2 <- ggplot(x2005x, aes(ethnicnpb, gpcvf, fill = ethnicnpb)) +
geom_boxplot(outlier.alpha = 0) +
facet_wrap(~ sexf) +
labs(x = "", y = "Diferença percentual na CVF") +
scale_fill_brewer(palette = "Blues") +
theme_bw() +
theme(legend.position = "none")
c3 <- ggplot(x2005x, aes(ethnicnpb, ppvef1, fill = ethnicnpb)) +
geom_boxplot(outlier.alpha = 0) +
facet_wrap(~ sexf) +
labs(x = "", y = "Diferença percentual no VEF1") +
scale_fill_brewer(palette = "Greens") +
theme_bw() +
theme(legend.position = "none")
c4 <- ggplot(x2005x, aes(ethnicnpb, ppcvf, fill = ethnicnpb)) +
geom_boxplot(outlier.alpha = 0) +
facet_wrap(~ sexf) +
labs(x = "", y = "Diferença percentual na CVF") +
scale_fill_brewer(palette = "Greens") +
theme_bw() +
theme(legend.position = "none")
figure3a <- ggarrange(c1, c2, c3, c4, labels = c("A", "B", "C", "D"))
figure3aexpss_digits(digits = 3)
x2005 |> calc_cro_mean_sd_n(fev1z, ethnicnpb, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(fvcz, ethnicnpb, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(fev1fvcz, ethnicnpb, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(fef2575z, ethnicnpb, sexf) |> htmlTable()| ethnicnpb | ||||||
|---|---|---|---|---|---|---|
| Branca | Negra | Parda | ||||
| sexf | ||||||
| Feminino | fev1z | Mean | 0.353 | 1.158 | 0.604 | |
| Std. dev. | 1.159 | 1.267 | 1.290 | |||
| Unw. valid N | 715.000 | 101.000 | 191.000 | |||
| Masculino | fev1z | Mean | 0.293 | 1.317 | 0.746 | |
| Std. dev. | 1.080 | 1.182 | 1.279 | |||
| Unw. valid N | 627.000 | 80.000 | 186.000 | |||
| ethnicnpb | ||||||
|---|---|---|---|---|---|---|
| Branca | Negra | Parda | ||||
| sexf | ||||||
| Feminino | fvcz | Mean | 0.159 | 0.987 | 0.485 | |
| Std. dev. | 1.178 | 1.254 | 1.352 | |||
| Unw. valid N | 722.000 | 102.000 | 197.000 | |||
| Masculino | fvcz | Mean | 0.098 | 1.131 | 0.600 | |
| Std. dev. | 1.094 | 1.224 | 1.373 | |||
| Unw. valid N | 631.000 | 82.000 | 189.000 | |||
| ethnicnpb | ||||||
|---|---|---|---|---|---|---|
| Branca | Negra | Parda | ||||
| sexf | ||||||
| Feminino | fev1fvcz | Mean | 0.334 | 0.248 | 0.218 | |
| Std. dev. | 0.996 | 0.997 | 1.053 | |||
| Unw. valid N | 715.000 | 101.000 | 191.000 | |||
| Masculino | fev1fvcz | Mean | 0.322 | 0.254 | 0.253 | |
| Std. dev. | 0.914 | 0.902 | 0.973 | |||
| Unw. valid N | 627.000 | 80.000 | 186.000 | |||
| ethnicnpb | ||||||
|---|---|---|---|---|---|---|
| Branca | Negra | Parda | ||||
| sexf | ||||||
| Feminino | fef2575z | Mean | 0.232 | 0.505 | 0.374 | |
| Std. dev. | 1.040 | 0.884 | 1.069 | |||
| Unw. valid N | 593.000 | 95.000 | 191.000 | |||
| Masculino | fef2575z | Mean | 0.185 | 0.707 | 0.463 | |
| Std. dev. | 0.934 | 0.824 | 1.056 | |||
| Unw. valid N | 533.000 | 80.000 | 183.000 | |||
expss_digits(digits = 1)
x2005 |> calc_cro_mean_sd_n(gpvef1, ethnicnpb, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(gpcvf, ethnicnpb, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(gpfef2575, ethnicnpb, sexf) |> htmlTable()| ethnicnpb | ||||||
|---|---|---|---|---|---|---|
| Branca | Negra | Parda | ||||
| sexf | ||||||
| Feminino | gpvef1 | Mean | 4.1 | 14.9 | 7.1 | |
| Std. dev. | 13.8 | 16.3 | 15.3 | |||
| Unw. valid N | 715.0 | 101.0 | 191.0 | |||
| Masculino | gpvef1 | Mean | 3.5 | 17.3 | 8.7 | |
| Std. dev. | 12.8 | 15.6 | 15.0 | |||
| Unw. valid N | 627.0 | 80.0 | 186.0 | |||
| ethnicnpb | ||||||
|---|---|---|---|---|---|---|
| Branca | Negra | Parda | ||||
| sexf | ||||||
| Feminino | gpcvf | Mean | 2.2 | 13.3 | 5.8 | |
| Std. dev. | 14.6 | 16.9 | 16.0 | |||
| Unw. valid N | 722.0 | 102.0 | 197.0 | |||
| Masculino | gpcvf | Mean | 1.3 | 15.0 | 6.8 | |
| Std. dev. | 13.3 | 16.5 | 15.5 | |||
| Unw. valid N | 631.0 | 82.0 | 189.0 | |||
| ethnicnpb | ||||||
|---|---|---|---|---|---|---|
| Branca | Negra | Parda | ||||
| sexf | ||||||
| Feminino | gpfef2575 | Mean | 5.7 | 14.4 | 9.2 | |
| Std. dev. | 24.2 | 24.5 | 24.8 | |||
| Unw. valid N | 593.0 | 95.0 | 191.0 | |||
| Masculino | gpfef2575 | Mean | 6.0 | 22.4 | 12.7 | |
| Std. dev. | 23.6 | 25.3 | 27.0 | |||
| Unw. valid N | 533.0 | 80.0 | 182.0 | |||
expss_digits(digits = 3)
x2005 |> calc_cro_mean_sd_n(dvef1g, ethnic, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(dcvfg, ethnic, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(dvef1cvfg, ethnic, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(dfmefg, ethnic, sexf) |> htmlTable()| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | dvef1g | Mean | 0.066 | 0.249 | 0.124 | |
| Std. dev. | 0.252 | 0.304 | 0.286 | |||
| Unw. valid N | 715.000 | 101.000 | 191.000 | |||
| Masculino | dvef1g | Mean | 0.055 | 0.262 | 0.159 | |
| Std. dev. | 0.240 | 0.258 | 0.293 | |||
| Unw. valid N | 627.000 | 80.000 | 186.000 | |||
| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | dcvfg | Mean | 0.034 | 0.251 | 0.114 | |
| Std. dev. | 0.299 | 0.352 | 0.325 | |||
| Unw. valid N | 722.000 | 102.000 | 197.000 | |||
| Masculino | dcvfg | Mean | 0.017 | 0.257 | 0.147 | |
| Std. dev. | 0.291 | 0.296 | 0.351 | |||
| Unw. valid N | 631.000 | 82.000 | 189.000 | |||
| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | dvef1cvfg | Mean | 0.013 | 0.008 | 0.007 | |
| Std. dev. | 0.050 | 0.052 | 0.050 | |||
| Unw. valid N | 711.000 | 101.000 | 189.000 | |||
| Masculino | dvef1cvfg | Mean | 0.017 | 0.011 | 0.012 | |
| Std. dev. | 0.050 | 0.051 | 0.050 | |||
| Unw. valid N | 622.000 | 80.000 | 184.000 | |||
| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | dfmefg | Mean | 0.130 | 0.313 | 0.192 | |
| Std. dev. | 0.551 | 0.553 | 0.570 | |||
| Unw. valid N | 593.000 | 95.000 | 191.000 | |||
| Masculino | dfmefg | Mean | 0.114 | 0.419 | 0.290 | |
| Std. dev. | 0.501 | 0.495 | 0.695 | |||
| Unw. valid N | 533.000 | 80.000 | 183.000 | |||
expss_digits(digits = 1)
x2005 |> calc_cro_mean_sd_n(ppvef1, ethnic, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(ppcvf, ethnic, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(ppfmef, ethnic, sexf) |> htmlTable()| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | ppvef1 | Mean | 9.7 | 3.6 | 5.8 | |
| Std. dev. | 15.1 | 15.3 | 14.2 | |||
| Unw. valid N | 574.0 | 81.0 | 168.0 | |||
| Masculino | ppvef1 | Mean | 5.6 | 1.9 | 4.8 | |
| Std. dev. | 13.1 | 13.6 | 14.4 | |||
| Unw. valid N | 492.0 | 62.0 | 165.0 | |||
| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | ppcvf | Mean | 12.5 | 6.9 | 9.1 | |
| Std. dev. | 16.2 | 16.0 | 15.4 | |||
| Unw. valid N | 575.0 | 81.0 | 168.0 | |||
| Masculino | ppcvf | Mean | 10.2 | 6.1 | 8.9 | |
| Std. dev. | 14.4 | 14.3 | 15.5 | |||
| Unw. valid N | 492.0 | 62.0 | 165.0 | |||
| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | ppfmef | Mean | 13.7 | 7.3 | 8.5 | |
| Std. dev. | 25.7 | 23.9 | 25.8 | |||
| Unw. valid N | 447.0 | 74.0 | 162.0 | |||
| Masculino | ppfmef | Mean | 1.3 | 2.5 | 3.8 | |
| Std. dev. | 23.1 | 21.4 | 25.2 | |||
| Unw. valid N | 395.0 | 60.0 | 159.0 | |||
expss_digits(digits = 3)
x2005 |> calc_cro_mean_sd_n(dvef1p, ethnic, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(dcvfp, ethnic, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(dvef1cvfp, ethnic, sexf) |> htmlTable()
x2005 |> calc_cro_mean_sd_n(dfmefp, ethnic, sexf) |> htmlTable()| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | dvef1p | Mean | 0.156 | 0.059 | 0.109 | |
| Std. dev. | 0.297 | 0.325 | 0.283 | |||
| Unw. valid N | 575.000 | 81.000 | 168.000 | |||
| Masculino | dvef1p | Mean | 0.101 | 0.043 | 0.096 | |
| Std. dev. | 0.262 | 0.276 | 0.296 | |||
| Unw. valid N | 492.000 | 62.000 | 165.000 | |||
| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | dcvfp | Mean | 0.229 | 0.134 | 0.181 | |
| Std. dev. | 0.319 | 0.371 | 0.329 | |||
| Unw. valid N | 575.000 | 81.000 | 168.000 | |||
| Masculino | dcvfp | Mean | 0.205 | 0.132 | 0.192 | |
| Std. dev. | 0.319 | 0.318 | 0.364 | |||
| Unw. valid N | 492.000 | 62.000 | 165.000 | |||
| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | dvef1cvfp | Mean | -0.019 | -0.030 | -0.022 | |
| Std. dev. | 0.050 | 0.054 | 0.052 | |||
| Unw. valid N | 570.000 | 81.000 | 166.000 | |||
| Masculino | dvef1cvfp | Mean | -0.042 | -0.043 | -0.038 | |
| Std. dev. | 0.052 | 0.052 | 0.053 | |||
| Unw. valid N | 487.000 | 62.000 | 163.000 | |||
| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Feminino | dfmefp | Mean | 0.293 | 0.165 | 0.185 | |
| Std. dev. | 0.592 | 0.598 | 0.594 | |||
| Unw. valid N | 447.000 | 74.000 | 162.000 | |||
| Masculino | dfmefp | Mean | 0.017 | 0.068 | 0.082 | |
| Std. dev. | 0.548 | 0.525 | 0.616 | |||
| Unw. valid N | 395.000 | 60.000 | 159.000 | |||
# Helper para simplificar chamadas repetidas
wx_paired <- function(obs, pred) {
wilcox.test(obs, pred, paired = TRUE)
}
ethnicv <- c(1, 2, 5)
for (sx in 1:2) {
sex_label <- if (sx == 1) "MASCULINO" else "FEMININO"
cat("\n====", sex_label, "====\n")
for (e in ethnicv) {
idx <- x2005$sex == sx & x2005$ethnic == e
cat("\nEtnia:", e, "\n")
cat("VEF1: "); print(wx_paired(x2005$fev1[idx], x2005$vef1prev[idx]))
cat("CVF: "); print(wx_paired(x2005$fvc[idx], x2005$cvfprev[idx]))
cat("VEF1/CVF:"); print(wx_paired(x2005$fev1fvc[idx], x2005$vef1cvfprev[idx]))
cat("FEF25-75:"); print(wx_paired(x2005$fef2575[idx], x2005$fmefprev[idx]))
}
}
==== MASCULINO ====
Etnia: 1
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 86783, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 101470, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 15308, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 39456, p-value = 0.8773
alternative hypothesis: true location shift is not equal to 0
Etnia: 2
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 1147, p-value = 0.2333
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 1433, p-value = 0.001388
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 230, p-value = 1.693e-07
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 1041, p-value = 0.3555
alternative hypothesis: true location shift is not equal to 0
Etnia: 5
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 9166, p-value = 0.0001623
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 10665, p-value = 5.286e-10
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 2165, p-value = 7.134e-14
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 6939, p-value = 0.3198
alternative hypothesis: true location shift is not equal to 0
==== FEMININO ====
Etnia: 1
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 132525, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 142212, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 50587, p-value = 5.075e-15
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 76445, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
Etnia: 2
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 2032, p-value = 0.08068
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 2354, p-value = 0.001103
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 759, p-value = 2.214e-05
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 1851, p-value = 0.01262
alternative hypothesis: true location shift is not equal to 0
Etnia: 5
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 9959, p-value = 5.888e-06
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 11270, p-value = 3.93e-11
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 3993, p-value = 2.184e-06
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 8639, p-value = 0.0006581
alternative hypothesis: true location shift is not equal to 0
for (sx in 1:2) {
sex_label <- if (sx == 1) "MASCULINO" else "FEMININO"
cat("\n====", sex_label, "====\n")
for (e in ethnicv) {
idx <- x2005$sex == sx & x2005$ethnic == e
cat("\nEtnia:", e, "\n")
cat("VEF1: "); print(wx_paired(x2005$fev1[idx], x2005$fev1gli[idx]))
cat("CVF: "); print(wx_paired(x2005$fvc[idx], x2005$fvcgli[idx]))
cat("VEF1/CVF:"); print(wx_paired(x2005$fev1fvc[idx], x2005$fev1fvcgli[idx]))
cat("FEF25-75:"); print(wx_paired(x2005$fef2575[idx], x2005$fef2575gli[idx]))
}
}
==== MASCULINO ====
Etnia: 1
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 123813, p-value = 2.247e-08
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 107576, p-value = 0.08551
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 132376, p-value = 2.42e-15
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 87971, p-value = 2.279e-06
alternative hypothesis: true location shift is not equal to 0
Etnia: 2
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 3021, p-value = 1.852e-11
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 3060, p-value = 3.431e-10
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 2034, p-value = 0.04734
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 2879, p-value = 1.578e-09
alternative hypothesis: true location shift is not equal to 0
Etnia: 5
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 13617, p-value = 2.185e-11
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 12897, p-value = 1.948e-07
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 11063, p-value = 0.0004183
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 12157, p-value = 7.39e-08
alternative hypothesis: true location shift is not equal to 0
==== FEMININO ====
Etnia: 1
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 164695, p-value = 3.045e-11
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 144568, p-value = 0.01211
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 166525, p-value = 2.987e-13
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 107415, p-value = 3.536e-06
alternative hypothesis: true location shift is not equal to 0
Etnia: 2
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 4606, p-value = 6.117e-12
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 4545, p-value = 1.527e-10
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 3096, p-value = 0.07814
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 3601, p-value = 9.51e-07
alternative hypothesis: true location shift is not equal to 0
Etnia: 5
VEF1:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 13439, p-value = 2.373e-08
alternative hypothesis: true location shift is not equal to 0
CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 13105, p-value = 2.854e-05
alternative hypothesis: true location shift is not equal to 0
VEF1/CVF:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 10788, p-value = 0.01624
alternative hypothesis: true location shift is not equal to 0
FEF25-75:
Wilcoxon signed rank test with continuity correction
data: obs and pred
V = 12286, p-value = 4.598e-05
alternative hypothesis: true location shift is not equal to 0
X2005_GLI_WHITE <- read_excel("2005 GLI WHITE.xlsx")
gw <- X2005_GLI_WHITE
names(gw) <- tolower(names(gw))
# Rename slash-separated column names to safe R names
gw <- gw |>
rename(
fev1fvcz = `fev1/fvcz`,
fev1fvclln = `fev1/fvclln`,
fev1fvcpred = `fev1/fvcpred`,
fev1fvctile = `fev1/fvctile`,
fev1fvc = `fev1/fvc`
) |>
mutate(
sexf = as.factor(sex),
ethnic = as.factor(ethnic),
ethnic12 = as.factor(ethnic12),
ethnicw = as.factor(ethnicw)
)
expss_digits(digits = 3)
gw |> calc_cro_mean_sd_n(fev1z, ethnic, sexf) |> htmlTable()| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Female | fev1z | Mean | 0.351 | -0.061 | -0.024 | |
| Std. dev. | 1.166 | 1.174 | 1.220 | |||
| Unw. valid N | 718.000 | 101.000 | 192.000 | |||
| Male | fev1z | Mean | 0.289 | 0.009 | 0.109 | |
| Std. dev. | 1.101 | 1.113 | 1.198 | |||
| Unw. valid N | 634.000 | 80.000 | 188.000 | |||
gw |> calc_cro_mean_sd_n(fvcz, ethnic, sexf) |> htmlTable()| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Female | fvcz | Mean | 0.160 | -0.247 | -0.240 | |
| Std. dev. | 1.186 | 1.184 | 1.209 | |||
| Unw. valid N | 725.000 | 102.000 | 198.000 | |||
| Male | fvcz | Mean | 0.106 | -0.236 | -0.133 | |
| Std. dev. | 1.113 | 1.130 | 1.200 | |||
| Unw. valid N | 638.000 | 82.000 | 191.000 | |||
gw |> calc_cro_mean_sd_n(fev1fvcz, ethnic, sexf) |> htmlTable()| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Female | fev1fvcz | Mean | 0.328 | 0.340 | 0.383 | |
| Std. dev. | 0.999 | 0.990 | 1.018 | |||
| Unw. valid N | 718.000 | 101.000 | 192.000 | |||
| Male | fev1fvcz | Mean | 0.304 | 0.372 | 0.380 | |
| Std. dev. | 0.929 | 0.891 | 0.941 | |||
| Unw. valid N | 634.000 | 80.000 | 188.000 | |||
gw |> calc_cro_mean_sd_n(fef2575z, ethnic, sexf) |> htmlTable()| ethnic | ||||||
|---|---|---|---|---|---|---|
| 1 | 2 | 5 | ||||
| sexf | ||||||
| Female | fef2575z | Mean | 0.221 | 0.029 | 0.086 | |
| Std. dev. | 1.060 | 0.960 | 1.082 | |||
| Unw. valid N | 598.000 | 95.000 | 194.000 | |||
| Male | fef2575z | Mean | 0.176 | 0.228 | 0.198 | |
| Std. dev. | 0.951 | 0.899 | 1.071 | |||
| Unw. valid N | 540.000 | 80.000 | 186.000 | |||
vars <- c("age", "height", "weight", "imc", "fev1", "fvc", "fef2575")
cor_mm <- mm |> select(all_of(vars)) |> na.omit() |> cor()
cor_ff <- ff |> select(all_of(vars)) |> na.omit() |> cor()
p_mm <- ggcorrplot(
cor_mm, hc.order = FALSE, type = "lower", lab = TRUE, lab_size = 3,
method = "circle", colors = c("tomato2", "white", "springgreen3"),
title = "Masculino", ggtheme = theme_bw
)
p_ff <- ggcorrplot(
cor_ff, hc.order = FALSE, type = "lower", lab = TRUE, lab_size = 3,
method = "circle", colors = c("tomato2", "white", "springgreen3"),
title = "Feminino", ggtheme = theme_bw
)
p_mm + p_ffvars_base <- c("height", "age", "ethnic01")
mm_clean_fvc <- na.omit(mm[, c("fvc", vars_base)])
mm_clean_fev1 <- na.omit(mm[, c("fev1", vars_base)])
mm_clean_fev1fvc <- na.omit(mm[, c("fev1fvc", vars_base)])
mm_clean_fef2575 <- na.omit(mm[, c("fef2575", vars_base)])
ff_clean_fvc <- na.omit(ff[, c("fvc", vars_base)])
ff_clean_fev1 <- na.omit(ff[, c("fev1", vars_base)])
ff_clean_fev1fvc <- na.omit(ff[, c("fev1fvc", vars_base)])
ff_clean_fef2575 <- na.omit(ff[, c("fef2575", vars_base)])gamlss_formula <- function(outcome, data) {
gamlss(
as.formula(paste(outcome, "~ pb(height) + pb(age) + ethnic01")),
sigma.formula = ~ pb(height) + pb(age) + ethnic01,
family = BCCGo,
data = data,
trace = FALSE
)
}
mm_model_fvc <- gamlss_formula("fvc", mm_clean_fvc)
mm_model_fev1 <- gamlss_formula("fev1", mm_clean_fev1)
mm_model_fev1fvc <- gamlss_formula("fev1fvc", mm_clean_fev1fvc)
mm_model_fef2575 <- gamlss_formula("fef2575", mm_clean_fef2575)ff_model_fvc <- gamlss_formula("fvc", ff_clean_fvc)
ff_model_fev1 <- gamlss_formula("fev1", ff_clean_fev1)
ff_model_fev1fvc <- gamlss_formula("fev1fvc", ff_clean_fev1fvc)
ff_model_fef2575 <- gamlss_formula("fef2575", ff_clean_fef2575)spirometry_data <- x2005 |>
mutate(weight_ethnicity = case_when(
ethnic == 1 ~ 0.64,
ethnic == 2 ~ 2.38,
ethnic == 5 ~ 1.13
))
data_female <- spirometry_data |>
filter(sex == 2) |>
select(fev1, age, height, weight_ethnicity) |>
na.omit()
fev1_model_female <- gamlss(
fev1 ~ pb(height) + pb(age),
sigma.formula = ~ pb(height) + pb(age),
nu.formula = ~ 1,
tau.formula = ~ 1,
family = BCCGo,
weights = weight_ethnicity,
data = data_female,
trace = FALSE
)
summary(fev1_model_female)******************************************************************
Family: c("BCCGo", "Box-Cox-Cole-Green-orig.")
Call:
gamlss(formula = fev1 ~ pb(height) + pb(age), sigma.formula = ~pb(height) +
pb(age), nu.formula = ~1, tau.formula = ~1, family = BCCGo,
data = data_female, weights = weight_ethnicity, trace = FALSE)
Fitting method: RS()
------------------------------------------------------------------
Mu link function: log
Mu Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.7870037 0.0566655 -31.536 < 2e-16 ***
pb(height) 0.0157139 0.0006729 23.351 < 2e-16 ***
pb(age) 0.0262923 0.0044828 5.865 6.11e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
------------------------------------------------------------------
Sigma link function: log
Sigma Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.509819 0.263201 -9.536 <2e-16 ***
pb(height) 0.005824 0.003129 1.861 0.063 .
pb(age) -0.029411 0.021806 -1.349 0.178
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
------------------------------------------------------------------
Nu link function: identity
Nu Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.3472 0.1961 1.77 0.0771 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
------------------------------------------------------------------
NOTE: Additive smoothing terms exist in the formulas:
i) Std. Error for smoothers are for the linear effect only.
ii) Std. Error for the linear terms maybe are not accurate.
------------------------------------------------------------------
No. of observations in the fit: 1007
Degrees of Freedom for the fit: 13.53572
Residual Deg. of Freedom: 993.4643
at cycle: 8
Global Deviance: -40.22937
AIC: -13.15794
SBC: 53.36646
******************************************************************
newdata <- data.frame(age = 10, height = 140)
mu <- predict(fev1_model_female, newdata = newdata, what = "mu", type = "response")
sigma <- predict(fev1_model_female, newdata = newdata, what = "sigma", type = "response")
nu <- predict(fev1_model_female, newdata = newdata, what = "nu", type = "response")
fev1_median <- mu
fev1_p5 <- qBCCGo(0.05, mu = mu, sigma = sigma, nu = nu)
cat("VEF1 previsto (mediana):", round(fev1_median, 2), "L\n")VEF1 previsto (mediana): 1.95 L
cat("Limite inferior da normalidade (P5):", round(fev1_p5, 2), "L\n")Limite inferior da normalidade (P5): 1.55 L
comp <- read_excel("compare_2020.xlsx", sheet = "raw")
names(comp) <- tolower(names(comp))
# Renomear colunas com hífen para nomes válidos em R
comp <- comp |>
rename(
fef2575_p5 = `fef25-75_p5`,
fef2575_lin = `fef25-75lin`
) |>
mutate(
agey = as.factor(round(age, digits = 0)),
agex = case_when(
age < 6 ~ "3-6 anos",
age >= 6 & age < 9 ~ "6-9 anos",
age >= 9 ~ "9-12 anos"
) |> as.factor(),
ethnic.f = case_when(
ethnic == 0 ~ "White",
ethnic == 1 ~ "Non-White"
)
)
comp_f0 <- comp |> filter(sex == "Female", ethnic == 0)
comp_f1 <- comp |> filter(sex == "Female", ethnic == 1)
comp_m0 <- comp |> filter(sex == "Male", ethnic == 0)
comp_m1 <- comp |> filter(sex == "Male", ethnic == 1)expss_digits(digits = 2)
# FVC
cat("== FVC ==\n")== FVC ==
calc_cro_mean(comp_m0, (cvf_p5 / fvclln - 1) * 100)
calc_cro_mean(comp_m1, (cvf_p5 / fvclln - 1) * 100)
calc_cro_mean(comp_f0, (cvf_p5 / fvclln - 1) * 100)
calc_cro_mean(comp_f1, (cvf_p5 / fvclln - 1) * 100)
# FEV1
cat("== VEF1 ==\n")== VEF1 ==
calc_cro_mean(comp_m0, (vef1_p5 / fev1lln - 1) * 100)
calc_cro_mean(comp_m1, (vef1_p5 / fev1lln - 1) * 100)
calc_cro_mean(comp_f0, (vef1_p5 / fev1lln - 1) * 100)
calc_cro_mean(comp_f1, (vef1_p5 / fev1lln - 1) * 100)
# FEV1/FVC
expss_digits(digits = 3)
cat("== VEF1/CVF ==\n")== VEF1/CVF ==
calc_cro_mean(comp_m0, vef1cvf_p5 - fev1fvclln)
calc_cro_mean(comp_m1, vef1cvf_p5 - fev1fvclln)
calc_cro_mean(comp_f0, vef1cvf_p5 - fev1fvclln)
calc_cro_mean(comp_f1, vef1cvf_p5 - fev1fvclln)
# FEF25-75
expss_digits(digits = 2)
cat("== FEF25-75 ==\n")== FEF25-75 ==
calc_cro_mean(comp_m0, (fef2575_p5 / fef2575lln - 1) * 100)
calc_cro_mean(comp_m1, (fef2575_p5 / fef2575lln - 1) * 100)
calc_cro_mean(comp_f0, (fef2575_p5 / fef2575lln - 1) * 100)
calc_cro_mean(comp_f1, (fef2575_p5 / fef2575lln - 1) * 100)| #Total | |
|---|---|
| (cvf_p5/fvclln - 1) * 100 |
| #Total | |
|---|---|
| (cvf_p5/fvclln - 1) * 100 | 0.36 |
| #Total | |
|---|---|
| (cvf_p5/fvclln - 1) * 100 |
| #Total | |
|---|---|
| (cvf_p5/fvclln - 1) * 100 | 0.14 |
| #Total | |
|---|---|
| (vef1_p5/fev1lln - 1) * 100 |
| #Total | |
|---|---|
| (vef1_p5/fev1lln - 1) * 100 | 3.48 |
| #Total | |
|---|---|
| (vef1_p5/fev1lln - 1) * 100 |
| #Total | |
|---|---|
| (vef1_p5/fev1lln - 1) * 100 | 2.09 |
| #Total | |
|---|---|
| vef1cvf_p5 - fev1fvclln |
| #Total | |
|---|---|
| vef1cvf_p5 - fev1fvclln | 0.045 |
| #Total | |
|---|---|
| vef1cvf_p5 - fev1fvclln |
| #Total | |
|---|---|
| vef1cvf_p5 - fev1fvclln | 0.028 |
| #Total | |
|---|---|
| (fef2575_p5/fef2575lln - 1) * 100 |
| #Total | |
|---|---|
| (fef2575_p5/fef2575lln - 1) * 100 | 10.62 |
| #Total | |
|---|---|
| (fef2575_p5/fef2575lln - 1) * 100 |
| #Total | |
|---|---|
| (fef2575_p5/fef2575lln - 1) * 100 | 10.22 |
# Função auxiliar para construir os painéis de LLN
lln_panel <- function(data, y_obs, y_gli, y_label) {
ggplot(data) +
geom_point(aes(height, .data[[y_obs]]), col = "#BC3C29FF", alpha = 0.1) +
geom_point(aes(height, .data[[y_gli]]), col = "#0072B5FF", alpha = 0.1) +
geom_smooth(aes(height, .data[[y_obs]]), col = "#BC3C29FF", se = FALSE) +
geom_smooth(aes(height, .data[[y_gli]]), col = "#0072B5FF", se = FALSE) +
labs(x = "Estatura (cm)", y = y_label) +
theme_bw()
}s3a <- lln_panel(comp_f0, "vef1_p5", "fev1lln", "VEF1 (L) LIN")
s3b <- lln_panel(comp_f0, "cvf_p5", "fvclln", "CVF (L) LIN")
s3c <- ggplot(comp_f0) +
geom_point(aes(height, vef1cvf_p5), col = "#BC3C29FF", alpha = 0.1) +
geom_point(aes(height, fev1fvclln), col = "#0072B5FF", alpha = 0.1) +
geom_smooth(aes(height, vef1cvf_p5), col = "#BC3C29FF", se = FALSE) +
geom_smooth(aes(height, fev1fvclln), col = "#0072B5FF", se = FALSE) +
labs(x = "Estatura (cm)") +
scale_y_continuous(name = "VEF1/CVF LIN", limits = c(0.7, 0.95)) +
theme_bw()
s3d <- lln_panel(comp_f0, "fef2575_p5", "fef2575lln", "FEF25-75 (L/s) LIN")
figure_s3 <- ggarrange(s3a, s3b, s3c, s3d, labels = c("A", "B", "C", "D"))
figure_s3s4a <- lln_panel(comp_f1, "vef1_p5", "fev1lln", "VEF1 (L) LIN")
s4b <- lln_panel(comp_f1, "cvf_p5", "fvclln", "CVF (L) LIN")
s4c <- ggplot(comp_f1) +
geom_point(aes(height, vef1cvf_p5), col = "#BC3C29FF", alpha = 0.1) +
geom_point(aes(height, fev1fvclln), col = "#0072B5FF", alpha = 0.1) +
geom_smooth(aes(height, vef1cvf_p5), col = "#BC3C29FF", se = FALSE) +
geom_smooth(aes(height, fev1fvclln), col = "#0072B5FF", se = FALSE) +
labs(x = "Estatura (cm)") +
scale_y_continuous(name = "VEF1/CVF LIN", limits = c(0.7, 0.95)) +
theme_bw()
s4d <- lln_panel(comp_f1, "fef2575_p5", "fef2575lln", "FEF25-75 (L/s) LIN")
figure_s4 <- ggarrange(s4a, s4b, s4c, s4d, labels = c("A", "B", "C", "D"))
figure_s4s5a <- lln_panel(comp_m0, "vef1_p5", "fev1lln", "VEF1 (L) LIN")
s5b <- lln_panel(comp_m0, "cvf_p5", "fvclln", "CVF (L) LIN")
s5c <- ggplot(comp_m0) +
geom_point(aes(height, vef1cvf_p5), col = "#BC3C29FF", alpha = 0.1) +
geom_point(aes(height, fev1fvclln), col = "#0072B5FF", alpha = 0.1) +
geom_smooth(aes(height, vef1cvf_p5), col = "#BC3C29FF", se = FALSE) +
geom_smooth(aes(height, fev1fvclln), col = "#0072B5FF", se = FALSE) +
labs(x = "Estatura (cm)") +
scale_y_continuous(name = "VEF1/CVF LIN", limits = c(0.7, 0.95)) +
theme_bw()
s5d <- lln_panel(comp_m0, "fef2575_p5", "fef2575lln", "FEF25-75 (L/s) LIN")
figure_s5 <- ggarrange(s5a, s5b, s5c, s5d, labels = c("A", "B", "C", "D"))
figure_s5s6a <- lln_panel(comp_m1, "vef1_p5", "fev1lln", "VEF1 (L) LIN")
s6b <- lln_panel(comp_m1, "cvf_p5", "fvclln", "CVF (L) LIN")
s6c <- ggplot(comp_m1) +
geom_point(aes(height, vef1cvf_p5), col = "#BC3C29FF", alpha = 0.1) +
geom_point(aes(height, fev1fvclln), col = "#0072B5FF", alpha = 0.1) +
geom_smooth(aes(height, vef1cvf_p5), col = "#BC3C29FF", se = FALSE) +
geom_smooth(aes(height, fev1fvclln), col = "#0072B5FF", se = FALSE) +
labs(x = "Estatura (cm)") +
scale_y_continuous(name = "VEF1/CVF LIN", limits = c(0.7, 0.95)) +
theme_bw()
s6d <- lln_panel(comp_m1, "fef2575_p5", "fef2575lln", "FEF25-75 (L/s) LIN")
figure_s6 <- ggarrange(s6a, s6b, s6c, s6d, labels = c("A", "B", "C", "D"))
figure_s6figure_s7 <- ggarrange(s3c, s4c, s5c, s6c, labels = c("A", "B", "C", "D"))
figure_s7figure_s8 <- ggarrange(s3a, s4a, s5a, s6a, labels = c("A", "B", "C", "D"))
figure_s8# FEV1
p_fev1 <- ggplot() +
geom_smooth(data = comp, aes(height, fev1lln), color = "blue") +
geom_smooth(data = comp, aes(height, vef1_p5), color = "red") +
labs(x = "Estatura (cm)", y = "LIN VEF1")
p_fev1 + facet_wrap(~ sex + ethnic.f) + theme_classic(base_size = 16)
# FVC
p_fvc <- ggplot() +
geom_smooth(data = comp, aes(height, fvclln), color = "blue") +
geom_smooth(data = comp, aes(height, cvf_p5), color = "red") +
labs(x = "Estatura (cm)", y = "LIN CVF")
p_fvc + facet_wrap(~ sex + ethnic.f) + theme_classic(base_size = 16)
# FVC — P50 e P5
p_fvc2 <- ggplot() +
geom_smooth(data = comp, aes(height, fvcpred), color = "blue") +
geom_smooth(data = comp, aes(height, cvf_p50), color = "red") +
geom_smooth(data = comp, aes(height, fvclln), color = "blue") +
geom_smooth(data = comp, aes(height, cvf_p5), color = "red") +
labs(x = "Estatura (cm)", y = "CVF")
p_fvc2 + facet_wrap(~ sex + ethnic.f) + theme_classic(base_size = 16)
# FEV1/FVC
p_ratio <- ggplot() +
geom_smooth(data = comp, aes(height, fev1fvclln), color = "blue") +
geom_smooth(data = comp, aes(height, vef1cvf_p5), color = "red") +
geom_smooth(data = comp, aes(height, fev1fvcpred), color = "blue") +
geom_smooth(data = comp, aes(height, vef1cvf_p50), color = "red") +
labs(x = "Estatura (cm)", y = "LIN VEF1/CVF")
p_ratio + facet_wrap(~ sex + ethnic.f) + theme_classic(base_size = 16)
# FEF25-75
p_fef <- ggplot() +
geom_smooth(data = comp, aes(height, fef2575pred), color = "blue") +
geom_smooth(data = comp, aes(height, fef2575_p50), color = "red") +
geom_smooth(data = comp, aes(height, fef2575lln), color = "blue") +
geom_smooth(data = comp, aes(height, fef2575_lin), color = "red") +
labs(x = "Estatura (cm)", y = "FEF25-75 LIN")
p_fef + facet_wrap(~ sex + ethnic.f) + theme_classic(base_size = 16)mal <- read_excel("%-Dados Mallozi/Mallozi EXTRAIDOS - Maio2021.xlsx")
mj <- read_excel("%-Dados Mallozi/MHJ_maiores13_rio_branco.xlsx")
mal <- mal |>
mutate(
cidade = "São Paulo",
center = 19,
sex = case_when(sexf == "Masculino" | sexf == "Male" ~ 1L,
sexf == "Feminino" | sexf == "Female" ~ 2L),
ethnic = 1,
ethnic01 = 0,
ethnicf = "Branca"
)
mj <- mj |>
mutate(
cidade = "Porto Alegre",
center = 13
)
malmj <- full_join(mal, mj) |>
mutate(
protocol = as.factor(protocol),
ethnic = as.factor(ethnic),
ethnic01 = as.factor(ethnic01)
)
xm <- full_join(x2005, malmj) |>
mutate(
sexf = case_when(
sexf == "Masculino" ~ "Male",
sexf == "Feminino" ~ "Female",
TRUE ~ as.character(sexf)
) |> as.factor(),
sex = if_else(sexf == "Male", 1L, 2L),
cidade = as.factor(cidade)
)
write_xlsx(xm, "xm.xlsx")ggplot(xm, aes(height, fvc, col = protocol)) + geom_point(alpha = 0.1) + geom_smooth() + labs(title = "CVF")
ggplot(xm, aes(height, fev1, col = protocol)) + geom_point(alpha = 0.1) + geom_smooth() + labs(title = "VEF1")
ggplot(xm, aes(height, fef2575, col = protocol)) + geom_point(alpha = 0.1) + geom_smooth() + labs(title = "FEF25-75")
ggplot(xm, aes(height, fev1fvc, col = protocol)) + geom_point(alpha = 0.1) + geom_smooth() + labs(title = "VEF1/CVF")