Skip to contents

Fitting models

lmm_animal()
Fit linear mixed animal model
lm_phen_cov()
Fit a Bayesian phenotypic covariance matrix
lmm_animal_laplace() lm_phen_cov_laplace()
Laplace approximations of the covariance fits
lmm_animal_gibbs()
Fit an animal model with a Gibbs sampler

Building the inputs

animal_design()
Response and design matrices from a model formula
makeA()
Additive relationship matrix from a pedigree
genomic_relationship()
Genomic relationship matrix from genotype data
size_shape()
Size and shape scores for many correlated traits
back_transform()
Back-transform posterior draws to the original trait scale
pc1_variance_share()
Share of variance explained by the first principal component

Choosing the number of factors

suggest_n_factors()
Number of factors suggested by parallel analysis
scree_eigenvalues()
Eigenvalues of the residual trait correlation matrix
plot(<scree>)
Scree plot

Reading the posterior

fit_draws()
Posterior draws of a fit, shaped by trait
draws_mean() draws_quantile()
Posterior means or quantiles of a fit, as matrices
rename_beta()
Posterior draws with the fixed effects named
to_draws_list()
Convert the back-transformed draws to posterior draws
animal_parameter_draws()
Heritability and genetic correlation draws from a fit

Post-processing a fit

breeding_values() print(<stanimal_breeding_values>)
Estimated breeding values (BLUPs)
imputed_data() print(<stanimal_imputation>)
Completed datasets from a fit with missing values
fit_loo() loo(<CmdStanMCMC>) loo(<stanfit>)
Leave-one-out cross-validation for a fit
posterior_predictive() print(<stanimal_yrep>) plot(<stanimal_yrep>)
Replicate the response from the posterior

Plots

plot_prior_posterior() plot_forest()
Posterior versus prior for heritabilities and genetic correlations
plot_G_ellipses()
Pairs plot of the data with posterior draws of G ellipses
plot_corr()
Heatmap of a correlation matrix

Priors and simulation

animal_prior_draws()
Prior draws for heritabilities and genetic correlations
random_covariance()
Random covariance matrices

Data

ratones_morpho
Morphological and life-history data for five mouse lines
ratones_pedigree
Pedigree of the mouse lines
opossum
Opossum cranial measurements and a genomic relationship matrix

Package

stanimal-package stanimal
The 'stanimal' package.
stan_cache_dir() stanimal_clear_cache()
Location of the compiled Stan model cache