Skip to contents

An S3 object that can be used to help organize the data and results of a GeoTox analysis.

Usage

GeoTox()

# S3 method for class 'GeoTox'
plot(x, type = c("resp", "hill", "exposure", "sensitivity"), ...)

Arguments

x

GeoTox object.

type

type of plot.

...

arguments passed to subsequent methods.

Value

a GeoTox S3 object

Examples

# Use a subset of the package data for demonstration purposes
set.seed(2357)
n <- 10 # Population size
m <- 5 # Number of regions
idx <- if (m < 100) sample(1:100, m) else 1:100

geoTox <- GeoTox() |> 
  # Set region and group boundaries (for plotting)
  set_boundaries(region = geo_tox_data$boundaries$county,
                 group  = geo_tox_data$boundaries$state) |> 
  # Simulate populations for each region
  simulate_population(age           = split(geo_tox_data$age, ~FIPS)[idx],
                      obesity       = geo_tox_data$obesity[idx, ],
                      exposure      = split(geo_tox_data$exposure, ~FIPS)[idx],
                      simulated_css = geo_tox_data$simulated_css,
                      n             = n) |> 
  # Estimated Hill parameters
  set_hill_params(geo_tox_data$dose_response |>
                    fit_hill(assay = "endp", chem = "casn") |> 
                    dplyr::filter(!tp.sd.imputed, !logAC50.sd.imputed)) |>
  # Calculate response
  calculate_response() |>
  # Perform sensitivity analysis
  sensitivity_analysis()

# Print GeoTox object
geoTox
#> GeoTox object
#> Assays: 13
#> Chemicals: 20
#> Regions: 5
#> Population: 10
#> Data Fields:
#>      Name            Class            Dim
#>       age    list(integer)       5 x (10)
#>        IR    list(numeric)       5 x (10)
#>   obesity  list(character)       5 x (10)
#>     C_ext     list(matrix)  5 x (10 x 21)
#>      C_ss     list(matrix)  5 x (10 x 21)
#> Computed Fields:
#>          Name             Class            Dim
#>         D_int      list(matrix)  5 x (10 x 21)
#>     C_invitro      list(matrix)  5 x (10 x 21)
#>          resp  list(data.frame)  5 x (130 x 6)
#>   sensitivity        list(list)        5 x (5)
#> Other Fields: par, boundaries, exposure, css_sensitivity, hill_params

# Plot hill fits
plot(geoTox, type = "hill")

# Plot exposure data
plot(geoTox, type = "exposure", ncol = 5)

# Plot response data
plot(geoTox)
#> Warning: Multiple assays found, using first assay 'APR_HepG2_p53Act_24h_up'

plot(geoTox, assays = "TOX21_H2AX_HTRF_CHO_Agonist_ratio")

# Plot sensitivity data
plot(geoTox, type = "sensitivity")
#> Warning: Multiple assays found, using first assay 'APR_HepG2_p53Act_24h_up'
#> Warning: Removed 240 NA values
#> Picking joint bandwidth of 0.204

plot(geoTox, type = "sensitivity", assay = "TOX21_H2AX_HTRF_CHO_Agonist_ratio")
#> Picking joint bandwidth of 0.489