代写 R statistic Non- Parametric Methods

Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
Quantitative Risk Management: Lecture 11 Non-parametric Methods 1
Tim Bailey
Nottingham University Business School
1/13

Outline
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
Non-Parametric Methods
2/13

Outline
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
Non-Parametric Methods
Non-Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
2/13

Outline
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
Non-Parametric Methods
Non-Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
2/13

Non-Parametric Statistics
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
3/13

Non-Parametric Statistics
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 No assumption made regarding what specific model generates the data
3/13

Non-Parametric Statistics
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 No assumption made regarding what specific model generates the data
􏰀 Hence no parametric model to fit to data
3/13

Non-Parametric Statistics
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 No assumption made regarding what specific model generates the data
􏰀 Hence no parametric model to fit to data
􏰀 Many variants of Non-parametric Methods –
smoothing (regression, density estimation) – illustrative examples shortly.
3/13

Non-Parametric Statistics
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 No assumption made regarding what specific model generates the data
􏰀 Hence no parametric model to fit to data
􏰀 Many variants of Non-parametric Methods –
smoothing (regression, density estimation) –
illustrative examples shortly.
􏰀 We focus on Non-Parametric Simulation – specifically Historical Simulation:
3/13

Non-Parametric Statistics
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 No assumption made regarding what specific model generates the data
􏰀 Hence no parametric model to fit to data
􏰀 Many variants of Non-parametric Methods –
smoothing (regression, density estimation) –
illustrative examples shortly.
􏰀 We focus on Non-Parametric Simulation – specifically Historical Simulation:
􏰀 Basic Historical Simulation (Single asset, two assets)
3/13

Non-Parametric Statistics
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 No assumption made regarding what specific model generates the data
􏰀 Hence no parametric model to fit to data
􏰀 Many variants of Non-parametric Methods –
smoothing (regression, density estimation) –
illustrative examples shortly.
􏰀 We focus on Non-Parametric Simulation – specifically Historical Simulation:
􏰀 Basic Historical Simulation (Single asset, two assets)
􏰀 (and a bit on bootstrapping)
3/13

Non-Parametric Regression
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Linear regression shown in red Nonparametric regression
●●




●●
●●● ●●



●● ●



● ●●●



2345
Car Weight

●●
4/13
Miles Per Gallon
10 15 20 25 30

Non-Parametric Regression
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Linear regression shown in red
􏰀 Non-parametric regression in blue.
Nonparametric regression
●●




●●
●●● ●●



●● ●



● ●●●



2345
Car Weight

●●
4/13
Miles Per Gallon
10 15 20 25 30

Non-Parametric Density Estimation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
5/13

Non-Parametric Density Estimation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Could the underlying density ‘really’ be represented by a smoother relationship?
5/13

Non-Parametric Density Estimation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Could the underlying density ‘really’ be represented by a smoother relationship?
􏰀 Leads to idea of nonparametric density estimation – kernel based estimates.
5/13

Non-Parametric Density Estimation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Could the underlying density ‘really’ be represented by a smoother relationship?
􏰀 Leads to idea of nonparametric density estimation – kernel based estimates.
􏰀 Here, estimated density is the vertical sum of 6 identical gaussians. [Source Wiki!]
5 / 13

Historical Simulation: Single Asset
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
6/13

Historical Simulation: Single Asset
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 From Lec 8 we have the basic mapping from returns to Loss:
Loss = −Pt × Rt
ie the loss is the negative of the current portfolio value times the returns.
6/13

Historical Simulation: Single Asset
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀
􏰀
From Lec 8 we have the basic mapping from returns to Loss:
Loss = −Pt × Rt
ie the loss is the negative of the current portfolio value times the returns.
With HS we use the historical returns of the asset for Rt.
Historical Returns Rt
Predicted Losses
-Pt x Rt
(Pt = 1000)
6/13

Historical Simulation: Single Asset
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀
􏰀
From Lec 8 we have the basic mapping from returns to Loss:
Loss = −Pt × Rt
ie the loss is the negative of the current portfolio value times the returns.
With HS we use the historical returns of the asset for Rt.
Historical Returns Rt
Predicted Losses
-Pt x Rt
(Pt = 1000)
6/13

