- 8
- 38 508
Eric Lenz
United States
Приєднався 2 лют 2020
I'm interested in sharing videos about economics and statistics. I've taught courses in economic data analysis, quantitative methods, and international economics. I also enjoy learning and teaching with SAS, Stata, and R.
Visit my Economics blog at sites.google.com/view/lenz. Thank you for visiting!
Visit my Economics blog at sites.google.com/view/lenz. Thank you for visiting!
Make a Wordcloud in Python...part 2!! Fredclouds!!
In this video I make a Fredcloud...two Wordclouds scraped from several FOMC press releases imposed on a Fred graph of the federal funds rate. I also process some images in Gimp to make masks for the Wordcloud. We see that the Fed has a greater variety of interests post-Covid relative to pre-Covid.
fredcloud.py: docs.google.com/document/d/1BjHBPJc4JmutXvT6pHqqCR60vpKdAHAE-enCvXKlhMQ/edit?usp=sharing
fredcloud.png: drive.google.com/file/d/1MI9TUotWW-sPIV8Iv1fGHOKxWanPX2vx/view?usp=sharing
Fred.png: drive.google.com/file/d/1-6ZlmRXDrgpRPxV6kXAUNN6b5RQyqeTr/view?usp=sharing
Fred_0.png: drive.google.com/file/d/1rzTIuidsTjWfLtVu6tCVNOzkKRl-y0uQ/view?usp=sharing
Fred_1.png: drive.google.com/file/d/14GWbmCjR-vX7dbIxtU39vYIor59PYMit/view?usp=sharing
Fredtrans.png: drive.google.com/file/d/1JvC_pVPH72L_hdNCIxJE35hj_tkXqEFE/view?usp=sharing
00:00 Introduction
01:36 Packages/modules
02:00 FOMC url lists
03:48 For loops
06:14 NLP
06:55 Gimp/FRED graph
08:00 first Mask
09:33 Feather
10:27 Export as .png
10:59 second Mask
11:30 Crop
12:46 Transparency/alpha channel
14:30 numpy
15:17 contour_color
16:10 Wordclouds/paste
18:08 Transparency paste
18:58 Fredcloud
#naturallanguageprocessing #wordcloud #webscraping #gimp #python #fred
fredcloud.py: docs.google.com/document/d/1BjHBPJc4JmutXvT6pHqqCR60vpKdAHAE-enCvXKlhMQ/edit?usp=sharing
fredcloud.png: drive.google.com/file/d/1MI9TUotWW-sPIV8Iv1fGHOKxWanPX2vx/view?usp=sharing
Fred.png: drive.google.com/file/d/1-6ZlmRXDrgpRPxV6kXAUNN6b5RQyqeTr/view?usp=sharing
Fred_0.png: drive.google.com/file/d/1rzTIuidsTjWfLtVu6tCVNOzkKRl-y0uQ/view?usp=sharing
Fred_1.png: drive.google.com/file/d/14GWbmCjR-vX7dbIxtU39vYIor59PYMit/view?usp=sharing
Fredtrans.png: drive.google.com/file/d/1JvC_pVPH72L_hdNCIxJE35hj_tkXqEFE/view?usp=sharing
00:00 Introduction
01:36 Packages/modules
02:00 FOMC url lists
03:48 For loops
06:14 NLP
06:55 Gimp/FRED graph
08:00 first Mask
09:33 Feather
10:27 Export as .png
10:59 second Mask
11:30 Crop
12:46 Transparency/alpha channel
14:30 numpy
15:17 contour_color
16:10 Wordclouds/paste
18:08 Transparency paste
18:58 Fredcloud
#naturallanguageprocessing #wordcloud #webscraping #gimp #python #fred
Переглядів: 45
Відео
Make a Wordcloud in Python!
Переглядів 58День тому
I show how to make a Wordcloud in Python using web-scraping and natural language processing techniques. We look at a Federal Open Market Committee (FOMC) press release which highlights the Fed's focus and goals for monetary policy. I also show that the Fed cares a little more about communicating risks post-pandemic. wordcloudyt text file: docs.google.com/document/d/11o8Z2zJgVZkGQv_ZsgLVq5qAgZNS...
Teaching and research update - Fall 2021
Переглядів 1763 роки тому
Teaching and research update - Fall 2021
Estimate confidence and forecast intervals in Stata
Переглядів 3,5 тис.3 роки тому
Is 6% GDP growth likely for the United States in 2021? I estimate confidence and forecast intervals in Stata to show that 6% growth or more would be an outlier. I discuss recent growth forecasts, characteristics of the normal distribution, the theory and interpretation of a confidence interval, and finally I estimate confidence and forecast intervals in Stata. Myron Scholes presented online at ...
Forecast GDP growth in Stata
Переглядів 16 тис.3 роки тому
Learn how to forecast in Stata with two examples of GDP growth. First, I forecast U.S. real GDP growth into 2025 to determine how quickly the U.S. economy may recover from the pandemic. Then, I forecast world real GDP growth into 2025 and after the global financial crisis. Finally, I compare my forecast with IMF forecasts after the global crisis. Program code and data: drive.google.com/file/d/1...
Create maps in Stata with spmap
Переглядів 18 тис.3 роки тому
How can you create nice maps in Stata? Kevin Crow and William Gould at StataCorp write a nice walkthrough for the spmap command. I follow their basic outline using income per person and county coordinate data. Then I show how to customize the color palette, change the legend, and display z-scores. The data is from the IRS Statistics of Income (SOI) and American Community Survey (ACS) Migration ...
Create attendance grades using Zoom reports in Stata
Переглядів 2143 роки тому
Zoom records meetings and participant information. The participant information includes names, email addresses, dates and times, and the participant's duration in the meeting. I use the duration in each meeting to create an attendance grade in Stata. Program file in .txt format: drive.google.com/file/d/1rdD5X3lzqGeCruX4nnCBAAKdq_NOfYRZ/view Check out my website for more information: sites.googl...
Simple linear regression model
Переглядів 2594 роки тому
An easy-to-follow example of a simple linear regression model with one explanatory variable and five observations in open source spreadsheet software. See how the estimation of Y changes with new inputs of X. Also, see how the parameters of the regression equation change with different values of X and Y. Check out my Economics Blog at sites.google.com/view/lenz. Thank you for visiting!
What data are you using to predict GDP growth?
I keep replying to this...it's shown in the video and linked in the description. The same data as the authors of the plot!
So are you saying you are using variables and calculations to determine GDP growth?
Yep, the GDP growth variable's historical values and calculations to forecast it's future values.
So you made your video 6 years after the IMF projections and your model matches theirs and youre askin why their model is off in prediction. Doesnt that mean your model is wrong to if it follows the IMF projections?
No, I used the same data as the IMF and my model more closely matches the actual growth. My model is also very simple and illustrates the concept of reversion to the mean.
@@econ_eric what IMF data is that specifically?
@@user-yz9bu6rx7b Check out 9:39.
@@user-yz9bu6rx7b Please watch the video. I visit the actual website for data. I've also linked my data in the description.
Thank you so much, Eric! I will put you on my acknowledgments & references for my poster presentation! Once again thank you!
You're welcome! Thank you!
Excellent video, thank you!
You're welcome!
Thank you, Eric.
You're welcome!
This is awesome - thank you so much
You're welcome!
Thanks for this! Really helped my research!
You're welcome!
Thank you so much it helped a lot. Can you please tell me how to add a North arrow and the scale?
That's a great question! I assume you mean a distance scale..I'm actually not familiar with adding these elements, but you may find some help at the Stata forums or simply through internet searches. Thanks!
Thank you so much! I was struggling with the state borders but finally made it thanks to you!
Excellent news! I'm glad you got it. I find youtube to be a great resource for programming, so easy to see examples worked out.
Hi! Very helpful, thank you. Do you know what options must I specify to color the map as a heatmap? Thank you
Hey Emily, check out this website for the different color palettes: repec.sowi.unibe.ch/stata/palettes/colors.html. The author gives you the code and examples. You can do a search for "heat" or just pick out the scheme that you think looks best. Thanks!
Hello Eric. I just realized while watching the video that I have known you since my graduate school days. :) Hope you are doing good.
Haha, I knew that might happen when I posted this. I hope you are well!
Thank you very much. I have one concern, how do I put the labels on the regions or cities? I am viewing data on the map of Benin, and I need to put the names of the departments and communes on the map.
Hello Duhamel, you're welcome. I'm not certain that the spmap command has this functionality, but if you send me the files and code, then I can take a look at it. Alternatively, you can search online for more documentation and there is a forum where you can post the question for others: statalist.org. Thanks!
@@econ_eric Hello, thank you for your answer. I got the solution to my problem and I was able to put the names of the departments on the map.
Another concern of mine is to be able to visualise more than one variable at a time on the map with legends of each variable.
Thank you very much ❤❤❤
You're welcome!
Thank you so much Eric, your video really helped me
You're welcome!
What an insightful video, thanks Eric!
Hi Eric, another question , If the variable is not stationary, but after first difference the dfuller shows it is stationary, and then the best lag is lag 2, what should the reg command be? (The original variable is x, after first difference it is x1, and dfuller shows the optimal lag for x1 is lag2) , really confusing about this…
If you dfuller shows stationarity (reject Ho), then however you set up the dfuller test should be your base model. Then you adjust things. Check out p.2 of the tsdfuller pdf. If you're trying to determine which model is the best model to forecast with, then I would generate a new dependent variable series, delete some of the most recent observations, and forecast with each model. Some models may forecast a recovery from recession better and others will forecast the growth before a downturn better. Which is more important to you? There are also the indicators of model fit to consider. Also, I'm not sure if you mean the optimal lag # or the optimal lag. Check out the tsdfuller pdf for details on the output of dfuller and what you're actually testing.
Also, you can test whether a model is stationary by predicting residuals (postestimation in Stata). Predict the residuals and then use dfuller to determine if the residuals are stationary. Do this for each variation of your model. Also, If you find that the first difference of your variable is stationary, then try including a one-period lag of the variable on the right side of the equation (as an independent variable). Predict the residuals and determine if they are stationary. This can be a viable alternative to using your first difference model from dfuller as your main model.
hi Eric, thanks for your video, it helps! Only one question, is the squared deviation referring to variance?
You're welcome, Yuqing! Do I refer to squared deviation in the video or the program code? I'm not quite sure what you're referring to.
@@econ_eric hi Eric, you mentioned squared deviation from mean in the video and say there is much deviation from mean corresponding to the crisis, I am not sure if the squared deviation here referring to the variance
@@yuqingwu1011 I'm not sure where I said squared deviation in the video, but the GDP growth associated with a crisis will be a large deviation from the mean of the GDP growth series.
Thank you. This was extremely helpful
Of course, you're welcome, Patricia!
Excellent and amazing. Thank you Eric.
Of course! You're welcome!
This is amazing job. Thanks a million Eric
Glad you liked it!
Hi Eric, thanks so much for this video, quite informative and well explained. Greetings from chile
Glad it was helpful!
Hi Eric, it was so amazing. Thanks so much for the video. I just wonder which method you were using to process this forecast. Was that ARIMA?
Yes! It was a simple autoregressive model without any error terms. Thanks!
Have tried making forecasts but am getting an error that year 2022 evaluates to missing, any help please?
You may not have saved coefficient estimates from the regression model.
Same issue here. I saved the coefficient estimate from regression model. But the error still states "Missing values were encountered while attempting to solve the model at time 2023. Variable NUTHIV evaluates to missing." What might I be doing wrong? Thank you beforehand!
I really enjoyed the video! Can you do something on how to calculate beta convergence? Thanks.
Interesting! I'm not too familiar with these empirical models, but I'll consider it for a future video!
@@econ_eric that would be awesome, although I hope to beat you to it 😅😅. I couldn’t find any youtube videos, so I’ve decided to take the plunge myself
@@Beygent Good for you! Maybe we can collaborate for a video. Let me know how it turns out! :)
Thank you so much Eric for your essential presentation about how to forecast GDP. In the meantime, I kindly ask that could you share your do-file if it is possible?
Yes, it is in the description of the video. Thanks!
Hi Eric, many thanks, really beneficial, much appreciated.
Very welcome!
Hi Eric, thank you for your video. I go through your do file and it looks like "forecast solve" only works when the model is "reg realgdpgrowth l.realgdpgrowth". If we want to add more independent variables there (for example reg realgdpgrowth l.realgdpgrowth worldgdpgrowth), then how can we have the out of sample forecast? I tried your do-file but it does not work. Can you please help me ?
Hello Duong, thank you for your comment. I think your solution is to store the estimates from the new model with worldgdpgrowth and then use the forecast command. For instance, include worldgdpgrowth in the model on line 79, store the estimates, and then create a new forecast model on line 96 (call it something different than ericmodel). Please let me know if that works.
Hi Eric, thanks very much for the video. Unfortunately when I follow all of your steps I am met with the following error: Variable id specified in option id() does not uniquely identify the observations Any suggestions on what I may be doing wrong would be a great help. Thanks
Hi dougie ws, did you perhaps make a change to the data? This program should work since I uploaded it to the Google drive. I would try to download and run again. Let me know if that works.
I really appreciate you for sharing this tutorial video. It is great
You are very welcome, Ali.
Amazing video and shared content. Thank you so much.
Glad it was helpful!
Very well explained Professor! Thank you for this
Thank you, Zaeem, you are welcome!
Thank you!
You're welcome!
Hi Eric amazing work here..! I like to ask regarding the lag aspect. As i run through your code, i realized that the Q-value is not less than 0.05, and also the regression output for p-value as well. Just like to ask if it would be still meaningful to regress gdp growth to l.gdp growth? As im guessing the whole idea pins upon the lagged aspect. Thanks!
Yes! It is still meaningful to regress gdp growth on l.gdp growth if it produces accurate forecasts. I would argue that the relationship is not spurious - a good year of growth is likely to spur another good year. Consider the alternatives and determine which model produces more accurate forecasts. I was thinking about making another video about lag specification or checking the accuracy of forecasts. There are several ways to check the accuracy of your forecasts - one easy way is to compare the actual data to the forecast. The Stata manual for the forecast command explains this well beginning on page 6: www.stata.com/manuals13/tsforecast.pdf If the coefficient on the lag of GDP growth is not significantly different from zero with 0.05 level of significance, we can try another model with only the regression constant or perhaps another variable or two. Then, plot and compare the forecasts between models, compare r-squared values, etc. In any case, if a model accurately forecasts, then it is hard to argue that it is not meaningful because a p-value for a coefficient is 0.054 rather than <0.05. It is true that the relationship may be spurious; however, the theoretical justification is not a stretch. Also, this model is probably sensitive to the selection of the sample. For instance, if we drop a recent outlier in GDP growth, the q-value and p-value may change.
@@econ_eric thanks for the comprehensive comment! A lot to digest and yes a video regarding lag specification and forecasting accuracy sound like good content! Thanks for the reply :)
Eric, you are amazing. Hope you can do more videos about Stata
Thank you, Chris, I have some more to come.
Thank you! Very helpful.
You're welcome!
Please, how to get the graph of "twoway (line realgdpgrowth year) (line f_realgdpgrowth year, lpattern(dash))" but in the case of panel?
Samia, what is your panel variable? If it identifies countries, then do you want real GDP growth plotted for each country in your data set? The variable f_realgdpgrowth includes a forecast of GDP growth, also. Therefore, many options are possible for an estimation and plot.
Thanks for the usiful video. Please could you give me the code for the graph that figures in the second 0.04, but with panel data
Hello Samia, you're welcome. However, I don't understand what you're asking with "the second 0.04". There is no panel data here.
@@econ_eric Yes I know there is no panel data in your video. I ask if you have the command to do this graph that figures in your video at the second 0.04 and also at the time 8.48 minute (forcasting graph) but with panel data case. I need to get this graph for my paper using panel data approach.
@@econ_eric I must to do a panel GMM forcasting study that's why.
Great contribution to the university community that we make use of this type of analysis, greetings from Ecuador
Thank you, Giovanni!
Thank you very much for this great brief lecture. Please kind share your codes with me. Secondly, how do i go about Covariate Augmented Dickey Full test?
Hello! The link to my program code and data is in the description - thank you!
@@econ_eric Hi Eric, thank you very much. Any idea about Covariate Augmented Dickey Full test? Thanks.
@@businessleadershipandmanag522 I've done a quick search and found a good post in the Stata forums by Andrew Musau: www.statalist.org/forums/forum/general-stata-discussion/general/1361250-determining-optional-lag-length-using-varsoc-for-panel-data According to Andrew in 2016, the topic isn't addressed well in the Stata forums. However, there have been some updates to Stata since 2016 and maybe they address it in Stata 17. You could also try contacting some of the Stata staff.
@@econ_eric Thanks Eric.
@@econ_eric Im using Stata 15.
Very well done! Thank you so much!!! :)
Thank you, Hermanus!
Great, informative, professional work. Well done 👍🏻
Thank you, Lord of Fraternity!
Eric, thank you so much for making this video & providing so many additional links! I felt super lost regarding a class project of forecasting for which I have 6 days to complete without any prior knowledge of how to write forecasting code, but you give me hope! :)
You're welcome, Johanna! I'm glad you've found it useful!
Very nice, Eric! Thank you for sharing this public good with us!
Glad you enjoyed it!
Thank you so much! This is really helpful.
You're welcome!