Temperament visualizations

This page provides visualizations of the Early Childhood Behavior Questionnaire (ECBQ) data related to child temperament.

Setup

As of 2023-09-21, this workflow uses a separate set of functions specifically designed to extract ECBQ data from the raw KoBoToolbox files for English-speaking families only.

The functions are found in R/ with the prefix ecbq_.

We create a “wide” data frame ecbq_wide_df as one of the targets of targets:tar_make(). We attempt to load that here and ensure that all R/ecbq_ functions are in the local environment.

if (!('ecbq_wide_df' %in% ls())) {
  targets::tar_load(ecbq_wide_df, store="../_targets")
}

if (!('ecbq_plot_all' %in% ls())) {
  ecbq_fl <- list.files("../R", "^ecbq_", full.names = TRUE)
  purrr::walk(ecbq_fl, source)
}

Summarize

ecbq_complete <- ecbq_wide_df |>
  tidyr::complete()

str(ecbq_complete)
## tibble [783 × 40] (S3: tbl_df/tbl/data.frame)
##  $ participant_id              : chr [1:783] "PILOT" "o6Ri9H8Ka0A" "U1Ro3M7Ri" "e0N4H8O2A" ...
##  $ child_sex                   : chr [1:783] "male" "female" "male" "female" ...
##  $ age_group                   : chr [1:783] "18mo" "18mo" "24mo" "12mo" ...
##  $ rothbart_unfamiliarperson   : chr [1:783] "very_rarely" "very_rarely" "always" "very_rarely" ...
##  $ rothbart_troubletask        : chr [1:783] "less_than_half" "less_than_half" "less_than_half" "very_rarely" ...
##  $ rothbart_companyofchild     : chr [1:783] "more_than_half" NA "always" "almost_always" ...
##  $ rothbart_choiceactivities   : chr [1:783] "almost_always" "always" "almost_always" "almost_always" ...
##  $ rothbart_quietlysung        : chr [1:783] NA "almost_always" "less_than_half" "more_than_half" ...
##  $ rothbart_playingoutdoors    : chr [1:783] "about_half" "more_than_half" "always" "always" ...
##  $ rothbart_morethan10         : chr [1:783] "less_than_half" "never" "more_than_half" "more_than_half" ...
##  $ rothbart_respondingremarks  : chr [1:783] "almost_always" "almost_always" "about_half" "about_half" ...
##  $ rothbart_excitedlovedadults : chr [1:783] NA "very_rarely" "almost_always" NA ...
##  $ rothbart_fiddlehair         : chr [1:783] "about_half" "very_rarely" "very_rarely" "more_than_half" ...
##  $ rothbart_roughrowdy         : chr [1:783] "about_half" "very_rarely" "more_than_half" "about_half" ...
##  $ rothbart_rockedhugged       : chr [1:783] "never" "about_half" "less_than_half" "less_than_half" ...
##  $ rothbart_involvednewactivity: chr [1:783] "almost_always" "more_than_half" "more_than_half" "almost_always" ...
##  $ rothbart_tirequickly        : chr [1:783] "very_rarely" "almost_always" "about_half" "less_than_half" ...
##  $ rothbart_callattention      : chr [1:783] "more_than_half" "more_than_half" "almost_always" "more_than_half" ...
##  $ rothbart_tags               : chr [1:783] "never" "never" "never" "never" ...
##  $ rothbart_noisyenvironment   : chr [1:783] "very_rarely" "never" NA "never" ...
##  $ rothbart_energy             : chr [1:783] "almost_always" "more_than_half" "almost_always" "almost_always" ...
##  $ rothbart_vehicles           : chr [1:783] "very_rarely" "never" "never" "very_rarely" ...
##  $ rothbart_active             : chr [1:783] "almost_always" "never" "less_than_half" "almost_always" ...
##  $ rothbart_forbidden          : chr [1:783] "more_than_half" "almost_always" "very_rarely" "almost_always" ...
##  $ rothbart_sadlytearful       : chr [1:783] "less_than_half" "very_rarely" "almost_always" "very_rarely" ...
##  $ rothbart_downblue           : chr [1:783] "never" "never" "very_rarely" "never" ...
##  $ rothbart_runhouse           : chr [1:783] "less_than_half" "about_half" "always" NA ...
##  $ rothbart_excitingevent      : chr [1:783] "less_than_half" NA "almost_always" "almost_always" ...
##  $ rothbart_tempertantrum      : chr [1:783] "very_rarely" "more_than_half" "about_half" "very_rarely" ...
##  $ rothbart_waitpatiently      : chr [1:783] "about_half" "very_rarely" "very_rarely" "almost_always" ...
##  $ rothbart_rockedsmile        : chr [1:783] "almost_always" NA NA "almost_always" ...
##  $ rothbart_mold               : chr [1:783] "almost_always" "about_half" "more_than_half" "more_than_half" ...
##  $ rothbart_interactadult      : chr [1:783] "always" "always" "always" "always" ...
##  $ rothbart_careful            : chr [1:783] NA "almost_always" "almost_always" NA ...
##  $ rothbart_enternewplace      : chr [1:783] "never" "never" "almost_always" "very_rarely" ...
##  $ rothbart_crymorethan3       : chr [1:783] "never" "never" "less_than_half" "very_rarely" ...
##  $ rothbart_easilysoothed      : chr [1:783] "almost_always" "almost_always" "almost_always" "almost_always" ...
##  $ rothbart_busyother          : chr [1:783] "less_than_half" "about_half" "more_than_half" "almost_always" ...
##  $ rothbart_differentpeople    : chr [1:783] "always" "more_than_half" "almost_always" "always" ...
##  $ rothbart_comments           : chr [1:783] NA NA NA NA ...
xtabs(formula = ~ age_group + child_sex, ecbq_complete)
##          child_sex
## age_group female male
##      12mo    149  124
##      18mo    129  153
##      24mo    110  118

Visualize

ecbq_vars <- names(ecbq_complete)[stringr::str_detect(names(ecbq_complete),"rothbart_")]

# Omit comments
ecbq_vars <- ecbq_vars[!stringr::str_detect(ecbq_vars, "comments")]

We use purrr::map() to plot all of the responses to individual ECBQ items.

purrr::map(ecbq_vars, suppressMessages(ecbq_plot), df = ecbq_complete)
## [[1]]
## 
## [[2]]
## 
## [[3]]
## 
## [[4]]
## 
## [[5]]
## 
## [[6]]
## 
## [[7]]
## 
## [[8]]
## 
## [[9]]
## 
## [[10]]
## 
## [[11]]
## 
## [[12]]
## 
## [[13]]
## 
## [[14]]
## 
## [[15]]
## 
## [[16]]
## 
## [[17]]
## 
## [[18]]
## 
## [[19]]
## 
## [[20]]
## 
## [[21]]
## 
## [[22]]
## 
## [[23]]
## 
## [[24]]
## 
## [[25]]
## 
## [[26]]
## 
## [[27]]
## 
## [[28]]
## 
## [[29]]
## 
## [[30]]
## 
## [[31]]
## 
## [[32]]
## 
## [[33]]
## 
## [[34]]
## 
## [[35]]
## 
## [[36]]

Comments

Manual inspection shows that the comments field has some names. We omit printing the comments here until we can be assured that there is no identifiying information in the comments.

ecbq_complete |>
  dplyr::select(participant_id, age_group, rothbart_comments) |>
  dplyr::filter(!is.na(rothbart_comments)) |>
  dplyr::arrange(age_group) |>
  knitr::kable(format = 'html')