Threshold Regression with Panel Data in R

Hey Guys,
in my master thesis I am working with panel data on democratic quality. If a country is below an index-value of 0,5 it is not categorized as democracy anymore. My appoach is to check the effect of inequality on democracies. I have data of 57 countries during 5 years. The problem is that some of the countries fall below the 0,5 value from time to time. I would like to split my panel data regression in a way that one model estimates the coefficent of inequality (and the control variables) only if the country was above the 0,5 value one time period before. The other model would be not interesting to me beacuse it is not related to democracies. So basically I would like to run model like it is done here in STATA (page 32):

The R functions I found (e.g. ptm in the package pdR) always need the information of regime independent variables which I do not have because I would like to run the hole model two times.

Maybe someone has some advice for me.

Kind regards