torch_openreml.marginal_residual

torch_openreml.marginal_residual(y, x, v)[source]

Compute marginal residuals from fixed effects only.

\[\hat{\symbf{e}} = \symbf{y} - \symbf{X}\hat{\boldsymbol{\beta}}\]

where \(\hat{\boldsymbol{\beta}}\) is the BLUE of the fixed effects (see marginal_predict()).

Parameters:
  • y (torch.Tensor) – Response vector of shape (n,).

  • x (torch.Tensor) – Fixed-effect design matrix of shape (n, p).

  • v (torch.Tensor) – Marginal covariance matrix of shape (n, n), e.g. \(\symbf{V}(\boldsymbol{\theta})\) evaluated at fitted covariance parameters.

Returns:

Marginal residuals of shape (n,).

Return type:

torch.Tensor