Skip to contents

h2(x) = phi(x)' C phi(x) / V_P(x), with C the covariance of the reaction-norm group and phi(x) the Legendre basis evaluated at x. The phenotypic variance V_P(x) is evaluated at x too: every other random regression on the same basis (the permanent environment of a test-day model) enters as phi(x)' P phi(x), each scalar term with its variance, and the residual. A covariance between two scalar terms enters with coefficient 1, as in h2(), and the residual of a fit with weights is read at the harmonic mean weight of the records, as in h2() (weights w and 10 w give the same curve). Every random regression of the fit is evaluated on the Legendre basis with these limits.

Usage

h2_curve(fit, group = NULL, limits, points = 101L, bases = NULL)

Arguments

fit

result of model() with an rn() term

group

name of the reaction-norm group; by default the group of the direct genetic term, as in h2()

limits

the same ones passed to legendre() when preparing the data

points

where to evaluate the curve

bases

a named list, term -> function(x), with the value at each point x of the base of a scalar term declared with base = (for example random(id, base = "young"), with young an indicator of a class of the gradient: list(random = function(x) as.numeric(x < 30))). The value of a data column at a point of the gradient is not known from the fit, so such a term without an entry here enters with base 1 at every point, and a warning says so. In a fit with residual_by =, the entry residual is a function(x) that gives the residual class at each point (for example the band of days that holds x); without it the residual enters at its mean over the records, the one of h2(), and a warning says so

Value

a data.frame with x, the point on the gradient, va, the additive variance there, and h2, the heritability at that point.

Details

The LIMITS must be the same ones used to generate the basis in the fit: the scale is part of the model. That is why they are a mandatory argument, with no default: a silent default here would produce a curve from another basis.