2026-08-13 07:02:10 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "spectra_reml/types.hpp"
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace spectra::reml {
|
|
|
|
|
|
|
|
|
|
struct FixedEffectHypothesis {
|
|
|
|
|
// Rows are restrictions and columns correspond to beta in design order.
|
|
|
|
|
ColMajorMatrix contrast;
|
|
|
|
|
// Empty means a zero right-hand side.
|
|
|
|
|
std::vector<double> rhs;
|
|
|
|
|
};
|
|
|
|
|
|
2026-08-14 16:54:57 +08:00
|
|
|
// Computes coefficient-wise tests and any supplied general linear hypotheses.
|
|
|
|
|
// At an interior or retained line-search iterate it uses the requested REML
|
|
|
|
|
// small-sample method. A sigma_g2=0 boundary fit is refitted and tested as
|
|
|
|
|
// ordinary least squares without a GRM term. Inputs must use the same
|
|
|
|
|
// orthogonally rotated coordinate system and phenotype scale as the fit.
|
2026-08-13 07:02:10 +08:00
|
|
|
[[nodiscard]] FixedEffectInferenceResult infer_fixed_effects_spectral(
|
|
|
|
|
const std::vector<double>& y_star, const ColMajorMatrix& x_star,
|
|
|
|
|
const std::vector<double>& eigenvalues, const RemlResult& fit,
|
|
|
|
|
FixedEffectTestMethod method,
|
|
|
|
|
const std::vector<FixedEffectHypothesis>& hypotheses = {},
|
|
|
|
|
double rank_tolerance_relative = 1e-10,
|
|
|
|
|
double covariance_floor_relative = 1e-12);
|
|
|
|
|
|
|
|
|
|
} // namespace spectra::reml
|