Skip to contents

Incidence

As the middle step, we created a dataframe which have information like animal SEX and Dose. Also all the MI(Microscopic Findings) domain data. Let’s start with some animals which were filter out by SEX, Dose and MISPEC from the dataframe.

we get a group of 20 animals

##        SEX   Dose         MISPEC       MISTRESC MISEV
##     <char> <char>         <char>         <char> <ord>
##  1:      F     HD GLAND, ADRENAL     HEMORRHAGE     3
##  2:      F     HD GLAND, ADRENAL     HEMORRHAGE     3
##  3:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  4:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  5:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  6:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  7:      F     HD GLAND, ADRENAL     HEMORRHAGE     2
##  8:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  9:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 10:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 11:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 12:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 13:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 14:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 15:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 16:      F     HD GLAND, ADRENAL    HYPERTROPHY     2
## 17:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 18:      F     HD GLAND, ADRENAL MINERALIZATION     3
## 19:      F     HD GLAND, ADRENAL       NECROSIS     3
## 20:      F     HD GLAND, ADRENAL   UNREMARKABLE     0
##        SEX   Dose         MISPEC       MISTRESC MISEV

Remove MISEV (Severity) for now

Original Data

##        SEX   Dose         MISPEC       MISTRESC
##     <char> <char>         <char>         <char>
##  1:      F     HD GLAND, ADRENAL     HEMORRHAGE
##  2:      F     HD GLAND, ADRENAL     HEMORRHAGE
##  3:      F     HD GLAND, ADRENAL     HEMORRHAGE
##  4:      F     HD GLAND, ADRENAL     HEMORRHAGE
##  5:      F     HD GLAND, ADRENAL     HEMORRHAGE
##  6:      F     HD GLAND, ADRENAL     HEMORRHAGE
##  7:      F     HD GLAND, ADRENAL     HEMORRHAGE
##  8:      F     HD GLAND, ADRENAL     HEMORRHAGE
##  9:      F     HD GLAND, ADRENAL    HYPERTROPHY
## 10:      F     HD GLAND, ADRENAL    HYPERTROPHY
## 11:      F     HD GLAND, ADRENAL    HYPERTROPHY
## 12:      F     HD GLAND, ADRENAL    HYPERTROPHY
## 13:      F     HD GLAND, ADRENAL    HYPERTROPHY
## 14:      F     HD GLAND, ADRENAL    HYPERTROPHY
## 15:      F     HD GLAND, ADRENAL    HYPERTROPHY
## 16:      F     HD GLAND, ADRENAL    HYPERTROPHY
## 17:      F     HD GLAND, ADRENAL    HYPERTROPHY
## 18:      F     HD GLAND, ADRENAL MINERALIZATION
## 19:      F     HD GLAND, ADRENAL       NECROSIS
## 20:      F     HD GLAND, ADRENAL   UNREMARKABLE
##        SEX   Dose         MISPEC       MISTRESC

Count the animals in each group

##          MISTRESC     N
##            <char> <int>
## 1:     HEMORRHAGE     8
## 2:    HYPERTROPHY     9
## 3: MINERALIZATION     1
## 4:       NECROSIS     1
## 5:   UNREMARKABLE     1

Find incidence rate/percent

dt_p
##       SEX   Dose         MISPEC       MISTRESC     n percent
##    <char> <char>         <char>         <char> <int>   <num>
## 1:      F     HD GLAND, ADRENAL     HEMORRHAGE     8    0.40
## 2:      F     HD GLAND, ADRENAL    HYPERTROPHY     9    0.45
## 3:      F     HD GLAND, ADRENAL MINERALIZATION     1    0.05
## 4:      F     HD GLAND, ADRENAL       NECROSIS     1    0.05
## 5:      F     HD GLAND, ADRENAL   UNREMARKABLE     1    0.05

Sampling

Findings

dt_p$MISTRESC
## [1] "HEMORRHAGE"     "HYPERTROPHY"    "MINERALIZATION" "NECROSIS"      
## [5] "UNREMARKABLE"

Incidance rate

dt_p$percent
## [1] 0.40 0.45 0.05 0.05 0.05

Sampling using R function

syn_percent <- sample(x=dt_p$MISTRESC,
                      size = 20, replace = TRUE,
                      prob = dt_p$percent)
