Skip to contents

Fitting a model

One engine; the formula terms choose the model.

model()
Fit a mixed model by AI-REML
model_mt()
Fits a multi-trait mixed model by AI-REML
model_ar1()
Fits a model with AR(1)/CAR(1) residual by AI-REML
gibbs()
Gibbs sampler for a single-trait mixed model
model_threshold()
Fit a threshold model for an ordered categorical trait
model_survival()
Fit a Weibull proportional hazards frailty model
survival_split()
Elementary survival records from subjects and covariate changes
suggest_model()
Suggest model terms from the shape of the data

Breeding values and genetic parameters

solutions()
Breeding values, their standard error and accuracy, in one table
ebv()
Genetic values of a group
accuracy()
Accuracy of the genetic values
coef(<breeding_fit>)
Coefficients of a fit: variance components or fixed-effect solutions
h2()
Heritability from the estimated components
t2()
Total heritable variance and T2 of a model with indirect genetic effects
rg()
Genetic correlation between two traits, from the multi-trait fit
h2_curve()
Heritability along the gradient, for a reaction-norm fit
h2_observed()
Heritability on the observed scale from the liability scale
h2_liability()
Heritability on the liability scale from the observed scale
se_function()
Standard error of a function of the variance components (delta method)
profile_theta()
Profile likelihood for one variance component
predict(<breeding_fit_thr>)
Per-category probabilities from a threshold fit
predict(<breeding_fit_surv>)
Relative risks and survival probabilities from a survival fit

Diagnostics

Residuals of a fit and convergence of a chain.

residuals(<breeding_fit>) fitted(<breeding_fit>) residuals(<breeding_fit_ar1>) fitted(<breeding_fit_ar1>) residuals(<breeding_fit_mt>) fitted(<breeding_fit_mt>) residuals(<breeding_gibbs>) fitted(<breeding_gibbs>) residuals(<breeding_fit_thr>) residuals(<breeding_fit_surv>)
Residuals and fitted values of a mixed-model fit
residual_diagnostics()
Residual diagnostics of a mixed-model fit
mcmc_diagnostics()
MCMC convergence diagnostics
as_draws_array(<breeding_gibbs>) as_draws(<breeding_gibbs>) as.mcmc.list(<breeding_gibbs>)
Convert the chains of a gibbs() fit to posterior or coda draws
ess()
Effective sample size by the initial monotone sequence estimator
rhat()
Rank-normalized split R-hat
geweke_z()
Geweke convergence z-score

Pedigree and relationship matrices

pedigree()
Sort a pedigree and compute inbreeding
sire_mgs()
Declare a pedigree of sires and maternal grandsires
a_inverse()
Inverse of the relationship matrix, by Henderson
a22_inverse()
Inverse of A22 by the sparse Schur complement
dominance_matrix()
Dominance relationship matrix from a pedigree
dominance_inverse()
Sparse inverse of the dominance relationship matrix, by sire x dam subclasses
partial_a()
Partial relationship matrices for a multibreed pedigree
estimate_gamma()
Estimate the relationships among metafounders from genotypes

Genomics

Relationship matrices from markers and the single step.

g_matrix()
Genomic relationship matrix (VanRaden)
g_dominance()
Genomic dominance relationship matrix (Vitezica)
g_epistasis()
Additive-by-additive epistatic relationship matrix
g_epistasis_ad() g_epistasis_dd() g_epistasis_order()
Mixed and higher-order epistatic relationship matrices
genomic_inbreeding()
Genomic inbreeding from marker homozygosity
h_inverse()
Inverse of the single-step relationship matrix H
apy_inverse()
Inverse of G by the APY algorithm
apy_core_select()
Choose the APY core by the eigenvalues of G
vecchia_inverse()
Inverse of G by the Vecchia recursion
snp_blup()
Single-step SNP-BLUP: markers as equations, no G, conjugate gradients
snp_effects()
Backsolve SNP effects from a single-step fit
pegs()
Fast multi-trait genomic prediction by randomized Gauss-Seidel (PEGS)

Indirect genetic effects and contests

indirect_residual()
Estimate the pen-size heterogeneous residual of the associative model
associative_matrix()
Residual covariance structure of the associative model
competition_strength()
Competitive ability from grouped contests (Bradley-Terry / Plackett-Luce)

Data, quality control and selection signatures

read_plink()
Read PLINK genotypes into the genotypes= shape
read_blupf90_snp()
Read a BLUPF90 genotype file into the genotypes= shape
qc_phenotypes()
Phenotype quality control
qc_genotypes()
Genotype quality control
parentage_check()
Parent-offspring conflicts between the genotypes and the pedigree
describe()
Descriptive statistics before the fit
fst()
Per-marker Fst between groups (Weir & Cockerham)
roh()
Runs of homozygosity: F_ROH per animal and per-marker frequency

Environment and reaction norms

legendre()
Normalized Legendre polynomials, evaluated on a gradient
thi()
Temperature-humidity index (NRC 1971)
heat_load()
Heat load above a threshold

Selection decisions

selection_index()
Economic selection index over EBVs
rank_drift()
Ranking drift between two evaluations

Simulation and benchmarking

simulate_breeding()
Simulate a small breeding population
mc_study()
Monte Carlo study of heritability recovery
benchmark_fit()
Benchmark a fit with replication built in

Sparse linear algebra and the engine

sparse_chol()
Sparse Cholesky of a symmetric positive-definite matrix
sparse_solve()
Solve A x = b with A sparse symmetric positive-definite
selected_inverse()
Takahashi selective inverse
inv_pd()
Inverse of a symmetric positive-definite matrix, by block Cholesky
br_threads()
Number of threads for the parallel parts of the engine
br_version()
Package version

Internal evaluations for the validation gates

Exported so that the tests can compare the two routes of the likelihood.

eval_internal()
Evaluate -2logL, score and AI at a given theta, by both routes
eval_internal_mt()
Internal multi-trait evaluation, for the gates
eval_internal_ar1()
Internal AR(1) evaluation, for the gates