You need to use R software to find details
© Muehlenbachs 2023 This material is designed for use as part of Econ 323 at the University of Calgary and is the property of the instructor unless otherwise stated. Copying this material for distribution (e.g. uploading material to a commercial third-party website) can lead to a violation of Copyright law. Econ 323: Assignment 1 Hardcopy of assignment due at the beginning of class on February 16, 2023 No need to submit R code, only figures and R output. But the point of this assignment is to learn R, the assignment cannot be completed using a different software (e.g., Stata or excel). No late assignments are accepted. All questions are 1 point each. Before starting, open the dataset gaswells.dta in R. The data are in a Stata format, so you can use an R package to open a Stata dataset in R (see the slides from the R session on January 31st). Here you can see the monthly production from a random draw of 900 wells in Alberta (900 of about 400,000 wells!). With the well identifier (wellID) you can track the amount of natural gas each of the wells produced (monthlyproduction_e3m3) in each month (date). You can also see the date that the well was drilled (spuddate). And you can already see how few wells have an abandonment date (abndate)—keep this in mind when we talk about liability management later in the class. 1. Questions on monthly well-level production: In the paper Anderson, Soren, Ryan Kellogg, and Steve Salant, “Hotelling Under Pressure,” Journal of Political Economy. The authors show that oil production from existing wells is not responsive for oil price changes. See figure from the paper, pasted below. (a) Plot monthly gas prices (gasprice_e3m3), from 1990 to 2020. (b) Plot in a separate figure the monthly production (from 1990 to 2020) of the subsample of wells that were drilled before 1990 (i.e., you don’t want to include production from wells drilled after 1990 because then variation over time could be driven by wells being drilled). (Note: you will see production does not form as smooth a decline curve as the figure below) (c) Now plot a third figure, of the average production using the subsample of wells drilled before 1960, for the period 1990 to 2020. (Note: here you can see production decline is smoother, and is more similar to the decline curve in the figure below) (d) Run a linear regression of log(gas produced) on log(price). What is the coefficient on log(price) and what does it mean in words? (i.e., how do you interpret the coefficient?) (Aside: question is just to show you how easy it is to run a regression in R and give you a chance to interpret a coefficient---there are many things wrong with this regression specification, e.g., the gas produced might drive prices, not vice versa). © Muehlenbachs 2023 This material is designed for use as part of Econ 323 at the University of Calgary and is the property of the instructor unless otherwise stated. Copying this material for distribution (e.g. uploading material to a commercial third-party website) can lead to a violation of Copyright law. 2. Well-level averages: (a) Plot the average length of laterals (reported in meters) of wells drilled in each year (note, do not take the average of the full dataset, which repeats wells by production month. A well should only contribute to the average once, the year it was drilled). Are you surprised by the length of these wells? (b) Plot the average vertical depth (reported in meters) over time (similar to above: do not take the average of the full dataset, which is a monthly production dataset. You want to take the average of a well-level dataset). (c) What is the average surface casing depth and standard deviation? © Muehlenbachs 2023 This material is designed for use as part of Econ 323 at the University of Calgary and is the property of the instructor unless otherwise stated. Copying this material for distribution (e.g. uploading material to a commercial third-party website) can lead to a violation of Copyright law. 3. In this newspaper article: https://www.reuters.com/business/energy/why-western-canada-has- some-cheapest-natural-gas-world-2022-09-14/ (a) Are prices listed by energy content or volume? (b) Using the price of $3.50/mmBtu, how much is the 12.5 bcf/d worth? 4. The figure below is from "Welfare and Distributional Implications of Shale Gas." The thick orange line represents the supply curve in a world without shale gas, and the thin orange line represents the supply curve with shale gas. The black line represents the demand curve. (a) Are consumers of natural gas better or worse off from the shale boom? And what area/s in the figure represent the change in consumer surplus from the shale boom? (b) Are producers of natural gas better or worse off from the shale boom? And what area/s represent the change in producer surplus from the shale boom? (c) The paper mentions some other groups that benefited from the shale boom. Name two. https://www.reuters.com/business/energy/why-western-canada-has-some-cheapest-natural-gas-world-2022-09-14/ https://www.reuters.com/business/energy/why-western-canada-has-some-cheapest-natural-gas-world-2022-09-14/ https://search-proquest-com.ezproxy.lib.ucalgary.ca/docview/1780153895/fulltextPDF/B8AA71EEFF694C97PQ/1?accountid=9838 3. Crash Course in R-Program Why R? Install R – free! Also available in Computer Labs if you don’t have a labtop or it does not work. Tons of online resources! If you are stuck, google your problem. For example, “how do I only keep certain observations in R?” Staubli Social Insurance U of Calgary 41 / 74 3. Install R for Windows R for Window Go to www.r-project.org Click the “download R” link under “Getting Started”. Click on “https://cloud.r-project.org/” to install from nearest server Click on “Download R for Windows” Click on the “install R for the first time” link at the top of the page. Click “Download R-4.2.2 for Windows” and save the executable file somewhere on your computer. Right click on the .exe file and select “Run as administrator,” follow the installation instructions. Staubli Social Insurance U of Calgary 42 / 74 3. Install R for MAC R for MAC Go to www.r-project.org Click the “download R" link in the middle of the page under "Getting Started." Click on “https://cloud.r-project.org/” to install from nearest server Click on the “Download R for macOS” link at the top of the page. Save the .pkg file with the latest release (4.2.2), double-click it to open, and follow the installation instructions. Staubli Social Insurance U of Calgary 43 / 74 3. Install R Studio Install R Studio: ideal to work with R – free! Go to www.rstudio.com and click on "Download". Click the tab “Products” and click on “RStudio” Click on "DOWNLOAD RSTUDIO" and click “DOWNLOAD RSTUDIO” below RStudio Desktop Scroll to “All Installers and Tarballs” and choose the file for your operating system. Right-click on .exe file (Windows) and select “Run as administrator” (Mac: save the .dmg file on your computer, double-click it to open, and then drag and drop it to your applications folder.) Staubli Social Insurance U of Calgary 44 / 74 3. Working in R Studio Staubli Social Insurance U of Calgary 45 / 74 3. Projects and Scripts Use a “Project” to work in R Click on File, New Project, New Directory, New Project. Give the directory a name, for example “CDM” and save all data, code, etc. in that directory R Studio will automatically search for data, scripts, etc. in your project folder. Use “Scripts” to save your code Click on File, New File, R Script: Here is where you can write/save your code (top left) Staubli Social Insurance U of Calgary 46 / 74 3. Installing Packages and Loading Packages Staubli Social Insurance U of Calgary 47 / 74 Data frames: L: ltlo 166464ngoniI 611bH: Graphs: