# The more you export the more money you make and the higher GDP.  Run a regression in both Excel and SAS. Original Answers Only

Graphs

### Chapter 5:  Simple Regression

Introduction

The workhorse of economic statistics is the regression.  It is used primarily to test theories to see whether the data supports a hypothesis and to forecast future values, like stock prices or inflation.

In this chapter we will look at a simple regression where we look at the relationship between Y the dependent variable and X the independent variable.  In general we say that X determines Y.

Where  are the y-intercept and slope respectively.  U is the error term.  In class we show how to calculate these parameters and to determine if they are statistically significant.   In this project we will understand how Excel and SAS calculate the parameters.  We will further see how to use the output from these programs to do analysis.

Example:  GDP and Oil

One theory we can test is whether increases in oil prices is related with lower GDP.  The idea is that the US is a net oil importer and that when the price of oil goes up it costs more to produce goods so GDP will be lower.  In its simplest form the model is:

We would expect the slope will be negative and the y intercept a positive number.  We can get the data from a number of sources.  Once source is the Economic Report of the President where we got this data.   We can put the data into Excel for the years 1959 to 2015.

Regression in Excel

We can use what we learned in the last four projects to do a regression analysis.  The first set is to get the data into a useable form.  Each of the variables need to have the same number of observations.  The data set we will use here will look like this.

The variables are:

Year                   1959 to 2015

GDP                   Gross Domestic Product

M2                     Money Supply

R                         Interest Rate (1 Year Treasury)

U                         Unemployment Rate

LR                       Labor Force Participation Rate

Oil                       Oil Price per barrel (Texas)

Ex                       Exports

We will use a number of these variables in this and the next project.  Notice that the labels are in row 1 and that there are no rows between the label and the data.  This will be important later.

The simplest way to run a regression in Excel is to use the Data Analysis box under data.

This is the same box that we used in doing descriptive statistics and histograms in past projects.  One of the selections is regression.  This is what we are going to use.  Once you select regression and click ok.

You should see the following box:

In this case select the X and Y data by going to the data set and choosing GDP for Y and OIL for X.

Notice that the Label box is checked and that the data starts with the variable names in cells B1 and G1.  Also the New Worksheet button is checked which will put the results in a new worksheet, not with the dataset.

Once you click OK a new worksheet will appear with the results.  There will be two tables one with ANOVA and the other with the regression coefficients.  These are the results we can use to test our hypothesis that when oil price rise GDP will fall.

See also  RESPOND TO THIS DISCUSSION: One effect of the Great Depression on men of color and women was a lowered standard of living due to a sharp decrease in employment opportunities.

Let’s look at the results to see what they say.  First, the Adjusted R2 is .638 (in blue) this says that the change in oil prices explain 63.8% of the change in GDP.  The F statistic (in red) is greater that the critical value – rule of thumb is if it is greater than 5 then the Adjusted R2 is statistically significant.

Next turn to the coefficients (in orange), OIL is positive and says that for every dollar oil prices rise GDP goes up by \$128 billion.  This is the opposite of what we expected.  Next we see if this coefficient is significant and it is with a t statistic of 10 (in green) – the rule of thumb for t statistics is anything greater than 2 is significant.

So what is wrong with are theory?  What might be another theory that would explain this?  (Hint: Time)

Single Functions:

If all we wanted was the coefficient  Excel has a formula for that called linest:

=LINEST(Data!B2:B58,Data!G2:G58)

Notice that data is first for Y and then for X separated by a comma.  This will return 128.05.

=INTERCEPT(Data!B2:B58,Data!G2:G58)

Will give you  5458.06 just as the data analysis does.

You can also get the R2 use a formula called RSQ:

=RSQ(Data!B2:B58,Data!G2:G58)

This returns .645 just as above.  The only problem is we have no easy way to get a t value for the parameters.

Example of a regression using functions alone.

Here we have a calculation for the t test.  In most cases using the Data Analysis Regression package will be the easiest way to obtain regression results in Excel.

Regression in SAS

So the first step is to import the data using the import function.  Remember if you are having problems importing the data using the Excel workbook option try the Excel Workbook on PC files server option

Then proceed as normal, click next, then give your data file a name like GDP.

Next you pick the worksheet with your data, remembering the first row are variable names and the second row starts the data.

The last step is to give your dataset a name so SAS can find it.

