Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

852 update to pkgdown in the ci workflow generates new warnings and errors #853

Merged
18 changes: 11 additions & 7 deletions vignettes/rolling-crm.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,32 @@ samples <- mcmc(data, model, options)

### Use ggmcmc to diagnose

```{r Diagnose}
```{r Diagnose-1, fig.alt = "A trace plot for alpha0. It looks like skyscrapers ina big city, but there are only just over 200 samples in the chain."}
library(ggmcmc)
alpha0samples <- get(samples, "alpha0")

print(ggs_traceplot(alpha0samples))
```

```{r Diagnose-2, fig.alt = "An auto correlation plot for aplha0. There is significant auto-correlation of 0.25 or more even at lags of 50. There is seasonality too, with three groups of negative auto-correlation and four of positive."}

print(ggs_autocorrelation(alpha0samples))
```

### Plot the model fit

```{r Fit}
```{r Fit-1, fig.width = 7, fig.alt = "Two plots in a single row. The first shows the posterior mean and ci for the probability of toxicity by dose. The second shows 100 times the posterior hazard by time."}
plot(samples, model, data, hazard = TRUE)
```

```{r Fit-2, fig.width = 7, fig.alt = "Two plots in a single row. Both show the posterior mean and ci for the probability of toxicity by dose on the y axis. In the first plot, the x axis is dose. In the second, it is time."}
plot(samples, model, data, hazard = FALSE)
```


### prior mean curve

