Skip to main content

Transform

Trait Transform 

Source
pub trait Transform {
    // Required methods
    fn nat_param<F: Float>(lin_pred: Array1<F>) -> Array1<F>;
    fn d_nat_param<F: Float>(lin_pred: &Array1<F>) -> Array1<F>;

    // Provided methods
    fn adjust_errors<F: Float>(
        errors: Array1<F>,
        lin_pred: &Array1<F>,
    ) -> Array1<F> { ... }
    fn adjust_variance<F: Float>(
        variance: Array1<F>,
        lin_pred: &Array1<F>,
    ) -> Array1<F> { ... }
    fn adjust_errors_variance<F: Float>(
        errors: Array1<F>,
        variance: Array1<F>,
        lin_pred: &Array1<F>,
    ) -> (Array1<F>, Array1<F>) { ... }
}

Required Methods§

Source

fn nat_param<F: Float>(lin_pred: Array1<F>) -> Array1<F>

The natural parameter of the response distribution as a function of the linear predictor: $\eta(\omega) = g_0(g^{-1}(\omega))$ where $g_0$ is the canonical link. For canonical links this is the identity.

Source

fn d_nat_param<F: Float>(lin_pred: &Array1<F>) -> Array1<F>

The derivative $\eta'(\omega)$ of the transformation to the natural parameter. If it is zero in a region that the IRLS is in, the algorithm may have difficulty converging.

Provided Methods§

Source

fn adjust_errors<F: Float>(errors: Array1<F>, lin_pred: &Array1<F>) -> Array1<F>

Adjust the error/residual terms of the likelihood function based on the first derivative of the transformation. The linear predictor must be un-transformed, i.e. it must be X*beta without the transformation applied.

Source

fn adjust_variance<F: Float>( variance: Array1<F>, lin_pred: &Array1<F>, ) -> Array1<F>

Adjust the variance terms of the likelihood function based on the first and second derivatives of the transformation. The linear predictor must be un-transformed, i.e. it must be X*beta without the transformation applied.

Source

fn adjust_errors_variance<F: Float>( errors: Array1<F>, variance: Array1<F>, lin_pred: &Array1<F>, ) -> (Array1<F>, Array1<F>)

Adjust the error and variance terms of the likelihood function based on the first and second derivatives of the transformation. The adjustment is performed simultaneously. The linear predictor must be un-transformed, i.e. it must be X*beta without the transformation applied.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Transform for Cloglog

Source§

impl<T> Transform for T
where T: Canonical,