check_monotonicity: Check Monotonicity of Predicted Values

View source: R/modelling.R

check_monotonicityR Documentation

Check Monotonicity of Predicted Values

Description

This function checks if the predicted values from a linear model are monotonically increasing or decreasing across a range of L values for multiple age points.

Usage

check_monotonicity(lm_model, pred_data, minRaw, maxRaw)

Arguments

lm_model

An object of class 'lm' representing the fitted linear model.

pred_data

Matrix with prediction values

minRaw

lowest raw score in prediction

maxRaw

highest raw score in prediction

Details

The function creates a prediction data frame using all combinations of the provided L values and age points. It then generates predictions using the provided linear model and checks if these predictions are monotonically increasing or decreasing for each age point across the range of L values.

Value

A named character vector where each element corresponds to an age point. Possible values for each element are 1 for "Monotonically increasing" -1 for "Monotonically decreasing", or 0 for "Not monotonic".


cNORM documentation built on Nov. 4, 2024, 5:07 p.m.