r2_Wf: Expected r2 between inbreeding level (f) and fitness (W)

Description Usage Arguments Value Author(s) References Examples

View source: R/r2_Wf.R

Description

Expected r2 between inbreeding level (f) and fitness (W)

Usage

1
2
r2_Wf(genotypes, trait, family = "gaussian", type = c("msats", "snps"),
  nboot = NULL, parallel = FALSE, ncores = NULL, CI = 0.95)

Arguments

genotypes

A data.frame with individuals in rows and loci in columns, containing genotypes coded as 0 (homozygote), 1 (heterozygote) and NA (missing).

trait

vector of any type which can be specified in R's glm() function. Sequence of individuals has to match sequence of individuals in the rows of the genotypes data.frame.

family

distribution of the trait. Default is gaussian. For other distributions, just naming the distribution (e.g. binomial) will use the default link function (see ?family). Specifying another link function can be done in the same way as in the glm() function. A binomial distribution with probit instead of logit link would be specified with family = binomial(link = "probit")

type

specifies g2 formula to take. Type "snps" for large datasets and "msats" for smaller datasets.

nboot

number of bootstraps over individuals to estimate a confidence interval around r2(W, f).

parallel

Default is FALSE. If TRUE, bootstrapping and permutation tests are parallelized.

ncores

Specify number of cores to use for parallelization. By default, all available cores but one are used.

CI

confidence interval (default to 0.95)

Value

call

function call.

exp_r2_full

expected r2 between inbreeding and sMLH for the full dataset

r2_Wf_boot

expected r2 values from bootstrapping over individuals

CI_boot

confidence interval around the expected r2

nobs

number of observations

nloc

number of markers

Author(s)

Martin A. Stoffel (martin.adam.stoffel@gmail.com)

References

Slate, J., David, P., Dodds, K. G., Veenvliet, B. A., Glass, B. C., Broad, T. E., & McEwan, J. C. (2004). Understanding the relationship between the inbreeding coefficient and multilocus heterozygosity: theoretical expectations and empirical data. Heredity, 93(3), 255-265.

Szulkin, M., Bierne, N., & David, P. (2010). HETEROZYGOSITY-FITNESS CORRELATIONS: A TIME FOR REAPPRAISAL. Evolution, 64(5), 1202-1217.

Examples

1
2
3
4
5
6
data(mouse_msats)
data(bodyweight)
genotypes <- convert_raw(mouse_msats)

(out <- r2_Wf(genotypes = genotypes, trait = bodyweight, family = "gaussian", type = "msats",
              nboot = 100, parallel = FALSE, ncores = NULL, CI = 0.95))

mastoffel/inbreedR documentation built on Feb. 9, 2022, 12:39 p.m.