Historical Simulation: Single Asset
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀
􏰀
From Lec 8 we have the basic mapping from returns to Loss:
Loss = −Pt × Rt
ie the loss is the negative of the current portfolio value times the returns.
With HS we use the historical returns of the asset for Rt.
Historical Returns Rt
Predicted Losses
-Pt x Rt
(Pt = 1000)
6/13

Historical Simulation: Single Asset
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀
􏰀
From Lec 8 we have the basic mapping from returns to Loss:
Loss = −Pt × Rt
ie the loss is the negative of the current portfolio value times the returns.
With HS we use the historical returns of the asset for Rt.
Historical Returns Rt
Predicted Losses
-Pt x Rt
(Pt = 1000)
6/13

Historical Simulation: Single Asset
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀
􏰀
From Lec 8 we have the basic mapping from returns to Loss:
Loss = −Pt × Rt
ie the loss is the negative of the current portfolio value times the returns.
With HS we use the historical returns of the asset for Rt.
Historical Returns Rt
Predicted Losses
-Pt x Rt
(Pt = 1000)
6/13

Historical Simulation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 With the resulting discrete set of losses, we can measure risk as per Lecture 4.
Histogram of DAX portfolio losses
Frequency
0 200 400 600 800
−50 0 50 100
d.loss
VaR95 = 15.92 ES95 = 23.99
7/13

Historical Simulation: Two Assets
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
8/13

Historical Simulation: Two Assets
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 From Lec 5 we have the basic mapping from returns to Loss:
Loss=−P ×( ×R + ×R ) t A At B Bt
8/13

Historical Simulation: Two Assets
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 From Lec 5 we have the basic mapping from returns to Loss:
Loss = −Pt × (A × RAt + B × RBt)
􏰀 With HS we use the historical returns of both
assets for R
At
and R
Bt
.
Historical Returns Predicted Losses Dax FTSE
-Pt x (wA x RAt + wB x RBt)
Using:
Pt = 1000 wA = 0.75 wB = 0.25
8/13

Historical Simulation: Two Assets
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 From Lec 5 we have the basic mapping from returns to Loss:
Loss = −Pt × (A × RAt + B × RBt)
􏰀 With HS we use the historical returns of both
assets for R
At
and R
Bt
.
Historical Returns Predicted Losses Dax FTSE
-Pt x (wA x RAt + wB x RBt)
Using:
Pt = 1000 wA = 0.75 wB = 0.25
8/13

Historical Simulation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 With the resulting discrete set of losses, we can again measure risk as per Lecture 4.
Histogram of DAX/FTSE Portfolio losses
Frequency
0 200 400 600 800
−40 −20 0 20 40 60 80
df.loss
VaR95 = 14.23 ES95 = 19.31
9/13

Historical Simulation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
10/13

Historical Simulation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Benefits of approach
10/13

Historical Simulation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Benefits of approach
􏰀 Letting data drive estimation
10/13

Historical Simulation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Benefits of approach
􏰀 Letting data drive estimation
􏰀 No (false) distributional assumptions about returns.
10/13

Historical Simulation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Benefits of approach
􏰀 Letting data drive estimation
􏰀 No (false) distributional assumptions about returns.
􏰀 Outlying (dangerous) returns are represented in loss distribution, whereas they might be ignored
with parametric estimation.
10/13

