Forecasting and Business Analysis
29/07/13
1
Forecas0ng and Business Analysis
Introduc0on, Data Handling and Correla0on Lecture 1
• Lecturer: Dr Patricia Sourdin [email protected] • Tutor Mr Minh Nguyen [email protected]
Admin
• Lectures: 5 pm– 7 pm, Thursday
• Tutorials: you need to be enrolled in one of the tutorials
29/07/13
2
Admin
• Your textbook
Course website
Features: • Course informa0on booklet • Lecture slides • Online forum • Assessment informa0on • Study guide and data sets to help you prepare for tutorials
Assessment
Three pieces of assessment: -‐-‐ Assignment 1 (20%) due 13 September 2013 -‐-‐ Assignment 2 (20%) due 8 November 2013 -‐-‐ Final Exam (60%) Please look at course outline for specific instruc0ons and rules related to pass marks.
29/07/13
3
Prerequisites
This course REQUIRES successful comple0on of the following courses: –Either Sta0s0cs for Business (MATH 1052) or Quan0ta0ve Methods for Business (Math 1053) and –Either Principles of Economics (ECON 1008), or Microeconomics (ECON 1006), or Macroeconomics (ECON 1007). If you do not have these courses you will be de-‐ enrolled automa0cally.
What you need.
• This course builds upon your previous study, and therefore we assume you have acquired knowledge of the following: –Basic MS Excel –Fundamental economic theory and logic –Basic algebraic techniques –Basic concepts from sta0s0cs, such as parameter es0ma0on and sta0s0cal tes0ng
• You will need regular access to a computer with MS Excel installed
What FBA will do for you • Introduce you to a range of quan0ta0ve analysis techniques and their limita0ons
• Take you from being able to compile and summarise data in a very basic way towards more sophis0cated analysis –Provide you with prac0cal forecas0ng and quan0ta0ve skills that can be applied in business, government, and academic research
• These tools are highly sought by employers
29/07/13
4
Examples of ques0ons that can be answered using the techniques you will
acquire • Do lower speed limits save lives? • How much is a university degree worth in the labour market?
• Does campaign spending influence elec0on outcomes?
• Does economic development lead to less or more environmental damage?
• Why are some countries so poor and others so rich? • What is the likely effect of a marke0ng campaign on sales?
This week
• Topic 1a – Brief Review – Review some basic concepts from maths and sta0s0cs
• Topic 1b -‐ Data Handling. – Data types, graphical methods, descrip0ve stats – mean and variance
• Topic 1c – Probability distribu0ons • Topic 1d – Correla0on – Defini0on, correla0on table
Topic 1a
Review and concepts from maths and sta0s0cs
29/07/13
5
Func0onal Nota0on
• Ogen we are interested in the rela0onship between 2 or more variables, which is ogen denoted using the concept of a func0on
• Read: “Y is a func0on of X” • X can be one variable, or it can be a vector of many variables
Y = f X( )
Equa0on of a Straight Line • Any straight line can be expressed as:
• where α (y-‐intercept) and β (slope of the line) are values which determine the quan0ta0ve rela0onship between X and Y.
• β is the amount Y changes when X changes by one unit
• Explain the intui0on of β=0.5, β=-‐0.75??
Y = α + βX
Logarithms • The logarithm is a common way of transforming a variable in business analysis
• The logarithm of A is the power to which B (a base value) must be raised to give the value A
• For example, if B = 9 and A = 81 then the logarithm is 2, expressed as log9(81) = 2
• Ogen we use the natural logarithm, where B = e (e, a mathema0cal constant, is approximately equal to 2.718)
• For example, if GDP = 243 then loge(243) = ln(243) = 5.493
29/07/13
6
Ln(A) in Excel
• To calculate the natural logarithm of a number in Excel, use “=LN(number)”
• To return that result back to the original number, use “=EXP(number)” (this is called “exponen0a0on”)
• Both opera0ons can also be done using a calculator
Where we are headed
• This week we’ll discuss data types, handling, correla0on analysis, and other simple procedures -‐ and then move on to basic 0me-‐series forecas0ng techniques
• This will be followed by an introduc0on to cross-‐ sec0onal regression, and then 0me-‐series regression – which together will take up the bulk of the course
• During the course, we’ll focus on how the techniques we have discussed can be used in real-‐world forecas0ng and data analysis
What does regression have to do with “Forecas0ng”???
• The course does have some maths in it. Don't panic!
• We will focus on regression: regression is a sta/s/cal technique
• Despite many rumours, neither math nor sta0s0cs is an evil thing: they are TOOLS, which are used EVERYWHERE in business and elsewhere
29/07/13
7
What does regression have to do with “Forecas0ng”??? (con0nued)
• A forecast is a predicted outcome. The predic0on may be: –Of an aggregate “macro” variable (e.g., unemployment) –Of a “micro” variable (e.g., sales) –Based on opinion, theory, data analysis, or some combina0on of these three
• Regressions yield predic0ons – this is why they are used heavily in forecas0ng
More about forecas0ng
• Forecas0ng helps businesses and governments make decisions in the face of uncertainty
• Virtually all governments forecast macroeconomic indicators such as unemployment, consumer spending, popula0on growth, and GDP
• Forecasts are constructed at na0onal, regional, state and local levels, and inform public and private policy (resource alloca0on) at every level
• Some of the data used to develop such forecasts are confiden0al, and some come from government agencies and departments (like the ABS)
Examples We have just seen a major economic event. The “global financial crisis” –What will GDP growth be this year? –How will sales of my company’s goods do this year? –What will the level of unemployment be? –What will happen to house prices? –Will wages fall? –What will happen to a par0cular stock price? What will happen to stock prices in general?
29/07/13
8
A note on cross-‐sec0onal versus 0me series predic0ons
• We interpret a “forecast” broadly as a “predic0on” in this course
• The predic0on can be for future 0me periods (using 0me series data)
• A predic0on can also be constructed using cross-‐sec0onal data
Topic 1b
Data handling
Subscripts and Summa0on
• Subscripts are used to denote different observa0ons of a variable
• Conven0onally, we use subscript i for cross-‐sec0onal observa0ons (i.e. states, individuals, etc), and t for 0me series observa0ons (i.e. years, months, quarters)
• Say we had data for GDP (Y) over a 10 year period, with one observa0on for GDP (Y) in year 1, another in year 2, etc.
• The individual values of Y can be expressed as Y1 (= GDP in year one), Y2 ( = GDP in year 2), all the way up to Y10, or {Yt} where t = 1 to 10
29/07/13
9
…con0nued
• We can then write Yt to denote any individual observa0on of GDP
• If you are interested in calcula0ng the average of GDP over the ten-‐year period, then you first want to add up (or sum) over all the observa0ons
• Use the summa0on operator, capital sigma:
Yt = Y1 +Y2 +…Y10t=1 10
∑
Data Types
Types of Data: –0me series data (Yt for t=1,…,T) –cross-‐sec0onal data (Yi for i=1,…,N) –panel data (Yit for i=1,..,N and t=1,…,T)
Cross-‐sec0onal vs 0me-‐series data
• Cross-‐sec0onal data are observa0ons on one or more unit-‐level variables collected at a single point in 0me -‐-‐ Repeated cross-‐sec0ons: cross-‐sec0onal data on variables that are roughly comparable and observed at successive 0me periods (but NOT for the same sample)
• A “0me series” is a series of observa0ons on one variable over successive periods of 0me
29/07/13
10
Cross-‐sec0onal example Household Yearly Household Yearly Household number spending income
1 30,000 100,000 2 40,000 70,000 3 80,000 60,000 4 100,000 250,000 5 30,000 25,000 6 15,000 20,000 7 40,000 60,000 8 50,000 50,000 9 80,000 90,000 10 20,000 100,000 … … … 100 30,000 40,000
Time-‐series data Time Period Median house price 1 100,000 2 150,000 3 150,000 4 155,000 5 157,000 6 200,000 7 210,000 8 150,000 9 200,000 10 205,000 … … 100 250,000
Panel data example Time Period State # Road Accidents 1 NSW 46 1 WA 31 1 Vic 19 2 NSW 52 2 WA 47 2 Vic 17 3 NSW 49 3 WA 37 3 Vic 14 … … …
29/07/13
11
Variable types Categorical
–Nominal scale: one-‐to-‐one or many-‐to-‐one mapping of categories into numerical “dummies”
–Ordinal scale: numbers assigned to categories reflect an inherent ranking Numerical
–Discrete (binary or mul0nomial); ogen equivalent to ordinal categorical variables – e.g., number of bedrooms in a house
–Con0nuous Most variables we wish to forecast are numerical
Commonly used transforma0ons
• Levels versus Growth Rates –Example: Might be more interested in growth of GDP as opposed to levels
Growth Rates: •Log transforma0ons •Propor0ons – e.g., the propor0on of people in Australia with a university degree •Index (eg. CPI). See Sect 2.1 Koop.
Yt −Yt−1( ) Yt−1
×100
Graphical methods
29/07/13
12
Time series • Retail trade over 0me
Histograms
• Example ques0ons: –“What is the distribu0on of income across
countries?” –“What is the extent of global inequality?”
• Related to the idea of a distribu0on. • Data to use: real GDP per capita in 1992 for 90 countries measured in $US.
Construc0ng a Histogram: Step 1
• Construct “class intervals” (“bins”).
• Real GDP per capita in our data set varies from $408 in Chad to $17,945 in the U.S.
• Class intervals must include these extremes.
• One choice of class intervals (of many choices possible):
29/07/13
13
Step 2: Calculate frequencies.
• Count the number of countries whose GDP per capita falls into each bin.
Step 3: Make a bar chart
• Make a bar chart, with the bins on the x-‐axis, and frequency on the y-‐axis.
XY Graph (cross-‐sec0onal) • Example: Deforesta0on and Popula0on density for 70 tropical countries.
• Ques0on of interest: –“Do countries with high popula0on density also tend to have high deforesta0on rates?”
• Plot of one variable versus another (e.g. deforesta0on on y-‐axis, popula0on density is on x-‐axis).
• Each point on graph represents deforesta0on and popula0on density for one country.
29/07/13
14
Sca|erplot Example
XY plot of popula0on density against deforesta0ons
Interpreta0on of XY-‐plots
•There seems to be a posi0ve rela0onship between deforesta0on and popula0on density •Countries with low popula0on density also tend to have low deforesta0on rates (i.e. low-‐low) •Countries with high popula0on density also tend to have high deforesta0on rates (i.e high-‐high) •Outliers: countries which do not fit the “general pa|ern”.
Descrip0ve sta0s0cs
29/07/13
15
Descrip0ve Sta0s0cs
• Example (con0nued): real GDP per capita for 90 countries.
• A histogram graphically summarises the cross-‐ country income distribu0on.
• Descrip0ve sta0s0cs are numbers which summarise proper0es of the income distribu0on.
1. Measures of Loca0on
• Intui0on: centre of distribu0on, average, “typical country” (careful!!). We can calculate the sample’s value – not the popula0on value.
• Sample mean:
• Mean GDP per capita is $5,443.80 in this sample • Median or mode is ogen useful for skewed data
Y = Yi
i=1
N
∑ N
2. Measures of dispersion
• Intui0on: spread/variability/dispersion of distribu0on; inequality across observa0ons. Again – calculated for the sample at hand.
• Standard devia0on:
• Variance = standard devia0on squared
s = Yi −Y( )
2∑ N −1
29/07/13
16
Topic 1c
Probability distribu0ons
Random variables • A random variable is a variable whose value is unknown un0l it is observed; in other words it is a variable that is not perfectly predictable – Each random variable has a set of possible values it can take
– A discrete random variable can take only a limited, or countable, number of values • An indicator variable taking the values one if yes, or zero if no • Indicator variables are discrete and are used to represent qualita0ve characteris0cs such as gender (male or female), or race (white or nonwhite)
– A random variable that can have any value is treated as a conMnuous random variable
• Probability is usually defined in terms of experiments – If we were to select one cell from the table at random, that would cons0tute a random experiment
29/07/13
17
• We summarize the probabili0es of possible outcomes using a probability density func0on (pdf ) – The pdf for a discrete random variable indicates the probability of each possible value occurring
– For a discrete random variable X the value of the probability density func0on f(x) is the probability that the random variable X takes the value x, f(x) = P(X = x) • It must be true that 0 ≤ f(x) ≤ 1
f(x1) + f(x2) + … + f(xn) = 1
PDF of a discrete random variable
PDF of a discrete random variable
29/07/13
18
PDF of con0nuous RV
Proper0es of PDF
• Two key features of a probability distribu0on are its center (loca0on) and width(dispersion) – A key measure of the center is the mean, or expected value
– Measures of dispersion are variance, and its square root, the standard deviaMon
Expected value
• The mean of a random variable is given by its mathemaMcal expectaMon – If X is a discrete random variable, then the mathema0cal expecta0on, or expected value, of X is:
E X( ) = x1P X = x1( )+ x2P X = x2( )++ xnP X = xn( )
29/07/13
19
• For the popula0on in our table, the expected value of X is:
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 1 1 2 2 3 3 4 4
1 0.1 2 0.2 3 0.3 4 0.4 3
E X P X P X P X P X= × = + × = + × = + × =
= × + × + × + × =
• The mean of a random variable is the populaMon mean – We use Greek le|ers for populaMon parameters
• The expected value can be wri|en equivalently as:
µX = E X( ) = x1 f x1( )+ x2 f x2( )++ xn f xn( ) = xi f xi( )
i=1
n
∑ = xf x( )
x ∑
• For our example:
( ) ( )
( ) ( ) ( ) ( )
4
1 µ
1 0.1 2 0.2 3 0.3 4 0.4 3
X i
E X xf x =
= =
= × + × + × + × =
∑
29/07/13
20
Proper0es of expecta0ons
• If a is a constant, then g(X) = aX is a func0on of X, and:
• If a and b are constants, then:
( ) ( ) ( ) ( )
( ) ( )
( )
x
x x
E aX E g X g x f x
axf x a xf x
aE X
⎡ ⎤= =⎣ ⎦
= =
=
∑ ∑ ∑
( ) ( )E aX b aE X b+ = +
• The expected value of the random variable is the average value that occurs in many repeated trials of an experiment
Variance of a random variable
• The variance of a discrete or con0nuous random variable X is the expected value of:
Algebraically: ( ) ( ) 2g X X E X⎡ ⎤= −⎣ ⎦
( ) ( ) ( ) ( ) ( ) ( )
22
2 2
2 2
2 2
var σ µ
2µ µ
2µ µ
µ
XX E X
E X X
E X E X
E X
= = −
= − +
= − +
= −
29/07/13
21
• For our problem, we know that E(X) = μ = 3 – Now:
– Then:
– The square root of the variance is called the standard deviaMon
( ) ( ) ( ) ( ) 4 4
2 2
1 1
2 2 2 21 0.1 2 0.2 3 0.3 4 0.4
10
i i E X g x f x x f x
= =
= =
⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤= × + × + × + ×⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ =
∑ ∑
( ) ( )2 2 2 2var σ µ 10 3 1XX E X= = − = − =
• 2 PDF with different variances
Property of variances
• A useful property of variances is the following – Let a and b be constants, then:
– To see this, let Y = aX + b. Then: ( ) ( )2var varaX b a X+ =
( ) ( ) ( ) ( )( ) ( ) ( )
( ) ( )
22
2 22
22
2
var var µ µ
µ µ
µ
var
Y X
X X
X
aX b Y E Y E aX b a b
E aX a E a X
a E X
a X
⎡ ⎤⎡ ⎤+ = = − = + − +⎢ ⎥⎣ ⎦ ⎣ ⎦ ⎡ ⎤ ⎡ ⎤= − = −⎣ ⎦ ⎣ ⎦ ⎡ ⎤= −⎣ ⎦
=
29/07/13
22
Rules of expected values
64
• E(c) = c
• E(X+c)=E(X)+c
• E(cX)=cE(X)
July 13
Rules of Variance
65
• V(c)=0
• V(X+c)=V(X)
• V(cX)=c2V(X)
July 13
Histogram of a normally-‐distributed variable
29/07/13
23
PDF of the normal distribu0on
Topic 1d
Correla0on
Defini0on of correla0on
• Correla0on measures numerically the rela0onship between two variables X and Y (e.g., popula0on density and deforesta0on).
• Correla0on between X and Y is symbolised by the correla0on coefficient “r” or “rXY”.
r = Yi −Y( ) Xi − X( )∑
Yi −Y( ) 2∑ Xi − X( )
2∑
29/07/13
24
Coefficient of correla0on values
Coefficient of correla0on and XY plots
Why are variables correlated? Correla0on does not imply causality!!!! Example: • Correla0on between educa0on and wages is strong & posi0ve • Does this mean educa0on “causes” higher wages? • Possibility 1: Educa0on improves skills, skilled workers get be|er
paying jobs, and therefore educa0on causes wages to increase • Possibility 2: Some individuals are born with high innate ability,
which makes it easier for such individuals to pursue more educa0on and to be more produc0ve on the job. Innate ability (not educa0on) causes wages to increase.
• NEED AN UNDERLYING THEORY TO BRING TOGETHER!
29/07/13
25
Correla0on with several variables
• Correla0on relates precisely two variables • What to do with three or more? Usually use regression.
• Or you can calculate the correla0on between every possible pair of variables.
• Given three variables: X, Y and Z, we can calculate three correla0ons: –rxy, rxz and ryz
Correla0on matrix
A correla0on matrix shows the correla0on between each variable and each other variable in a sample.
Conclusions
• Appropriate data descrip0on is a necessary first step before ANY modelling
• How you describe data depends on what sort of data you’re describing
• Correla0on can be sugges0ve, but alone cannot establish causality –Correla0on + a sensible theory suggests (does not prove but provides evidence of) a
causal rela0onship
29/07/13
26
Study
• Keep up with the readings, • Prepare for your tutorials: –There is independent work that must be completed by you prior to tutorials, if you wish to par0cipate in this learning experience –Please don’t come to tutorials if you have not prepared
Next topic…
• Begin looking at simple regression analysis