Skip to content

Commit 09adfd7

Browse files
authored
Merge pull request #505 from pymc-labs/gen-time-series-data
Fix to minor bug in simulated data generation function
2 parents 3d3f482 + 67d550d commit 09adfd7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

causalpy/data/simulate_data.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ def generate_time_series_data(
125125
The intercept
126126
127127
"""
128-
x = np.arange(0, 100, 1)
128+
x = np.arange(0, N, 1)
129129
df = pd.DataFrame(
130130
{
131131
"temperature": np.sin(x * 0.5) + 1,
132-
"linear": np.linspace(0, 1, 100),
133-
"causal effect": 10 * gamma(10).pdf(np.arange(0, 100, 1) - treatment_time),
132+
"linear": np.linspace(0, 1, N),
133+
"causal effect": 10 * gamma(10).pdf(np.arange(0, N, 1) - treatment_time),
134134
}
135135
)
136136

@@ -147,7 +147,9 @@ def generate_time_series_data(
147147
for var in ["deaths_actual", "temperature"]:
148148
df[var] += norm(0, 0.1).rvs(N)
149149

150-
# add intercept
150+
# add intercept column of ones (for modeling purposes)
151+
# This is correctly a column of ones, not beta_intercept, as beta_intercept
152+
# is already incorporated in the data generation above
151153
df["intercept"] = np.ones(df.shape[0])
152154

153155
return df

0 commit comments

Comments
 (0)