Historical Simulation
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 Benefits of approach
􏰀 Letting data drive estimation
􏰀 No (false) distributional assumptions about returns.
􏰀 Outlying (dangerous) returns are represented in loss distribution, whereas they might be ignored
with parametric estimation. 􏰀 Problems?
10/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
11/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 One problem with NP approach- there is no sampling variation, and no inference possible, nor needed.
11/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 One problem with NP approach- there is no sampling variation, and no inference possible, nor needed.
􏰀 Bootstrap gives way of understanding how precise/imprecise the estimates are.
11/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 One problem with NP approach- there is no sampling variation, and no inference possible, nor needed.
􏰀 Bootstrap gives way of understanding how precise/imprecise the estimates are.
􏰀 Approach – the data we observe is just one possible set of data
11/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 One problem with NP approach- there is no sampling variation, and no inference possible, nor needed.
􏰀 Bootstrap gives way of understanding how precise/imprecise the estimates are.
􏰀 Approach – the data we observe is just one possible set of data
􏰀 Other sets of data possible to acquire – by repeatedly sampling from the data
11/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 One problem with NP approach- there is no sampling variation, and no inference possible, nor needed.
􏰀 Bootstrap gives way of understanding how precise/imprecise the estimates are.
􏰀 Approach – the data we observe is just one possible set of data
􏰀 Other sets of data possible to acquire – by
repeatedly sampling from the data 􏰀 Two points
11/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 One problem with NP approach- there is no sampling variation, and no inference possible, nor needed.
􏰀 Bootstrap gives way of understanding how precise/imprecise the estimates are.
􏰀 Approach – the data we observe is just one possible set of data
􏰀 Other sets of data possible to acquire – by repeatedly sampling from the data
􏰀 Two points
􏰀 Each sample is the same size as the original data
11/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 One problem with NP approach- there is no sampling variation, and no inference possible, nor needed.
􏰀 Bootstrap gives way of understanding how precise/imprecise the estimates are.
􏰀 Approach – the data we observe is just one possible set of data
􏰀 Other sets of data possible to acquire – by repeatedly sampling from the data
􏰀 Two points
􏰀 Each sample is the same size as the original data 􏰀 Sampling is done with replacement. Thus samples
will differ. Thus Risk Measures will differ.
11/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 One problem with NP approach- there is no sampling variation, and no inference possible, nor needed.
􏰀 Bootstrap gives way of understanding how precise/imprecise the estimates are.
􏰀 Approach – the data we observe is just one possible set of data
􏰀 Other sets of data possible to acquire – by repeatedly sampling from the data
􏰀 Two points
􏰀 Each sample is the same size as the original data 􏰀 Sampling is done with replacement. Thus samples
will differ. Thus Risk Measures will differ.
􏰀 for each sample, calculate statistic of interest (eg
VaR)
11/13

The Bootstrap
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 One problem with NP approach- there is no sampling variation, and no inference possible, nor needed.
􏰀 Bootstrap gives way of understanding how precise/imprecise the estimates are.
􏰀 Approach – the data we observe is just one possible set of data
􏰀 Other sets of data possible to acquire – by repeatedly sampling from the data
􏰀 Two points
􏰀 Each sample is the same size as the original data 􏰀 Sampling is done with replacement. Thus samples
will differ. Thus Risk Measures will differ.
􏰀 for each sample, calculate statistic of interest (eg
VaR)
􏰀 This way, can learn about the distribution of the
statistic.
11/13

The Bootstrap: illustration
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
12/13

The Bootstrap: illustration
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 For the single asset, the Var95 estimate from the original population was Var95 = 15.91793.
12/13

The Bootstrap: illustration
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 For the single asset, the Var95 estimate from the original population was Var95 = 15.91793.
􏰀 Bootstrapping 1000 times gives Bootstrapped VaR95
14 15 16 17 18 19
VaR 95
12/13
Frequency
0 20 40 60 80 100

The Bootstrap: illustration
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 For the single asset, the Var95 estimate from the original population was Var95 = 15.91793.
􏰀 Bootstrapping 1000 times gives Bootstrapped VaR95
14 15 16 17 18 19
VaR 95
􏰀 Vertical line is original estimate
12/13
Frequency
0 20 40 60 80 100

The Bootstrap: illustration
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 For the single asset, the Var95 estimate from the original population was Var95 = 15.91793.
􏰀 Bootstrapping 1000 times gives Bootstrapped VaR95
14 15 16 17 18 19
VaR 95
􏰀 Vertical line is original estimate
􏰀 Note variation in VaR with alternative samples.
12/13
Frequency
0 20 40 60 80 100

The Bootstrap – illustration
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
13/13

The Bootstrap – illustration
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 For the two asset portfolio, the Var95 estimate from the original population was
Var95 = 14.22643
13/13

The Bootstrap – illustration
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 For the two asset portfolio, the Var95 estimate from the original population was
Var95 = 14.22643
􏰀 Bootstrapping 1000 times gives Bootstrapped VaR95
12 13 14 15 16
VaR 95
13/13
Frequency
0 50 100 150

The Bootstrap – illustration
Non- Parametric Methods
Non- Parametric Methods – examples
Non-Parametric Regression Non-Parametric Density Estimation
Historical Simulation
􏰀 For the two asset portfolio, the Var95 estimate from the original population was
Var95 = 14.22643
􏰀 Bootstrapping 1000 times gives Bootstrapped VaR95
12 13 14 15 16
VaR 95
􏰀 Vertical line is original estimate
13/13
Frequency
0 50 100 150