# Time series analysis using Stata: Twitter behaviour [closed]

Sorry, I'm quite new at Time series analysis.

I'm trying to conduct a study on the Twitter behaviour of Donald Trump and how it affects his popularity rating. I have collected the data on his tweets, created dummy's for the themes of the tweets (e.g. Obama, China, tax reforms, immigrants, etc.), time of day, etc. My questions:

Question 1. Does anyone know of a similar study done in Stata I can consult?

Question 2. Using Stata, I have to do a regression analysis of this time series. However, I have some problems getting started. First of all with the selection of the model and which steps to do first. Would this be a valid order: A. Test for stationarity (unit root Test Dickey-Fuller) B. Test for cointegration, what test to use in Stata? (Johansen or Engle-Granger?) C. Choose model (any general step-by-step guide to choose one?)

Question 3. The non uniformity of my data: the number of tweets vary each day. I thought of considering the different tweets like panel data. However, as some days have 7 tweets and some have only 1, it would look like I have a lot of observations missing. Can I give each observation (tweet) a code so Stata knows it is still from the same day?

If these questions seem irrelevant or not well thought-through, it is because I'm really struggling to grasp what is important in order to conduct my study. I am lost in the abundance of theory on time series and Stata so any sense of direction would be much appreciated!

• Although many statistical issues are mentioned here, it appears that the only definite questions you ask are (1) how to format the data for Stata and (2) whether to check the explanatory variables for stationarity. Those are preceded by a vague question about "whether I can use panel data models, pooled OLS, AR(i)MA models and so on." Please, then, decide what question you want to ask and state it clearly, definitely, and prominently.
– whuber
Commented Dec 21, 2017 at 16:44
• I tried rearranging the questions in order to try and make more sense. Sorry for vague questions, right now everything seems vague to me too. Thanks! Commented Dec 22, 2017 at 15:56

Question 2. Using Stata, I have to do a regression analysis of this time series

In my opinion I don't believe Stata will be of use to you as it lacks broad functionality in time series analysis. Please review http://autobox.com/dave/regvsbox.pdf (which I authored) discusses issues/differences/opportunities/pitfalls when dealing with time series that your possible regression solutions may be ignoring.

You might also look at If I am convinced that a series is mostly trend+season, what is it I should check about the residuals? as it discusses the opportunities/complications that arise with time series data. It specifically deals with residuals from a specified model but the specified model could easily be be a simple (standard) regression model.

Unknown/untreated factors can often play havoc with model identification such as pulses/level shifts/local time trends , changes in error variance , changes in parameters over time which is why they need to be empirically identified and controlled/adjusted for.

The above flow chart might also be of help in providing a framework/script to follow regardless of your software of choice.

• Are the opinions here about Stata based on using it or on careful study of its documentation? The main fault implied is that it doesn't include the same functionality as Autobox! Readers might start with stata.com/bookstore/time-series-reference-manual to judge for themselves. Commented Dec 29, 2017 at 13:49
• A long-time colleague of mine has written extensively about Stata and it's use in time series. He advises me that with causal data :1) stochastic input series are not self projected :2) There is no automatic identification of the TF model form :3) There is no automatic identification of outliers :4) There is no automatic identification of variance change points . BUT the user can themselves/manually set up a fairly general model. Functionality requiring the user to be an expert is a necessary but not sufficient criterion for usefulness in my opinion. Commented Dec 29, 2017 at 14:35
• The implication is that your knowledge of Stata is second-hand. It would be helpful to be given the "extensive" references you allude to. You're right that the philosophy of delegating all decisions to a program is utterly alien to Stata. Researchers using Stata are expected to be able to think for themselves. Commented Dec 29, 2017 at 17:05