##  [1] "HYPERTROPHY"    "HEMORRHAGE"     "HEMORRHAGE"     "HYPERTROPHY"   
##  [5] "HYPERTROPHY"    "HEMORRHAGE"     "HEMORRHAGE"     "HYPERTROPHY"   
##  [9] "HEMORRHAGE"     "HEMORRHAGE"     "MINERALIZATION" "HYPERTROPHY"   
## [13] "HYPERTROPHY"    "HYPERTROPHY"    "HYPERTROPHY"    "HYPERTROPHY"   
## [17] "HYPERTROPHY"    "HYPERTROPHY"    "HYPERTROPHY"    "NECROSIS"

Incidence Count/Table

## syn_percent
##     HEMORRHAGE    HYPERTROPHY MINERALIZATION       NECROSIS 
##              6             12              1              1
##        SEX   Dose         MISPEC       MISTRESC   MISTRESC_syn
##     <char> <char>         <char>         <char>         <char>
##  1:      F     HD GLAND, ADRENAL     HEMORRHAGE     HEMORRHAGE
##  2:      F     HD GLAND, ADRENAL     HEMORRHAGE     HEMORRHAGE
##  3:      F     HD GLAND, ADRENAL     HEMORRHAGE     HEMORRHAGE
##  4:      F     HD GLAND, ADRENAL     HEMORRHAGE     HEMORRHAGE
##  5:      F     HD GLAND, ADRENAL     HEMORRHAGE     HEMORRHAGE
##  6:      F     HD GLAND, ADRENAL     HEMORRHAGE     HEMORRHAGE
##  7:      F     HD GLAND, ADRENAL     HEMORRHAGE    HYPERTROPHY
##  8:      F     HD GLAND, ADRENAL     HEMORRHAGE    HYPERTROPHY
##  9:      F     HD GLAND, ADRENAL    HYPERTROPHY    HYPERTROPHY
## 10:      F     HD GLAND, ADRENAL    HYPERTROPHY    HYPERTROPHY
## 11:      F     HD GLAND, ADRENAL    HYPERTROPHY    HYPERTROPHY
## 12:      F     HD GLAND, ADRENAL    HYPERTROPHY    HYPERTROPHY
## 13:      F     HD GLAND, ADRENAL    HYPERTROPHY    HYPERTROPHY
## 14:      F     HD GLAND, ADRENAL    HYPERTROPHY    HYPERTROPHY
## 15:      F     HD GLAND, ADRENAL    HYPERTROPHY    HYPERTROPHY
## 16:      F     HD GLAND, ADRENAL    HYPERTROPHY    HYPERTROPHY
## 17:      F     HD GLAND, ADRENAL    HYPERTROPHY    HYPERTROPHY
## 18:      F     HD GLAND, ADRENAL MINERALIZATION    HYPERTROPHY
## 19:      F     HD GLAND, ADRENAL       NECROSIS MINERALIZATION
## 20:      F     HD GLAND, ADRENAL   UNREMARKABLE       NECROSIS
##        SEX   Dose         MISPEC       MISTRESC   MISTRESC_syn

Original Count

##          MISTRESC     N
##            <char> <int>
## 1:     HEMORRHAGE     8
## 2:    HYPERTROPHY     9
## 3: MINERALIZATION     1
## 4:       NECROSIS     1
## 5:   UNREMARKABLE     1

Synthetic Count

##      MISTRESC_syn     N
##            <char> <int>
## 1:     HEMORRHAGE     6
## 2:    HYPERTROPHY    12
## 3: MINERALIZATION     1
## 4:       NECROSIS     1

Original Data

##       SEX   Dose         MISPEC       MISTRESC     n percent
##    <char> <char>         <char>         <char> <int>   <num>
## 1:      F     HD GLAND, ADRENAL     HEMORRHAGE     8    0.40
## 2:      F     HD GLAND, ADRENAL    HYPERTROPHY     9    0.45
## 3:      F     HD GLAND, ADRENAL MINERALIZATION     1    0.05
## 4:      F     HD GLAND, ADRENAL       NECROSIS     1    0.05
## 5:      F     HD GLAND, ADRENAL   UNREMARKABLE     1    0.05

Synthetic Data

##       SEX   Dose         MISPEC   MISTRESC_syn     n percent
##    <char> <char>         <char>         <char> <int>   <num>
## 1:      F     HD GLAND, ADRENAL     HEMORRHAGE     6    0.30
## 2:      F     HD GLAND, ADRENAL    HYPERTROPHY    12    0.60
## 3:      F     HD GLAND, ADRENAL MINERALIZATION     1    0.05
## 4:      F     HD GLAND, ADRENAL       NECROSIS     1    0.05