Then click Finish.  You should now have your data set ready to be used by SAS.  If you look on the far left under Explorer/Libraries/Work you should find your data with the name you gave it.  If you click on it you should see the data set.  It is always good to check.

Next, turn to the Editor on the lower right of the program where again we will write the code that runs the regression for us.  Here we will do a simple regression, just as we did in Excel.  We will look at the relationship between GDP and Oil prices.

The first set is to create a new data set GDP1 from your original dataset GDP. (Note you do not have to do this here but in the future if you want to create new variables this step will be helpful)  The second two lines give descriptive statistics, something we didn’t do in Excel but is always a good thing to do.  The last two lines run the regression for us.

PROC REG;

Calls the regression program and tells SAS to run it.

MODEL GDP=OIL;

The model statement tells SAS what the regression equation is.  (Y variable = X variables).  The run commands just make sure each part of the program runs independently.  Once you have typed in the program as pictured above click on the running man button above in SAS.  SAS will then take a few seconds and then show you the output.

The first thing not reproduced here is the univariate output which tells you the mean, median, mode and other statistics.  The PROC REG output starts and gives the ANOVA with the R2 colored in purple and the F stat in yellow.  The parameter estimates (in green) and the t statistics (in red).  Notice that they are the same numbers we obtained in Excel.

See also  How would you evaluate the difficulty of responding to the assignment prompt?- Essay Hotline Original Answers Only

SAS then gives a number of graphs to help you better understand the regression and the error terms.  These graphs allow us to see if the regression assumptions hold.  You can see if there is a relationship between the error terms, whether the errors are normally distributed and if the X (OIL) is independent of the errors.

The last graph plots the trend line and the 95% confidence level.  Again we can see the positive relationship between OIL and GDP.

With just two lines all of these results are obtained in SAS.  In the next chapter we will expand this model to have multiple X variables and use other tests to ensure we have not violated any of our assumptions.

EXAMPLE with DIFFERENCES

So we have a problem with our hypothesis.  We were expecting a negative relationship but instead it was positive.  We might be worried that over time everything goes up and this might be messing up the real relationship.  One way to see if this is true is to look at the differences in GDP, (GDP70-GDP69) and OIL (OIL70-OIL69), so we are looking at the change in GDP and OIL not GDP and OIL itself.  We saw a similar problem before when we indexed the data in our Graphing Chapter.

There are a number of ways to create differences.  First you could just do it in Excel as part of the data set.

DGDP is for difference in GDP for 1960 it is 3078.4-3052.2 =26.2.  You will do the same for DOIL expect the function will be =G3-G2.  Once you have put these into I3 and J3 you can copy this for the rest of the years.  Notice you lose one year (1959) which is blank.

You can also create the difference in SAS, here I will call the two new variables GDPD and OILD so as not to confuse them with the variables you created in Excel.

The editor program will look like this:

It is important to have the run command before you add the proc reg because you need to create the variables before you can use them.   To create the variables we use the lag command and the just do the subtraction to get the difference.  If you look at the dataset GDP1 in explore you will see that GDPD and DGDP are the same.

Now let’s look at the results from our new regression.  What can we say about the parameters and the test statistics?

The R2 has dropped to 4.36% and the F stat tells us this is not significantly different from zero, i.e., there is no relationship between GDP and oil prices.  The parameter is still positive but the t statistic says that we cannot reject the hypothesis that beta1 is zero.  So time is important and it might be that the positive relationship is because everything goes up with inflation.  This is a cautionary note, that even when the regression looks good we must be careful!

PROJECT

1. Look at the relationship between GDP and Exports. Normally we would think there should be a positive relationship.  The more you export the more money you make and the higher GDP.  Run a regression in both Excel and SAS.
2. Explain the results you obtained, specifically explain:
1. R2
2. F
3. Parameters
4. T stat

Custompaper.help is an academic writing platform that provides students and professionals with quality services to ease their assignment challenges. With a wide range of services, the platform has become one of the leading academic writing service providers in the market due to its reliability and affordability. Below, we shall discuss some of the services which Custompaper.help provides:

See also  Research and discuss one healing method using food as medicine from other cultures or religions.

Essay Writing Service
The essay writing service provides customers with quality essays on any subject or topic they requested within a given deadline. The writers at custompaper are experts in their respective fields, and they ensure customer satisfaction by producing original content with thorough research involved backed up with strong evidence from reliable sources available online or offline. All essays come with free plagiarism reports as well as revisions if needed so that customers can trust that they are getting high-quality work for their money’s worth.

