Dear colleagues,

For firms i=1,...,50 and years t=1,...,10, I have ratings which can be expressed as R=1,...,10. A firm's rating can change from year t-1 to year t because the firm's characteristics x_it change, or because the rating scale changes, or both.

In that context, I would like to isolate downgrades, i.e. worsenings of the numerical conversion of ratings, due to scale changes:
ScaleBasedChange = Prediction(current parameters, lagged characteristics) - Prediction(lagged parameters, lagged characteristics)

Below is the best idea I've had so far on how to implement this. In particular, I've sought to estimate a separate function for each year.
Here with a linear probability model for regressions to run through faster, although ultimately Ordered Probit or Ordered Logit is presumably more appropriate given only 10 possible outcome values.

Yet I'm not sure whether this really does what I want. Do you see any mistakes or ways to improve this?

Thanks so much! PM

************************************************** ************************************************** **************************

PHP Code:

1. Registering characteristics of each year in each other year:
    foreach var 
in $X {
        
forval y 1/10 {
            
gen l`y'_`var' = `var' if year==`y'
            bysort id (l
`y'_`var'): replace l`y'_`var'= l`y'_`var'[1]
            }
        }

* 2. Predicting ratings with new scale and old characteristics:    
    forval y=1/10 {    
        reg R 
$X if year==`y',  robust // Get parameters valid in current year
            xtset id year
            foreach var in $X {
                replace `var' 
l`y-1'_`var' // Replace X with lagged X
                }
            predict newbeta_oldx_`y'
xb // Now hopefully compute prediction using current parameters but lagged X
            
replace newbeta_oldx newbeta_oldx_`y' if year==`y'
            foreach var in $X {
                replace `var' 
l`y'_`var' // restore X to current values.
                }            
            }    
  
    
* 3. Predicting ratings with old scale and old characteristics:    
    forval y=1/10 {
        reg bests_ratep    $X if year==`y-1'
,  robust
            
foreach var in $X {
                
replace `var' = l`y-1'_`var'
                
}
            
predict oldbeta_oldx_`y', xb
            replace oldbeta_oldx = oldbeta_oldx_
`y'
            foreach var in $X {
                replace `var' 
l`y'_`var'
                }            
            }    

* 4: Indicator for whether predicted ratings under the new scale are worse than under the old scale:   
    gen I_scalebased_change = (newbeta_oldx < oldbeta_oldx)