redefining variable for use in timer interrupt

I am using a timer interrupt to control various counters, the speed of the counter is controlled using the speeder variable which is defined above setup() so its global, however when i try redefining this within the loop function it doesn't do anything? I need to be able to redefine it several times and i'm unsure how to do it.

int speeder; // speed of counter set to 30 for bounce

void setup()
{
  
  Serial.begin(9600);
  pinMode(pirpin,INPUT);
  digitalWrite(pirpin,LOW);

// initialize Timer1
cli();          // disable global interrupts
TCCR1A = 0;     // set entire TCCR1A register to 0
TCCR1B = 0;     // same for TCCR1B

// set compare match register to desired timer count:
//OCR1A = 15624; Original speed control
OCR1A = speeder; 

// turn on CTC mode:
TCCR1B |= (1 << WGM12);

// Set CS10 and CS12 bits for 1024 prescaler:
TCCR1B |= (1 << CS10);
TCCR1B |= (1 << CS12);

// enable timer compare interrupt:
TIMSK1 |= (1 << OCIE1A);


calculate_ofsets();

// enable global interrupts:
sei();
}

void loop(){

if (digitalRead(pirpin) == HIGH){
  speeder=30;
tracker ++;
 // bounce = true;
}
else {
  
  tracker = 0;
}
}

The 'speeder' is not set to an initial value.
It probably starts with zero, but you did not assign a value to it when you set OCR1A to 'speeder'.

In the loop you change 'speeder' to 30. That is okay. But you change that variable, without using that variable. I think you can set OCR1A directly to a new value.

Why do you want to change the frequency of the timer interrupt ? Can you have a fixed frequency and do the counting and different timing in software ?