Skip to contents

For each named marker, the rotated model is fitted by REML with the marker among the fixed effects and the residual variance fixed at its target of one, the genetic variance re-estimated. The marker effect, its standard error from \((X'V^{-1}X)^{-1}\) without a scale factor, and a t test on \(n - p - 1\) degrees of freedom are returned. With known variance components this fit reproduces the single-stage analysis of the plot data, which the genome scan, with its residual variance estimated and its variance ratio held at the model without a marker, approximates. The paper's rule is to refit the markers whose scan statistic lies within a window of the significance threshold, on either side; given a genome_scan() object those markers are selected here.

Usage

refit_markers(
  x,
  markers,
  which = NULL,
  scan = NULL,
  window = 1.5,
  threshold = NULL
)

Arguments

x

a rotation object.

markers

numeric matrix of marker dosages (0, 1, 2), accessions in rows with the accession names as row names, markers in columns; complete.

which

the markers to refit: a character vector of marker names (or column indices). If NULL, scan must be given and the markers within window of its threshold under the rotation are refitted.

scan

optionally the genome_scan object of the same markers; its threshold is used for significant, its rotated statistic is carried along, and it selects the markers when which is NULL.

window

the half-width, in \(-\log_{10} p\), of the band around the threshold from which markers are selected when which is NULL.

threshold

the significance threshold in \(-\log_{10} p\) when no scan is given; NULL leaves significant as NA.

Value

a data frame of class refit, one row per marker: marker, scan_neglog10p (when a scan is given), genetic (the genetic variance of the refit), beta, se, t, neglog10p, significant, and boundary (whether the genetic variance went to zero). Attributes threshold, window, df, n, p.

Examples

ex <- rotationGWAS:::toy_trial(n = 120, n_markers = 80, seed = 2)
r <- rotation(ex$means, ex$Omega, ex$relationship, ex$covariates)
s <- genome_scan(r, ex$markers)
refit_markers(r, ex$markers, scan = s, window = 1.5)
#> Refit of 1 marker with the residual variance fixed at one (t on 116 degrees of freedom); threshold 3.204 in -log10 p, 0 significant
#>  marker scan_neglog10p genetic  beta     se     t neglog10p boundary
#>   m0017           3.05   3.187 1.405 0.3995 3.516     3.204    FALSE
#>  significant
#>        FALSE
refit_markers(r, ex$markers, which = ex$truth$causal, scan = s)
#> Refit of 1 marker with the residual variance fixed at one (t on 116 degrees of freedom); threshold 3.204 in -log10 p, 0 significant
#>  marker scan_neglog10p genetic  beta     se     t neglog10p boundary
#>   m0017           3.05   3.187 1.405 0.3995 3.516     3.204    FALSE
#>  significant
#>        FALSE