This function calculates a comprehensive neural recovery score by combining multiple HRV metrics. The score is based on the following components:

  • RMSSD (parasympathetic recovery)

  • Orthostatic response (autonomic balance)

  • Heart rate recovery (recovery capacity)

calculate_neural_recovery(data, window_size = 7)

Arguments

data

Dataframe containing HRV measurements. Should include:

  • laying_rmssd (numeric): RMSSD during laying position

  • laying_resting_hr (numeric): Resting heart rate

  • rmssd_ma (numeric): Moving average of RMSSD (added by calculate_moving_averages)

  • standing_hr (numeric): Heart rate during standing position

  • hrr_60s (numeric): Heart rate recovery after 60 seconds

window_size

Number of days to use for calculating moving averages (default: 7). Used to establish baseline values for comparison. Must be a positive integer.

Value

Dataframe with added columns:

  • rmssd_score (numeric): Score based on RMSSD ratio (0-40 points)

  • ortho_score (numeric): Score based on orthostatic response (0-30 points)

  • hrr_score (numeric): Score based on heart rate recovery (0-30 points)

  • neural_recovery_score (numeric): Combined total score (0-100)

  • recovery_status (character): Classification based on total score