Research Paper Writing Service
This is another popular service offered by custom paper help wherein customers are assisted in conducting research papers according to their needs and requirements within specified deadlines. Writers at custom paper help have vast knowledge about various topics belonging to different disciplines such as Management, Arts & Humanities, History etc., allowing them to craft impeccable research papers every time regardless of the complexity or urgency level requested by customers. Additionally, all our research papers come along with proper citation formats which ensures customer’s safety when it comes to plagiarism issues while also helping them save time on formatting procedures thus improving overall efficiency even further!

Dissertation Writing Service
CustomPaperHelp also offers dissertation writing assistance for those who need it most – students preparing for graduation or professionals wanting to further refine their skills through higher education levels such as Master/PhD degrees etc, Our team of writers consists of experienced individuals having Master’s/PhD degrees themselves so you can rest assured that your dissertation will be handled expertly from the start till the end! Furthermore, we offer unlimited revisions until your complete satisfaction is achieved, along with regular checkups being done throughout the process just so everything goes according to course without any hiccups!

If you already have written an essay but want professional feedback before submitting it, then CustomPaperHelp also offers editing & proofreading services which helps in identifying & rectifying errors present in assignments like grammar mistakes, spelling mistakes, punctuation problems etc., thereby ensuring top-notch quality work, before submission takes place! We understand how important accuracy & consistency are when it comes to grading systems used at universities nowadays, so taking extra care during this phase becomes absolutely essential if good grades are desired afterward!

Coursework Help
For those who find coursework difficult due to complications of being quite technical in nature; CustomPaperHelp extends its support here too, by providing quality solutions every single time – starting from understanding concepts properly up until composing flawless answers following university guidelines closely enough making sure no loopholes remain whatsoever! Whether it’s related math problem-solving algorithms or lengthy home assignments – our expert panel has got you covered from head-to-toe leaving no stone unturned during this very crucial stage since final grades depend largely upon the success rate achieved here successfully!

Assignment Help
Assignments form an integral part of getting better scores & ultimately, a degree itself (in case pursuing a masters/PhD) – something only possible if precision is made a priority right away; otherwise, chances of failure increase exponentially over a time period detrimentally affecting performance evaluation systems later down road drastically hence stressing timely importance completion prior commencement other operations associated same project altogether consistently meeting high standards expected each situation respectively! Here too, CustomPaperHelp presents comprehensive solution package exceeding expectations beyond point offering optimal values therein ensuring maximum satisfaction reached under circumstances prevailing accordingly without fail…proving once more why people trust us implicitly without second thought whatsoever!!

Pages (550 words)
Approximate price: -

Why Choose Us

Quality Papers

We value our clients. For this reason, we ensure that each paper is written carefully as per the instructions provided by the client. Our editing team also checks all the papers to ensure that they have been completed as per the expectations.

Over the years, our Acme Homework has managed to secure the most qualified, reliable and experienced team of writers. The company has also ensured continued training and development of the team members to ensure that it keep up with the rising Academic Trends.

Affordable Prices

Our prices are fairly priced in such a way that ensures affordability. Additionally, you can get a free price quotation by clicking on the "Place Order" button.

On-Time delivery

We pay strict attention on deadlines. For this reason, we ensure that all papers are submitted earlier, even before the deadline indicated by the customer. For this reason, the client can go through the work and review everything.

100% Originality

At Custom Paper Help, all papers are plagiarism-free as they are written from scratch. We have taken strict measures to ensure that there is no similarity on all papers and that citations are included as per the standards set.

Our support team is readily available to provide any guidance/help on our platform at any time of the day/night. Feel free to contact us via the Chat window or support email: support@acmehomework.com.

Try it now!

## Calculate the price of your order

We'll send you the first draft for approval by at
Total price:
\$0.00

How it works?

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Our Services

Custom Paper Help has stood as the world’s leading custom essay writing services providers. Once you enter all the details in the order form under the place order button, the rest is up to us.

## Essay Writing Services

At Custom Paper Help, we prioritize on all aspects that bring about a good grade such as impeccable grammar, proper structure, zero-plagiarism and conformance to guidelines. Our experienced team of writers will help you completed your essays and other assignments.