# Interrupted time series analysis with log transformed data

I want to conduct an assessment of the annual citation rates for a group of patents before and after a particular intervention (namely the decision of the Supreme Court in Alice v CLS Bank, which I represent with a dummy value 0 or 1). Unfortunately, from the dataset I have collected, I have a fair amount of positive skew in the raw citation rate for each patents (some patents have 100 citations, others have 10). I have tried to filter out those patents that do not have any citations. Accordingly, I have log transformed those values as follows:

+------+-------+-----------+--------------+
| year | alice | citations | logcitations |
+------+-------+-----------+--------------+
|    1 |     0 |         6 |        0.778 |
|    2 |     1 |         3 |        0.477 |
|    3 |     1 |         1 |        0.301 |
+------+-------+-----------+--------------+


I then wanted to conduct a time series analysis to see whether there was a relative change in the number of LogCitations before and after Alice using the following model:

model1 = lm(logcitations ~ alice, data)


Is this model too simplistic for assessing the effect of the change in citations? Is there another test that I could use for assessing the effect of the time series? Thank you.

EDIT: I should mention that I am attempting to measure these effects over a 20 year period. I have adopted the lm model described above because I have read that using an ARIMA model requires at least 30 data points (which unfortunately I don't have, because patents only remain in force for 20 years).

EDIT: In response to Chris Haug's question below, I've added the acf and pacf values for the model1 residuals:

• Using an ARIMA model does not require any particular number of observations in general. What does the ACF/PACF of the residuals of model1 look like? Jul 23 '18 at 12:01
• Hi Chris Haug, I have edited my post and added the ACF and PACF outputs from the residuals. Hopefully they demonstrate that my data is stationary. Thanks! Jul 24 '18 at 0:10

When you have count data like this, it is generally better to model it with a GLM using a negative binomial distribution (also known as negative binomial regression). This model operates directly on the count values and has its support on the non-negative integers, so it allows any counts of zero and also positive integer counts. The standard form of the negative-binomial regression uses a log-link function, so you still effectively use an implicit logarithmic transformation in your model, but you still allow counts of zero in your outcome. This is a major advantage over the model you have used, since removing count values of zero is almost certain to bias your analysis.

You can implement negative binomial regression using the glm.nb function in the MASS package. The syntax for a model using the same explanatory variable as your model would be as follows:

library(MASS);

Model2 <- glm.nb(citations ~ alice, data, link = log);


There is no guarantee that this model form will fit your data well, but it is the place I would start if I were looking at count data. In your existing model you have a simple binary comparison where the only explanatory variables is the indicator alice. If you have a reasonable amount of data (with non-overlapping years) and you want a richer model, you might consider adding factor(year) as another explanatory variable. To see if your model fits the data appropriately you should look at the residuals using diagnostic plots, and undertake model comparisons. In many cases you will find that the negative binomial regression gives good results.

• Dear Ben, thank you for your reply. I have a few questions to ask about using negative binomial regression. Firstly, is it possible to use negative binomial regression with non-integer data (that is, the log transformed data)? Secondly, what would you define as a reasonable amount of data? I have citation details from about 100 patents over 10 years, with a citation count at each interval of that 10 year period. Is this a sufficient amount of data to be able to draw conclusions? Thank you. Jul 24 '18 at 4:59
• (There is no "negative logistic regression" so I'm going to assume you meant to refer to negative binomial regression.) Negative binomial regression can deal with non-negative non-integer data (since the NB distribution can be extended to the non-negative reals), but the data should not be log-transformed prior to input into the model. The logarithmic transformation is already dealt with in the link function for the model, so the response variable should be the raw count values.
– Ben
Jul 24 '18 at 5:03
• As to the sample size, any regression model you use is going to have the same issues here. Having approximately 1,000 data points is a reasonable sample size and it should allow you to fit models that are not too complicated (i.e., not too many parameters).
– Ben
Jul 24 '18 at 5:04
• Sorry, negative binomial regression was what I meant! Thank you very much Ben! Just one other question - when you mention non-overlapping years, do you mean the year from patent citation expressed as a linear value (1 year since publication, 2 years, 3 years) or the actual raw year (2001,2002)? I have found an article here that describes a method for normalising the decline in patent citations over time: tandfonline.com/doi/pdf/10.1080/10438590500510459. Should I use a similar normalisation factor to account for a decline with my data set? Thanks once again! Jul 24 '18 at 5:37
• I mean that you would want data from patents with differences in their initial year (e.g., some starting in 2001, some starting in 2002, etc.). That way you will be able to "identify" the coefficient for alice in your model, separately from the coefficients for factor(year).
– Ben
Jul 24 '18 at 6:30