torch_openreml.post.var_blup

torch_openreml.post.var_blup(x, z, g, v)[source]

Compute the variances of the BLUPs.

This is the diagonal of cov_blup(),

\[\operatorname{Var}(\hat{b}_i) = \left(\symbf{G}\symbf{Z}^\top\symbf{P}\symbf{Z}\symbf{G}\right)_{ii},\]

the sampling variance of each random-effect prediction.

Parameters:
  • 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:

BLUP variances of shape (q,).

Return type:

torch.Tensor