## EXAMPLE 1:
## The relative risk of a given disease in an area of your country is 5
## compared with a known reference 'low risk' area. A recent census shows that
## 10% of the population are resident in the high risk area and 90%
## are resident in the low risk area. .
## Calculate the adjusted relative risks for each area.
rsu.adjrisk(rr = c(5,1), ppr = c(0.10,0.90))
## The adjusted relative risks for the high and low risk areas are 3.6 and
## 0.7, respectively.
## EXAMPLE 2:
## Re-calculate the adjusted relative risks assuming there are 'high',
## 'medium' and 'low' risk areas. The relative risks for the high, medium
## and low risk areas are 5, 3 and 1, respectively. Population proportions for
## each area are 0.10, 0.10 and 0.80, respectively.
rsu.adjrisk(rr = c(5,3,1), ppr = c(0.10,0.10,0.80))
## The adjusted relative risks for the high, medium and low risk areas are
## 3.1, 1.9 and 0.6, respectively.
## EXAMPLE 3:
## Consider now the situation where we are not certain of our relative risk
## estimates for the high, medium and low risk areas described in Example 2
## so we ask a group of experts for their opinion. Minimum, mode and maximum
## relative risk estimates for the high and medium risk areas are defined
## using a PERT distribution. For the high risk area the mode of the
## relative risk is 5 with a minimum of 3 and a maximum of 20. For the medium
## risk area the mode of the relative risk is 3 with a minimum of 2 and a
## maximum of 20. As before, the population proportions for each area are
## 0.10, 0.10 and 0.80, respectively. Take 10 random draws from a PERT
## distribution (using the rpert function in package mc2d) and calculate
## the adjusted relative risks for each draw:
if (FALSE) {
## Set up an empty matrix to collect the simulated relative risk values:
nsims <- 10; nrcat <- 3
rr <- matrix(NA, nrow = nsims, ncol = nrcat)
## Use the mc2d package to take nsims random draws from the PERT distribution:
rr[,1] <- mc2d::rpert(n = nsims, min = 3, mode = 5, max = 20)
rr[,2] <- mc2d::rpert(n = nsims, min = 2, mode = 3, max = 5)
## The low risk area is the reference, so its relative risk values are 1:
rr[,3] <- 1
## Population proportions:
ppr <- c(0.10,0.10,0.80)
rval.df <- rsu.adjrisk(rr, ppr)
summary(rval.df)
## The median adjusted relative risks for the high, medium and low risk area
## are 3.6, 1.6 and 0.5 (respectively). The minimum adjusted relative risks
## are 2.5, 1.3 and 0.39, repectively. The maximum adjusted relative risks
## are 5.5, 2.3 and 0.72, respectively.
}
Run the code above in your browser using DataLab