STATA is owned by StataCorp LLC and its main advantage is the freedom it provides to the user through continuous growing and evolving libraries provided by the company and users through various sites or blogs such as. The Stata blog. Although the main advantage of the program is its code, some users may find it difficult to write the code and manipulate the results.
With a simple example we will try to show some of the capabilities of the program through time series analysis. We used the GDP index dataset for the years 1995 to 2017 from ELSTAT .
Import dataset command
import excel «C:\…\stata_example.xlsx», sheet(«Φύλλο1») firstrow
label variable year «Year»
label variable pop «Population»
label variable GDP «GDP»
Για την καλύτερη γραφική απεικόνιση των δεδομένων κατασκευάσαμε μια νέα μεταβλητή, την pop2
label pop2 «Πληθυσμός (Εκατοντάδες)»
The population change time diagram is generated by the tsline pop2 command and produces the following graph
Similarly, command tsline GDP produces the below graph
We observe a similar change of the two sizes characterized by the steady decline in their prices after 2010.
Finally, the simultaneous representation of the two variables with the help of the tsline GDP pop2 command can not render in detail the time changes.
One solution is to combine these two graphs with the help of commands
line pop2 year, saving(g1)
line GDP year, saving(g2)
gr combine g1.gph g2.gph
The first test was performed with the help of a linear regression model with the help of the command
regress GDP year
and the results showed that the model is statistically significant (F (1.21) = 16.45, p <0.001) and of moderate interpretability (R2=43.93)
The comparison of real versus estimated values with the help of commands
line fitted_values GDP year
shows that linear regression can not capture changes in GDP
The second estimate was made using the ARIMA method (p, d, q) and led to the ARMA model (2.0) as it presented the lowest BIC and AIC coefficient. The new assessment was made with the help of the commands
arima GDP, arima(2,0,0)
estout, stat(aic bic)
line f1 GDP year
was clearly improved as shown in the graph below
This was a simple example of using STATA for analysis. For any question or if you need help with your analysis you can contact us.