Skip to content

Commit

Permalink
vignette: update vignette headings
Browse files Browse the repository at this point in the history
  • Loading branch information
japhir committed Jan 30, 2024
1 parent 3a12d6f commit dfe9559
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions vignettes/bootstrapped_clumped_calibration.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ library(clumpedcalib)
set.seed(123)
```

## load calibration data and calculate bootstrapped York regression
# Bootstrapped York regression

## load calibration data

Here I show this with a very small artificial set of calibration data.
Be sure to replace with your own!

The column names must be identical to `X`, `D47`, `sd_X`, and `sd_D47`.

```{r calibration}
```{r calibration-data}
raw <- tibble::tribble(
~ X, ~ D47, ~ sd_X, ~ sd_D47,
11.25,0.607,0.062,0.007,
Expand All @@ -52,7 +54,11 @@ raw <- tibble::tribble(
# or if you have your data saved as an CSV
## raw <- readr::read_csv("dat/example_calib.csv",
## col_names = c("X", "D47", "sd_X", "sd_D47"))
```

## calculate bootstrapped York regression

```{r calibration-bootstrap}
# this is very much a toy example with only 100 bootstraps!
calib <- clumped_calib_boot(raw, Nsim = 100) #|>
# for the real deal, increase Nsim to something like 1e5 and save the results
Expand All @@ -63,7 +69,6 @@ calib <- clumped_calib_boot(raw, Nsim = 100) #|>
## calib <- readr::read_csv("calib_clumped_boot.csv")
```


```{r, calibrationplot}
raw |>
ggplot(aes(x = X, y = D47)) +
Expand All @@ -82,6 +87,8 @@ raw |>
alpha = .2, data = calib)
```

# Apply it to your data

## load sample data

I've come up with some fake replicate-level data.
Expand All @@ -107,9 +114,7 @@ pl_raw <- dat |>
pl_raw
```

## calculate bootstrapped means and apply the temperature calibration

### just give me the results!
## just give me the results!

This is a simple wrapper function to quickly get the end result. If you want more control, see below.

Expand Down Expand Up @@ -140,7 +145,7 @@ sum |>
geom_text(aes(label = paste("N =", n)), nudge_x = 1.5)
```

### individual functions
## more control

If you want to have more control, I recommend not using the above wrapper
function, but in stead take it one step at a time:
Expand Down Expand Up @@ -173,6 +178,4 @@ sim <- dat |>
our_summary(group = bins)
```

# acknowledgements

We would like to thank Alvaro Fernandez for writing and sharing the Matlab code that inspired this R package.

0 comments on commit dfe9559

Please sign in to comment.