torch_openreml.residual¶
- torch_openreml.residual(y, x, z, g, v)[source]¶
Compute conditional residuals including random effects.
\[\hat{\symbf{e}} = \symbf{y} - \hat{\symbf{y}}\]where \(\hat{\symbf{y}}\) is the conditional prediction from
predict().- Parameters:
y (torch.Tensor) – Response vector of shape
(n,).x (torch.Tensor) – Fixed-effect design matrix of shape
(n, p).z (torch.Tensor) – Random-effect design matrix of shape
(n, q).g (torch.Tensor) – Random-effect covariance matrix of shape
(q, q), e.g. \(\symbf{G}(\boldsymbol{\theta})\) evaluated at fitted covariance parameters.v (torch.Tensor) – Marginal covariance matrix of shape
(n, n), e.g. \(\symbf{V}(\boldsymbol{\theta})\) evaluated at fitted covariance parameters.
- Returns:
Conditional residuals of shape
(n,).- Return type:
torch.Tensor