pacman::p_load(tidyverse,
here,
gtsummary,
janitor,
sjPlot)2022 Ilze SDF RCT data analysis
Packages
here::here()[1] "/home/sergiouribe/Insync/sergio.uribe@gmail.com/Google Drive/Research Drive/2022_ilze_sdf_fluoride_non_invasive_rct/data_analysis_2022_rct_sdf_ilze"
Dataset
data_baseline <- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vTtuaGor2bwSwHbFTXPPBzzcXWCXhvU5O-6gPr_Fne9dxYr1gKCrQJSu7cUeDhhycfUQUb_ss7IOBmV/pub?gid=1016017385&single=true&output=csv")
data_codes <- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vS6lfWKoICLdJ59Z4ri5cz2wC2UXM9XHSCdrCkKuZq9VEGk6Y_sfiSrOyCeFY_mO--WiDVFm51ocLfQ/pub?gid=1282333714&single=true&output=csv")
data_final <- read_csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vRC47LTIwUcGHdtzjLDaLgmyKELs1qhvce-YOJSrIvgBe5HOayMBhUHndZE5TFsu_jhwR3SSdj5Zyb8/pub?gid=40656487&single=true&output=csv")Save a copy of the data, for offline
write_csv(data_baseline, here("data", "data_baseline.csv"))
write_csv(data_codes, here("data", "data_codes.csv"))
write_csv(data_final, here("data", "data_final.csv"))Add a column with the moment for later join
data_baseline$Time <- "baseline"
data_final$Time <- "final"Cleaning with janitor
data_baseline <- data_baseline %>%
janitor::clean_names(case = "snake") %>%
remove_empty(c("rows", "cols"))
data_codes <- data_codes %>%
janitor::clean_names(case = "snake") %>%
remove_empty(c("rows", "cols"))
data_final <- data_final %>%
janitor::clean_names(case = "snake") %>%
remove_empty(c("rows", "cols")) Data cleaning
Create new columns with the age
data_baseline <- data_baseline %>%
mutate(berna_kods = as.double(berna_kods)) %>%
mutate(izmeklesanas_datums = lubridate::mdy(izmeklesanas_datums)) %>%
mutate(berna_dzimsanas_datums = lubridate::mdy(berna_dzimsanas_datums)) %>%
mutate(across(5:61, as.character))
data_final <- data_final %>%
mutate(berna_kods = as.double(berna_kods)) %>%
mutate(beigu_izmeklesanas_datums = lubridate::mdy(beigu_izmeklesanas_datums)) %>%
mutate(across(6:64, as.character))===todo: remove the patients with kode zero from baseline
data_baseline <- data_baseline %>%
filter(berna_kods > 0)Merge both datasets: baseline and final
data_consolidated <- data_baseline %>% full_join(data_final)# rm(data_baseline, data_final)create new variable pain experience
two new columns
firstly, will codify if any pain, then yes,
data_consolidated <- data_consolidated %>%
mutate(pain_experience_all = case_when(
sudzibas_par_zobiem == "Nav" ~ "No",
TRUE ~ "Yes"
)) %>%
mutate(pain_experience_final = case_when(
time == "baseline" ~ "NA",
sudzibas_par_zobiem == "Nav" ~ "No experience",
TRUE ~ "Pain experience"
))Move the time column to the beginning
data_consolidated <- data_consolidated %>% relocate(time, .before = "timestamp")Remove the columns grupa_4 and grupa_63
data_consolidated <- data_consolidated %>%
select(-c(grupa_4, grupa_63))Add the codes from the data_codes
Convert the kods in data_codes to numeric
data_codes <- data_codes %>%
mutate(kods = as.numeric(kods))remove all the innecesary columns from the codes data
data_codes <- data_codes %>%
select(kods, grupas_krasa)add the codes as a new variable called group
data_consolidated <- left_join(data_consolidated, data_codes, by = c("berna_kods" = "kods")) %>%
relocate(grupas_krasa, .after = time)Create AGE column
data_consolidated <- data_consolidated %>%
mutate(age_years = trunc(as.numeric(
difftime(izmeklesanas_datums, berna_dzimsanas_datums, units = "weeks")
) / 52.25)) %>%
mutate(age_months = lubridate::interval(berna_dzimsanas_datums, izmeklesanas_datums) %/% months(1)) %>%
relocate(age_years, .after = "grupas_krasa") %>%
relocate(age_months, .after = "grupas_krasa")extract the age from the data to add it to the final children
data_age <- data_consolidated %>%
filter(time == "baseline") %>%
select(berna_kods,
age_months,
age_years,
dzimums)now added to the data consolidate
data_consolidated <- full_join(data_consolidated, data_age, by = "berna_kods") %>%
select(-c(age_months.x, age_years.x, dzimums.x)) %>%
rename(age_months = age_months.y) %>%
rename(age_years = age_years.y) %>%
rename(dzimums = dzimums.y) %>%
relocate(age_months:dzimums, .before = timestamp)Check the attrition per group
data_consolidated %>%
tabyl(grupas_krasa, time) %>%
# adorn_totals(where = "col") %>%
#adorn_percentages(denominator = "col") %>%
#adorn_pct_formatting() %>%
adorn_totals(where = "row") grupas_krasa baseline final
Balta 70 55
Dzeltena 67 52
Lillā 75 58
Rozā 71 63
Zaļa 77 65
Zila 75 66
<NA> 2 1
Total 437 360
== removed NA, FIX THIS
data_consolidated <- data_consolidated %>%
filter(!is.na(grupas_krasa))ABSTRACT IADPH
Table 1 abstract IADPH
data_iadph <- data_consolidated %>%
filter(time == "final") %>%
select(
Group = grupas_krasa,
Gender = dzimums,
"Age (months)"= age_months,
age_years,
Plaque = aplikums,
"Parents satisfaction" = cik_apmierinats_a_jus_esat_ar_sava_berna_zobu_izskatu,
"Acceptable to continue with the treatment" = vai_jus_piekristu_turpinat_zobu_arstesanu_ar_petijuma_izmantoto_metodi,
"Minor complications"= komplikacijas_minimalas,
"Major complications"= komplikacijas_nopietnas,
"Pain experience"= pain_experience_final
)Recode the levels
data_iadph <- data_iadph %>%
mutate(Gender = recode(Gender , "Meitene" = "Girl", "Zēns" = "Boy")) %>%
mutate(Plaque = recode(Plaque, "Redzams" = "Visible", "Nav redzams" = "No visible")) %>%
mutate(`Minor complications` = recode(`Minor complications`, "Jā" = "Minor complications", "Nē" = "No")) %>%
mutate(`Major complications` = recode(`Major complications`, "Jā" = "Major complications", "Nē" = "No"))Relevel the factors
data_iadph <- data_iadph %>%
mutate(Plaque = fct_relevel(Plaque, "Visible")) data_iadph %>%
select(-age_years) %>%
gtsummary::tbl_summary(by = Group, missing = "no") %>%
gtsummary::bold_labels() %>%
gtsummary::add_overall()| Characteristic | Overall, N = 3591 | Balta, N = 551 | Dzeltena, N = 521 | Lillā, N = 581 | Rozā, N = 631 | Zaļa, N = 651 | Zila, N = 661 |
|---|---|---|---|---|---|---|---|
| Gender | |||||||
| Boy | 200 (56%) | 29 (53%) | 28 (55%) | 29 (50%) | 36 (60%) | 38 (58%) | 40 (61%) |
| Girl | 155 (44%) | 26 (47%) | 23 (45%) | 29 (50%) | 24 (40%) | 27 (42%) | 26 (39%) |
| Age (months) | 45 (35, 55) | 44 (34, 54) | 47 (39, 58) | 44 (34, 56) | 45 (39, 52) | 45 (30, 53) | 45 (32, 54) |
| Plaque | |||||||
| Visible | 195 (54%) | 31 (56%) | 29 (56%) | 31 (53%) | 38 (60%) | 42 (65%) | 24 (36%) |
| No visible | 164 (46%) | 24 (44%) | 23 (44%) | 27 (47%) | 25 (40%) | 23 (35%) | 42 (64%) |
| Parents satisfaction | |||||||
| 1 | 13 (3.6%) | 3 (5.5%) | 2 (3.8%) | 2 (3.4%) | 1 (1.6%) | 3 (4.6%) | 2 (3.0%) |
| 2 | 17 (4.7%) | 1 (1.8%) | 0 (0%) | 1 (1.7%) | 6 (9.5%) | 6 (9.2%) | 3 (4.5%) |
| 3 | 81 (23%) | 15 (27%) | 11 (21%) | 17 (29%) | 19 (30%) | 9 (14%) | 10 (15%) |
| 4 | 64 (18%) | 10 (18%) | 13 (25%) | 6 (10%) | 16 (25%) | 9 (14%) | 10 (15%) |
| 5 | 184 (51%) | 26 (47%) | 26 (50%) | 32 (55%) | 21 (33%) | 38 (58%) | 41 (62%) |
| Acceptable to continue with the treatment | |||||||
| Iespējams | 11 (3.1%) | 0 (0%) | 3 (5.8%) | 3 (5.2%) | 2 (3.2%) | 1 (1.5%) | 2 (3.0%) |
| Neesmu pārliecināts/a | 1 (0.3%) | 0 (0%) | 0 (0%) | 0 (0%) | 0 (0%) | 1 (1.5%) | 0 (0%) |
| Noteikti | 345 (96%) | 55 (100%) | 49 (94%) | 55 (95%) | 60 (95%) | 62 (95%) | 64 (97%) |
| Visticamāk, ka nē | 2 (0.6%) | 0 (0%) | 0 (0%) | 0 (0%) | 1 (1.6%) | 1 (1.5%) | 0 (0%) |
| Minor complications | |||||||
| Minor complications | 270 (75%) | 45 (82%) | 43 (83%) | 46 (79%) | 48 (76%) | 36 (55%) | 52 (79%) |
| No | 89 (25%) | 10 (18%) | 9 (17%) | 12 (21%) | 15 (24%) | 29 (45%) | 14 (21%) |
| Major complications | |||||||
| Major complications | 119 (33%) | 23 (42%) | 23 (44%) | 24 (41%) | 15 (24%) | 13 (20%) | 21 (32%) |
| No | 240 (67%) | 32 (58%) | 29 (56%) | 34 (59%) | 48 (76%) | 52 (80%) | 45 (68%) |
| Pain experience | |||||||
| No experience | 322 (90%) | 51 (93%) | 42 (81%) | 51 (88%) | 59 (94%) | 60 (92%) | 59 (89%) |
| Pain experience | 37 (10%) | 4 (7.3%) | 10 (19%) | 7 (12%) | 4 (6.3%) | 5 (7.7%) | 7 (11%) |
|
1
n (%); Median (IQR)
|
|||||||
Which factors explain parents satisfaction?
Dicho the response variable 1-3 = 0
data_iadph <- data_iadph %>%
mutate(satisfaction = case_when(
`Parents satisfaction` < 4 ~ 0,
TRUE ~ 1
))m1 <-
glm(
satisfaction ~ Group + Gender + `Age (months)` + Plaque + `Minor complications` + `Major complications` + `Pain experience`,
family = binomial,
data = data_iadph
)m1 %>%
gtsummary::tbl_regression(exponentiate = T)| Characteristic | OR1 | 95% CI1 | p-value |
|---|---|---|---|
| Group | |||
| Balta | — | — | |
| Dzeltena | 1.24 | 0.52, 3.01 | 0.6 |
| Lillā | 0.93 | 0.41, 2.10 | 0.9 |
| Rozā | 0.63 | 0.28, 1.39 | 0.3 |
| Zaļa | 1.28 | 0.56, 2.97 | 0.6 |
| Zila | 1.55 | 0.67, 3.63 | 0.3 |
| Gender | |||
| Boy | — | — | |
| Girl | 1.10 | 0.68, 1.79 | 0.7 |
| Age (months) | 1.03 | 1.02, 1.05 | <0.001 |
| Plaque | |||
| Visible | — | — | |
| No visible | 1.79 | 1.05, 3.07 | 0.033 |
| Minor complications | |||
| Minor complications | — | — | |
| No | 1.05 | 0.57, 1.95 | 0.9 |
| Major complications | |||
| Major complications | — | — | |
| No | 1.80 | 1.03, 3.18 | 0.041 |
| Pain experience | |||
| No experience | — | — | |
| Pain experience | 2.02 | 0.87, 5.09 | 0.12 |
|
1
OR = Odds Ratio, CI = Confidence Interval
|
|||
sjPlot::plot_model(m1,
title = "Regression model explaining satisfaction")Column’s name
[1] “timestamp”
[2] “ejected”
[3] “berna code”
[4] “date of investigation”
[5] “date of birth”.
[6] “sex”
[7] “medical history”
[8] “thickness of the tooth eruption”
[9] “toothpaste”
[10] “whether there is an improvement in the knowledge of tooth eruption at the time of the peday”
[11] “daily or almost daily drinking of juice, tea, cocoa milk etc.” [12] “sweets every day”
[13] “neck candy and or syrups thick”
[14] “is there an improvement in the peday time diet”
[15] “complaints about teeth”
[16] “experience of dental treatment in the past only recognized heavy tooth loss”
[17] “plaque”
[58] “bottle of the year”
[59] “duration of feeding in months”
[60] “mouth breathing”
[61] “time”
[62] “quantity”
[63] “group 4”
[64] “end date of consumption”
[65] “medical history or history of systemic illnesses during the year”
[66] “how satisfied are you with the appearance of your child’s teeth”
[67] “would you agree to continue with the method used by the petitioner”
[68] “complications are minimal”
[69] “complications serious”
[70] “let the patient know how satisfied you are with the appearance of their teeth”
[71] “a year ago, did you take a look at the boy’s teeth”
[72] “do you now partirate your son’s teeth”
[73] “group 63