WOW !! MUCH LOVE ! SO WORLD PEACE !
Fond bitcoin pour l'amélioration du site: 1memzGeKS7CB3ECNkzSn2qHwxU6NZoJ8o
  Dogecoin (tips/pourboires): DCLoo9Dd4qECqpMLurdgGnaoqbftj16Nvp


Home | Publier un mémoire | Une page au hasard

 > 

Risque de marché et théorie des valeurs extrêmes

( Télécharger le fichier original )
par Jean MEILHOC
Institut des hautes études économiques et commerciales - Master II - Capital Markets 2012
  

précédent sommaire suivant

Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy

E. VISUAL BASIC APPLICATION : LOI DE VALEURS EXTRÊMES

'Indicateur de Hill (Pour Fréchet uniquement)

Function Hill(rank As Double, Nb As Double) As Double

medianrank = (1 / (1 - ((rank - 0.44) / (Nb + 0.12))))

Hill = WorksheetFunction.Ln(WorksheetFunction.Ln(medianrank))

End Function

'Gumbel

Function Gumbel(x As Double, a As Double, b As Double) As Double

If b <= 0 Then

Call MsgBox("b doit être strictement positif", vbExclamation, "Paramètre incorrect")

Exit Function

End If

Gumbel = Exp(-(x - a) / b) * Exp(-Exp(-(x - a) / b)) / b

End Function

'Fréchet

Function Fréchet(x As Double, a As Double, b As Double) As Double

If x <= 0 Then

FrÉchet = 0

Exit Function

End If

If b <= 0 Then

Call MsgBox("b doit être strictement positif", vbExclamation, "Parametre incorrect")

Exit Function

End If

Fréchet = a / b * (b / x) ^ (a + 1) * Exp(-(b / x) ^ a)

End Function

'Weibull

Function Weibull(x As Double, a As Double, b As Double) As Double

If x <= 0 Then

Weibull = 0

Exit Function

End If

Weibull = a / b ^ a * x ^ (a - 1) * Exp(-(x / b) ^ a)

End Function

F. VISUAL BASIC APPLICATION : LOI DE PROBABILITÉ

Option Explicit

'ETAPE 1: COPIER ET TRIER

'Dans cette section, nous allons copier le nombre de série pour les trier, dans le but de dessiner la fonction de distribution cumulée

' La variable "Total" nous donne le nombre de donnÉe existante

Public Sub Copy_and_Sort()

Dim Total As Integer

Let Total = Range("Total").Value

' Copier dans un tableau reconfiguré de Total lignes et de 1 colonne

Let Range("Y1").Resize(Total, 1) = Range("Selection").Resize(Total, 1).Value

' Trier les données copiées

Call Range("Y1").Resize(Total, 1).Sort(Key1:=Range("Y1").Resize(Total, 1), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortTextAsNumbers)

End Sub

'ETAPE 2: DEFINIR L'INTERVAL DE DISTRIBUTION

'Dans cette section, l'intervalle est défini afin que celui-ci soit le plus large possible en aberrant les cases vides

'La variable "Interval" est donnée 10 quand la borne inférieure "borneinf" est Égale 0

'La fenêtre "step" est Égale à 0,1

'La variable "case_vide" est ici exprimée "as boolean", c'est à dire soit "Vrai" Il n'y a pas de case vide, soit "Faux" il y a des cases vides

Public Sub Intervallecorrespondant()

Const Interval = 10

Const borne_inf = 0

Const Step = 0.1

Dim intervalleconfiance As Double

Let intervalleconfiance = Interval

Dim case_vide As Boolean

' Montre la dimension de l'intervalle du plus grand au plus petit

' S'arrête lorsque l'ensemble des cases de sont pas vides, ou, par sécurité, lorsque la taille de l'intervalle est Égale à 0

Do

Let Range("Intervalleconfiance").Value = intervalleconfiance

Call Application.Calculate

Dim minimum As Integer

Let minimum = Application.WorksheetFunction.Min(Range("Distributions"))

Let case_vide = (minimum > 0) ' Vrai si le minimum >= 1

Let intervalleconfiance = intervalleconfiance - Step ' Boucle

Loop Until case_vide Or intervalleconfiance <= borne_inf

End Sub

'ETAPE 3: FONCTION DE DISTRIBUTION

'Dans cette section, nous allons créer une fonction afin de faciliter les calculs de fonction de distribution

' Somme des returns (Ln(t) / Ln(t-1))

' Les champs doivent être vertical avec le meme nombre de ligne

Public Function SumAbsLn(ByRef valeurscourrantes As Range, ByRef DJIA As Range) As Double

Dim size As Integer

Let size = valeurscourrantes.Rows.Count

If size <> DJIA.Rows.Count Then

Call MsgBox("La taille des séries ne corresponde pas !")

End If

Dim resultat As Double

Let resultat = 0

Const petitesvaleurs = 0.01

Dim i As Integer

For i = 1 To size

Dim Borne As Double

' Si les données sont égales à 0, prendre la plus petite value

Let Borne = Application.WorksheetFunction.Max(valeurscourrantes(i, 1).Value, petitesvaleurs)

' increment result with the absolute value of the log of the ratio between actual and model data

Let resultat = resultat + Abs(Log(Borne / DJIA(i, 1).Value))

Next i

Let SumAbsLn = resultat

End Function

précédent sommaire suivant






Bitcoin is a swarm of cyber hornets serving the goddess of wisdom, feeding on the fire of truth, exponentially growing ever smarter, faster, and stronger behind a wall of encrypted energy





Changeons ce systeme injuste, Soyez votre propre syndic





"I don't believe we shall ever have a good money again before we take the thing out of the hand of governments. We can't take it violently, out of the hands of governments, all we can do is by some sly roundabout way introduce something that they can't stop ..."   Friedrich Hayek (1899-1992) en 1984