```{r Prior}
```{r Prior, fig.width = 7, fig.alt = "Two plots in a single row. Both show the prior mean and ci for the probability of toxicity by dose on the y axis. In the first plot, the x axis is dose. In the second, it is time."}
emptydata <- DataDA(doseGrid = c(
0.1, 0.5, 1.5, 3, 6,
seq(from = 10, to = 80, by = 2)
Expand Down Expand Up @@ -142,15 +147,14 @@ myStopping <- (myStopping1 | myStopping2)

### Recommended dose for the next cohort

```{r Recommend}
```{r Recommend, fig.width = 7, fig.alt = "Two graphs arranged in a single column. The upper graph shoes green lines of various heights that show the probability each dose is in the target toxicity range. There is a big arrow pointing to the bar at a dose of 0.5, that this is the recommended dose for the next cohort. The bars for other doses are higher, but they are not eligible for dosing because of the overdose rule illustrated in the second graph below. The lower graph as a similar series of red lines, indicating the probability that each dose is in the overdose range. There is a horizontal black dashed line at 25%, indicating that this is the highest acceptable probability of being in the overdose range. The red bars for doses above 0.5 all extend above 25%, indicating that their toxicity is unacceptable. The toxicity for doses of 0.1 and 0.5 lie below 25%."}
doseRecommendation <- nextBest(myNextBest,
doselimit = nextMaxDose,
samples = samples,
model = model,
data = data
)


doseRecommendation$plot
doseRecommendation$value
```
Expand All @@ -177,7 +181,7 @@ design <- DADesign(

### Set up true curves

```{r Truth}
```{r Truth, fig.alt = "A logistic dose response curverising from 0 at dose 0 to almost 100% for a dose of 100."}
myTruth <- probFunction(model, alpha0 = 2, alpha1 = 3)
curve(myTruth(x), from = 0, to = 100, ylim = c(0, 1))

Expand Down Expand Up @@ -210,7 +214,7 @@ mySims <- simulate(design,

Use a similar way as section 9.2 in the "using the package crmPack: introductory examples" document

```{r Interpret}
```{r Interpret, fig.width = 7, fig.height = 7, fig.alt = "Two graphs in a single column, summarising the results of a single simulated trial. The upper one plots patient number on the x axis and dose andministered on the y axis. Different symbols indicate whether or not each participant reported a toxicity. Sixteen patients were enrolled, four of which reported toxicities. The points rise and fall like waves in response to changes in the model's recommended dose. The lower one plots time on the x axis and patient number on the y axis. For each patient, a horizontyal line runs from their enrolment time to the time at which they reported a toxicity, completed their safety evaluatiuon window or (at the end of the trial) were censored. Different coloured and shaped symbols at the right hand end of each line indicate whether or not the participant reported a toxicity."}
a <- summary(mySims, truth = myTruth)
b <- mySims@data[[1]]

Expand Down
20 changes: 12 additions & 8 deletions vignettes/trial_analysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ firstFour <- Data(
Within a `Data` object, the doses at which each patient is treated are given by the `x` slot and their toxicity status (a Boolean where a toxicity is represented by a truthy value) by the `y` slot.

The observed data is easily visualised
```{r}
```{r, fig.alt = "A visual representation of the data from the first four participants. The first three, treated at doses 1, 3 and 9, do not report any toxicities. The fourth, treated at 20, does."}
plot(firstFour)
```

and, since the `plot` method returns a `ggplot` object, it is easily customised.

```{r}
```{r, fig.alt = "The same graph as above, but with a white background to the plot area rather than a grey one."}
plot(firstFour) + theme_light()
```

Expand All @@ -185,12 +185,12 @@ postSamples <- mcmc(

The posterior estimate of the dose toxicity curve is easily visualised:

```{r}
```{r, fig.alt = "A plot of the posterior after the first four participants. The mean probability of toxicity increases smoothly, with a slight convex curve, from about zero percent at a dose of zero to about 65% at a dose of 100. The confidence interval extends from 0% to about 25% at a dose of zero and from about 30% to about 90% at a dose of 100."}
plot(postSamples, model, firstFour)
```

A visual representation of the model's state is obtained with:
```{r}
```{r, fig.alt = "Two graphs arranged in a single column. The upper graph shoes green lines of various heights that show the probability each dose is in the target toxicity range. There is a big arrow pointing to the bar at a dose of 20, indicating tat this dose has the highest probability of being in the target toxicity range. The lower graph as a similar series of red lines, indicating the probability that each dose is in the overdose range. There is a horizontal black dashed line at 25%, indicating that this is the highest acceptable probability of being in the overdose range. The red bars for doses of 30 and above all extend above 25%, indicating that their toxicity is unacceptable. The toxicity for doses of 20 and below lie below 25%."}
nextBest(
my_next_best,
doselimit = 100,
Expand Down Expand Up @@ -557,16 +557,20 @@ x

crmPack provides a wealth of information about the trial's results. The following code snippets illustrate some of the many possibilities for how the trial might be summarised.

```{r}
```{r, fig.alt = "A visual representation of the data after nineteen participants have been treated. One each at doses 1, 3 and 9; four at a dose of 20; 6 at a dose of 30 and 6 at a dose of 45. Toxicitiues were reported by participants 4 (at a dose of 20) and 18 and 19 (both at a dose of 45)."}
plot(fifthFullCohort)
```

```{rfig.alt = "A plot of the posterior after nineteen participants have been treated. The mean probability of toxicity increases smoothly from about zero percent at a dose of zero to about 55% at a dose of 100. The confidence interval extends from 0% to about 6% at a dose of zero and from about 22% to about 90% at a dose of 100."}
plot(postSamples5, model, fifthFullCohort)
```
```{r}

```{rfig.alt = "Two graphs arranged in a single column. The upper graph shoes green lines of various heights that show the probability each dose is in the target toxicity range. There is a big arrow pointing to the bar at a dose of 45, indicating that this dose has the highest probability of being in the target toxicity range. The lower graph as a similar series of red lines, indicating the probability that each dose is in the overdose range. There is a horizontal black dashed line at 25%, indicating that this is the highest acceptable probability of being in the overdose range. The red bars for doses of 60 and above all extend above 25%, indicating that their toxicity is unacceptable. The toxicity for doses of 45 and below lie below 25%."}
doseRecommendation$plot
```

With a little bit of work, we can obtain a more detailed summary and plot of the posterior probabilities of toxicity at each dose:
```{r, error=TRUE}
```{r, fig.alt = "A graph showing the posterior density of of the probability of toxicity for all doses greater than nine. The mode of each density moves to the right as dose increases. The densities for low doses are heaviliy skewed to the left. Densities for higher doses are more symmetric and flatter."}
slotNames(model)

fullSamples <- tibble(
Expand Down Expand Up @@ -620,7 +624,7 @@ fullSamples %>%
)
```

```{r, error=TRUE}
```{r, fig.alt = "A visual representation of the posterior dose - toxicity curve. Very closely spaced sloid lines in black and blue, represewnting the mean and median estimate of toxicity for each dose rise almost linearly from zero percent for a dose of zero to about 55% for a dose of 100. Shading extends to each side of the two solid lines. The transparency of the shading increases with distance from the solid lines. The shading is funnel shaped, with a narrow mneck at a dose of 100 and a wider mouth at a dose of 100. The shading represents the central 90%, 80% and 50% confidence intervals for the posterior mean estimate of toxicity at each dose."}
Puzzled-Face marked this conversation as resolved.
Show resolved Hide resolved
fullSummary %>%
ggplot(aes(x = Dose)) +
geom_ribbon(aes(ymin = Q05, ymax = Q95), fill = "steelblue", alpha = 0.25) +
Expand Down
2 changes: 1 addition & 1 deletion vignettes/trial_definition.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ $$

It is easy to obtain a visual representation of the prior:

```{r, fig.width=5}
```{r, fig.width=5, fig.alt = "A visual representation of the prior. The prior mean estimate of toxicity rises form almost zero for a dose of 0 to just under 0.75 for a dose of 100. The confidence intervals are wide."}
vignetteMcmcOptions <- McmcOptions(burnin = 100, step = 2, samples = 1000)
prior_samples <- mcmc(
data = empty_data,
Expand Down