pub struct RandomInterceptStats {
pub xtx: Mat<f64>,
pub xty: Vec<f64>,
pub yty: f64,
pub n: usize,
pub p: usize,
pub group_n: Vec<f64>,
pub group_s: Mat<f64>,
pub group_t: Vec<f64>,
}Expand description
Sufficient statistics for a single-random-intercept fit.
Everything the REML criterion needs, reduced from the data once. See the module documentation for why this is the whole story.
Fields§
§xtx: Mat<f64>X'X, p x p.
xty: Vec<f64>X'y, length p.
yty: f64y'y.
n: usizeNumber of observations.
p: usizeNumber of fixed-effect columns.
group_n: Vec<f64>Observations per group. Empty groups are dropped on construction, so every entry is positive.
group_s: Mat<f64>Column sums of X within each group, G x p.
group_t: Vec<f64>Sum of y within each group, length G.
Implementations§
Source§impl RandomInterceptStats
impl RandomInterceptStats
Sourcepub fn from_design<T: BixverseFloat>(
x: MatRef<'_, T>,
y: &[T],
groups: &[usize],
n_groups: usize,
) -> Result<Self, CoreErrors>
pub fn from_design<T: BixverseFloat>( x: MatRef<'_, T>, y: &[T], groups: &[usize], n_groups: usize, ) -> Result<Self, CoreErrors>
Reduces a design and response to the sufficient statistics.
One O(n p^2) pass. Groups with no observations are dropped rather than
counted, so a caller may pass a level set wider than the data.
§Params
x- Design matrix,n x p. Include the intercept column yourself.y- Response, lengthngroups- Level code per observation, each in0..n_groupsn_groups- Number of levels
§Returns
The statistics, or CoreErrors::ShapeMismatch when the arguments disagree in length and CoreErrors::InvalidArgument for an out-of-range level code or fewer than two non-empty groups.
Trait Implementations§
Source§impl Clone for RandomInterceptStats
impl Clone for RandomInterceptStats
Auto Trait Implementations§
impl Freeze for RandomInterceptStats
impl RefUnwindSafe for RandomInterceptStats
impl Send for RandomInterceptStats
impl Sync for RandomInterceptStats
impl Unpin for RandomInterceptStats
impl UnsafeUnpin for RandomInterceptStats
impl UnwindSafe for RandomInterceptStats
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.