Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65064

Checking if a condition has been met at least once during a period, then signaling the whole period as "condition met".

$
0
0
Good afternoon,

I have been struggling trying to solve a problem regarding that I have a feeling might have an easy/obvious solution that is escaping me.

I am looking at stocks' time series monthly data and I want to identify the stocks that pay a regular dividend, and later identify those that have been increasing it at regular intervals.

From the dividend distribution code I can read the announced frequency of the dividends. In every month when a dividend is paid, a code tells you whether the dividend policy of the firm is to pay it monthly, quarterly, semiannually or annually. In other months the observation is missing.

For example, in the table below firms 1 and 2 pay a quarterly dividend (code = 1), although firm 1 pays it in the first month of the quarter and firm 2 in the middle one.

I would like to create a variable that signals that a certain firm is at that point in time paying a regular dividend. So, even in the months when the distribution is not paid it should have value = 1 if that month is "sandwiched" between dividend distributions. Sometimes firms also change their policy: maybe they were paying quarterly dividends and change to an annual policy, so you have quite a few months when they show a missing value for dividend frequency, but in fact they should still be categorized as regular dividend payers because they are just waiting longer periods between payments.

id time Dividend Frequency Dividend payer
1 1960m1 1 ?
1 1960m2 . ?
1 1960m3 . ?
1 1960m4 1 ?
2 1960m1 . ?
2 1960m2 1 ?
2 1960m3 . ?
3 1960m1 . ?
3 1960m2 2 ?


Basically, I somehow have to check for the continuation of payments in a way smart enough to adapt to the different frequencies, and I am not managing to find a way. I think I will need some type of loop that for each observation goes back in time and checks if at any point of the quarter (for quarterly paying stocks) a dividend has been paid, if it is declared as annual paying it has to check the previous year, and so on.

It should however be able to detect when a dividend is discontinued. Otherwise, the variable will keep reporting a positive signal way after a stock has stopped paying dividends (i.e. if I only require a dividend being paid in the last 12 months for stocks that have an annual policy, I will keep them in the dividend paying group for 11 months after they discontinued the dividend).

I can obviously identify the stocks in the months when they do pay. I cannot figure out a way to "fill the missing values" in between payments. What am I missing?

Thanks for your help.

A.

Viewing all articles
Browse latest Browse all 65064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>