tidyboral {boral} | R Documentation |

## Reformats output from a boral fit

### Description

Reformats estimates from a fitted boral model to be in a slightly tidier format, meaning everything is presented as a long data frame.

### Usage

```
tidyboral(object)
```

### Arguments

`object` |
An object of class "boral". |

### Details

Formatting the output into a long data frame maybe useful if one wishes to take the estimated parameters (namely the posterior mean/median/interquartile range/standard deviation, and the lower and upper limits of the HPD intervals), and subsequently wrangle them for presentation purposes using packages from the `tidyverse`

package e.g., Wickham and Henry (2018), construct plots from them using the `ggplot2`

package (Wickham, 2016), and so on.

It is important to note that this function is solely designed to format output from a fitted boral model relating to the estimated parameters. It does not an additional information like model call and MCMC samples. Please do NOT erase the original fitted model in place of this!

### Value

A a list containing the following components, where applicable:

`lv.coefs` |
A long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the latent variable coefficients. This also includes the response-specific intercepts, and dispersion parameters if appropriate. |

`lv` |
A long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the latent variables. |

`lv.covparams` |
A long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions for the parameters characterizing the correlation structure of the latent variables when they are assumed to be non-independent across rows. |

`X.coefs` |
A long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the response-specific coefficients relating to the covariate matrix. |

`traits.coefs` |
A long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the coefficients and standard deviation relating to the species traits; please see |

`cutoffs` |
A long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the common cutoffs for ordinal responses (please see the not-so-brief tangent on distributions above). |

`ordinal.sigma` |
A long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the standard deviation for the random intercept normal distribution corresponding to the ordinal response columns. |

`powerparam` |
A long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the common power parameter for tweedie responses (please see the not-so-brief tangent on distributions above). |

`row.coefs` |
A list with each element being a long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the row effects. The length of the list is equal to the number of row effects included i.e., |

`row.sigma` |
A list with each element being a long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the standard deviation for the row random effects normal distribution. The length of the list is equal to the number of row effects included i.e., |

`ranef.coefs` |
A list with each element being a long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the response-specific random intercepts. The length of the list is equal to the number of row effects included i.e., |

`ranef.sigma` |
A list with each element being a long format data frame containing the mean/median/standard deviation/interquartile range of the posterior distributions of the standard deviation for the response-specific random intercept normal distributions. The length of the list is equal to the number of row effects included i.e., |

`ssvs.indcoefs` |
A long format data frame containing posterior probabilities and associated standard deviation for individual SSVS of coefficients in the covariate matrix. |

`ssvs.gpcoefs` |
A long format data frame containing posterior probabilities and associated standard deviation for group SSVS of coefficients in the covariate matrix. |

`ssvs.traitscoefs` |
A long format data frame containing posterior probabilities and associated standard deviation for individual SSVS of coefficients relating to species traits. |

`hpdintervals` |
A list containing long format data frames corresponding to the lower and upper bounds of highest posterior density (HPD) intervals for all the parameters indicated above. Please see |

### Warnings

This function is solely designed to format output from a fitted boral model relating to the estimated parameters. It does not an additional information like model call and MCMC samples. Please do NOT erase the original fitted model in place of this!

### Author(s)

Francis K.C. Hui [aut, cre], Wade Blanchard [aut]

Maintainer: Francis K.C. Hui <fhui28@gmail.com>

### References

Wickham, H. (2016). ggplot2: elegant graphics for data analysis. Springer.

Wickham, H., & Henry, L. (2017). Tidyr: Easily tidy data with ‘spread ()’ and ‘gather ()’ functions.

### See Also

`boral`

for the fitting function on which `tidyboral`

can be applied.

### Examples

```
## Not run:
## NOTE: The values below MUST NOT be used in a real application;
## they are only used here to make the examples run quick!!!
example_mcmc_control <- list(n.burnin = 10, n.iteration = 100,
n.thin = 1)
testpath <- file.path(tempdir(), "jagsboralmodel.txt")
library(mvabund) ## Load a dataset from the mvabund package
data(spider)
y <- spider$abun
X <- spider$x
spiderfit_nb <- boral(y, family = "negative.binomial",
lv.control = list(num.lv = 2), row.eff = "fixed",
mcmc.control = example_mcmc_control, model.name = testpath)
spiderfit_nb_tidy <- tidyboral(spiderfit_nb)
spiderfit_nb <- boral(y, X = X, family = "negative.binomial",
ranef.ids = data.frame(region = rep(1:7,each=4)),
mcmc.control = example_mcmc_control, model.name = testpath)
spiderfit_nb_tidy <- tidyboral(spiderfit_nb)
## End(Not run)
```

*boral*version 2.0.2 Index]