Severity

##        SEX   Dose         MISPEC       MISTRESC MISEV
##     <char> <char>         <char>         <char> <ord>
##  1:      F     HD GLAND, ADRENAL     HEMORRHAGE     3
##  2:      F     HD GLAND, ADRENAL     HEMORRHAGE     3
##  3:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  4:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  5:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  6:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  7:      F     HD GLAND, ADRENAL     HEMORRHAGE     2
##  8:      F     HD GLAND, ADRENAL     HEMORRHAGE     4
##  9:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 10:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 11:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 12:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 13:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 14:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 15:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 16:      F     HD GLAND, ADRENAL    HYPERTROPHY     2
## 17:      F     HD GLAND, ADRENAL    HYPERTROPHY     3
## 18:      F     HD GLAND, ADRENAL MINERALIZATION     3
## 19:      F     HD GLAND, ADRENAL       NECROSIS     3
## 20:      F     HD GLAND, ADRENAL   UNREMARKABLE     0
##        SEX   Dose         MISPEC       MISTRESC MISEV

Percent

##       SEX   Dose         MISPEC MISEV     n percent
##    <char> <char>         <char> <num> <int>   <num>
## 1:      F     HD GLAND, ADRENAL     4    12    0.60
## 2:      F     HD GLAND, ADRENAL     5     5    0.25
## 3:      F     HD GLAND, ADRENAL     3     2    0.10
## 4:      F     HD GLAND, ADRENAL     1     1    0.05

for each of MISPEC (if not UNREMARKABLE) find severity

ll <- sample(dt_sev$MISEV, size = 1, replace = TRUE, prob = dt_sev$percent)

synthetic

##  [1] 5 5 4 1 5 4 4 5 5 4 4 4 5 4 4 5 3 4 4 5

Final Severity

##        SEX   Dose         MISPEC       MISTRESC MISEV   MISTRESC_syn MISEV_syn
##     <char> <char>         <char>         <char> <ord>         <char>     <num>
##  1:      F     HD GLAND, ADRENAL     HEMORRHAGE     3     HEMORRHAGE         5
##  2:      F     HD GLAND, ADRENAL     HEMORRHAGE     3     HEMORRHAGE         5
##  3:      F     HD GLAND, ADRENAL     HEMORRHAGE     4     HEMORRHAGE         4
##  4:      F     HD GLAND, ADRENAL     HEMORRHAGE     4     HEMORRHAGE         1
##  5:      F     HD GLAND, ADRENAL     HEMORRHAGE     4     HEMORRHAGE         5
##  6:      F     HD GLAND, ADRENAL     HEMORRHAGE     4     HEMORRHAGE         4
##  7:      F     HD GLAND, ADRENAL     HEMORRHAGE     2    HYPERTROPHY         4
##  8:      F     HD GLAND, ADRENAL     HEMORRHAGE     4    HYPERTROPHY         5
##  9:      F     HD GLAND, ADRENAL    HYPERTROPHY     3    HYPERTROPHY         5
## 10:      F     HD GLAND, ADRENAL    HYPERTROPHY     3    HYPERTROPHY         4
## 11:      F     HD GLAND, ADRENAL    HYPERTROPHY     3    HYPERTROPHY         4
## 12:      F     HD GLAND, ADRENAL    HYPERTROPHY     3    HYPERTROPHY         4
## 13:      F     HD GLAND, ADRENAL    HYPERTROPHY     3    HYPERTROPHY         5
## 14:      F     HD GLAND, ADRENAL    HYPERTROPHY     3    HYPERTROPHY         4
## 15:      F     HD GLAND, ADRENAL    HYPERTROPHY     3    HYPERTROPHY         4
## 16:      F     HD GLAND, ADRENAL    HYPERTROPHY     2    HYPERTROPHY         5
## 17:      F     HD GLAND, ADRENAL    HYPERTROPHY     3    HYPERTROPHY         3
## 18:      F     HD GLAND, ADRENAL MINERALIZATION     3    HYPERTROPHY         4
## 19:      F     HD GLAND, ADRENAL       NECROSIS     3 MINERALIZATION         4
## 20:      F     HD GLAND, ADRENAL   UNREMARKABLE     0       NECROSIS         5
##        SEX   Dose         MISPEC       MISTRESC MISEV   MISTRESC_syn MISEV_syn

NOTE: severity for UNREMARKBLE set 0 for MISEV_syn.

There are more steps involved which create the final synthetic data but this is a simplified version(main idea) the way synthetic data created