1
$\begingroup$

I have a dependent variable (innovate) which is binary (0 or 1 outcome) and an independent variable (week). Sample of the panel data:

enter image description here

So for instance, firm 1 innovated in week 3, firm 2 innovated in week 6, and firm 3 innovated in week 2 in response to a policy change.

When I run an OLS regression with Y = innovate and X = week, I get this in Stata:

enter image description here

Now, R-squared is low, signalling that the model isn't a good fit. I have a few questions:

1) Is this an appropriate way to estimate the effect of increasing the number of weeks on the probability of innovating?

2) Is it acceptable to use OLS on panel data with binary outcomes?

3) What could I try now that I know the R-squared is low?

Thank you!

$\endgroup$

1 Answer 1

5
$\begingroup$

1) No, this is not an appropriate way to estimate the time to an event. Imagine you changed your scale from weeks to days, or seconds. You would automatically inflate how much data you have, and so the estimated probability would tend to zero. Your outcome shouldn't change based on what scale you measure it on in this way. Tools from survival analysis are better suited, even if there is no censoring in your data.

2) LPM is an area of heavy debate. The arguments for and against LPM are moot because your approach should not focus on the binary outcome innovate but rather the week variable.

3) R squared will cease to be a good measure of model fit once you move to something like cox regression or the Kaplan Meier estimator. I'm sure there are metrics similar to R squared in which the log likelihood is replaced by the sum of squares, but I'm not familiar enough with survival analysis to say for sure.

Don't believe survival analysis is appropriate? I'll demonstrate. let me remake your data and run it through a survival analysis in python using lifelines

import numpy as np
import pandas as pd
from lifelines import KaplanMeierFitter
import matplotlib.pyplot as plt

%matplotlib inline


frames = []

# Create some data.
# Randomly generate observations in time
# I assume we stop observing when they innovate
for i in range(100):

    num_weeks = np.random.poisson(13.5)
    weeks = np.arange(1,num_weeks)
    innovate = np.zeros_like(weeks)
    innovate[-1] = 1
    frame = pd.DataFrame({'firm': i, 'weeks':weeks, 'innovate':innovate})

    frames.append(frame)

df = pd.concat(frames)

# We only need observations where innovation occurs.
df_needed = df.query('innovate==1')

kmf = KaplanMeierFitter()

kmf.fit(df_needed.weeks, df_needed.innovate)

ax = kmf.plot_cumulative_density()

You only need the data when the innovation occurs or the latest observation for each firm (these would be censored data). In this case, the innovate column would have a 0 rather than a 1. Here is the result from a Kaplan Meier Estimator

enter image description here

This plot shows us the probability that a firm does not innovate provided it has not innovated up until now. As time goes on, the probability of not innovating goes to 0 (which makes sense, at least in this cooked up example).

$\endgroup$
2
  • $\begingroup$ There are only two variables. Their relationship is the question. In analyzing that, how can one focus on 1 variable but not the other? $\endgroup$
    – rolando2
    Commented May 10, 2020 at 23:20
  • $\begingroup$ @rolando2 The rows where innovation==1 indicate the time when the incident took place. All that is needed are the rows where innovation==1 or the latest observation from each firm in the case the firm did not innovate. That makes use of both variables, and is a better approach than an LPM, at least according to the facts presented by OP. $\endgroup$ Commented May 10, 2020 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.