Copulas 2

6
Correlations ... a sorta continuation of 2 stocks motivated by email from Peter U. We want to consider the possibility of generating random returns with prescribed parameters ... such as correlation. When one talks about the correlation between stock A and stock B, one usually means the Pearson correlation which would give, for example: For example, if we look at the last five years of daily GE returns and wish to compare to the S&P500 returns we might get something like these distributions: Figure 1A Figure 1B Here, we see what fraction of the returns lie in tiny intervals. For example (see the red bars?), it looks like about 3.4% lie in a small interval at 0.8% (for GE) and about 3% lie in a small interval at 0.5% (for ^GSPC). >TaDum! ... and the correlation IS ... huh? For these two sets, GE and S&P, it's about 78% and if we plot each of those returns as a point (x, y) = (S&P return, GE return) we'd get something like Figure 1. The interesting thing is, if we wanted to know if there were some underlying relationship between the two variables (here they're two sets of returns), then the Pearson correlation only tries to identify a linear relationship. That is, if y = Ax + B, the Pearson correlation between x and y would be equal to 1 ... or 100%. Figure 2

description

n/a

Transcript of Copulas 2

  • Correlations...asortacontinuationof2stocksmotivatedbyemailfromPeterU.

    Wewanttoconsiderthepossibilityofgeneratingrandomreturnswithprescribedparameters...suchascorrelation.

    WhenonetalksaboutthecorrelationbetweenstockAandstockB,oneusuallymeansthePearsoncorrelationwhichwouldgive,forexample:

    Forexample,ifwelookatthelastfiveyearsofdailyGEreturnsandwishtocomparetotheS&P500returnswemightgetsomethinglikethesedistributions:

    Figure1A Figure1B

    Here,weseewhatfractionofthereturnslieintinyintervals.Forexample(seetheredbars?),itlookslikeabout3.4%lieinasmallintervalat0.8%(forGE)andabout3%lieinasmallintervalat0.5%(for^GSPC).

    >TaDum!...andthecorrelationIS...huh?Forthesetwosets,GEandS&P,it'sabout78%andifweploteachofthosereturnsasapoint(x,y)=(S&Preturn,GEreturn)we'dgetsomethinglikeFigure1.

    Theinterestingthingis,ifwewantedtoknowifthereweresomeunderlyingrelationshipbetweenthetwovariables(herethey'retwosetsofreturns),thenthePearsoncorrelationonlytriestoidentifyalinearrelationship.Thatis,ify=Ax+B,thePearsoncorrelationbetweenxandywouldbeequalto1...or100%. Figure2

  • >That'sPearsoncorrelation,butwhataboutSpearmancorrelationUh...yes,Spearman.Actually,Ididn'twanttotalkaboutPearsonorSpearman,Iwantedtotalkabout...

    >Cupolas?Uh,notquite.Iwanttotalkaboutcopulas.

    Notethatifreturnsarerelatednonlinearly(forexample),then...

    >Nonlinearly?Yes.SupposethereturnsofstockAarer1,r2...r50andthereturnsofstockBare100r13,100r23...100r503.Ifthestocksstartoffat$10and$15respectively,thepricesmightlooksomethinglikeFigure3.

    Whenonegoesupordowntheotherisboundtogoupordowninsynchronism.However,thePearsoncorrelationisonly75%despitethefactthatthetwosetsofreturnsareintimatelyrelated.

    >Intimatelyandnonlinearly!Indeed.Note,however,thattheSpearmancorrelationis1(or100%).

    Figure3

    Infact,Spearmanmeasuresnotthelineardependencebutthemonotonedependencebetween...

    >Huh?Spearmanassignstoeachstockreturnitsrank,so:

    ForstockA,ifr1isthe7thlargestreturninthesetr1,r2...r50,thenwewritedown7.Ifr2isthe27thlargestreturninthesetr1,r2...r50,thenwewritedown27.etc.etc.Ifr50isthe3rdlargestreturninthesetr1,r2...r50,thenwewritedown3.WethendiscardthesequenceofreturnsandretainthesequenceofranksforstockA:[7,27,...3]Werepeat,toobtainasequenceofranksforstockB.ThenwetakethePearsoncorrelationofthetwosetsofrankstogettheSpearmancorrelation

    >Andthatdoes...what?It'sguaranteedtogive100%SpearmancorrelationifthestockAandstockBgoupanddowntogether.Infact,thetwosequencesofranksareidentical(forourfictitiousstocksAandBwithreturnsrand100r3),sothePearsoncorrelationofranksisequalto1(or100%).Infact,ifwecanchangethesecondsettoanyincreasingfunctionofthefirstset,therankshencetheSpearmancorrelationisunchanged.Forexample,ifthesecondsetisr3orerorlog(1+r)or...whatever,thePearsoncorrelationremainsunchanged.>Idon'tseeanycopulasyet...Wewanttoseethe"correlation"betweenstocks,so

  • here'swhatwecando:

    RememberFigure1?Itshowstwoseparatedistributions,andwhatfractionofreturnslieinthoseweeintervals.

    We'dlikesomehowtoputthembothonthesamedistributionchart.

    Wecould,forexample,combineFigures1and2togetFigure3,wheretheseparatedistributionsareshown...aswellastheplotof(S&Preturn,GEreturn).

    >That'saCupola?Patience,we'renotatcupolasyet.

    >Aha!YousaidCupola!Whatdoescopulamean,bytheway?Ihavenoidea

    Figure3

    Copulas

    Okay,noticeoneneatthing.

    Whenwediscardedthesequenceofreturnsandretainedthesequenceofranks,insteadofgettingadistributionlikeFigure1,weget...

    >Adistributionofranks,right?Right.Butiftherearesay,100returnsdistributedinsomeweirdway,wegetasetofranks,eachbeingoneofthenumbersfrom1to100,andthey'redistributeduniformly.

    >Huh?Don'tyousee?Therearejustasmany"ranks"intherange15asthereareintherange610asthereareintherange1115asthere...

    >Okay!Okay!Igetit!Soifwedivideuptherange1to100into20intervals,eachoflength5,there'dbeequalnumbersof"ranks"ineachsubinterval.

    >There'dbe5ineach.Yes,asillustratedinFigure4

    Figure4

    >Arewethereyet?Notquite,butweshouldgoslowlybecause...

    >I'dbehappierifyou'djustdefineacopula!

    Acopulaisaprobabilitydistributiononaunitcube[0,1]nforwhicheverymarginaldistributionisuniformontheinterval[0,1]

    Happynow?

  • >No.Maybeyoushouldgoslow.

    Okay.Noticethat,inFigure4,thebottomchartisauniformdistribution...derivedfromastandard,gardenvarietydistributioninthetopchart.Thatuniformdistributionthingisthekey.Rememberhowwegenerateastandard,gardenvarietydistributionfromauniformone?

    >Areyoukidding?Weinventsomeincreasingfunction...likethebluecurveinFigure5.Itrunsfrom0attheleftto1attheright.Nowpick,atrandomnumber,anynumber,between0and1.Seethereddotatabout0.55?Nowruntotheright(toourbluecurve)thendown.Seethemagentadotlabelledr?Repeatajilliontimes,eachtimechoosingarandomnumberfrom0to1(ontheverticalaxis,likeour0.55above),andgettinginreturnanumberliker.Ifthedistributionofrandomnumbersselected(ontheverticalaxis)isuniform,thenthenumbersrwillbedistributedasshowningreen. Figure5

    >Butthatgreencurveisastandard,gardenvarietydistribution...isn'tit?Yes,justlikeFigure1Aand1B,exceptit'ssmoothbecauseweinventedasmoothbluecurve.Thepointtonoticeisthatwe:

    Startwithsomecurveincreasingfrom0to1(that'sthebluecurve).Selectfromauniformdistribution(thenumbersselectedatrandomontheverticalaxis,like5.5,above).Thengenerateour(final)distributionfunction(that'sthegreencurve).

    >Ithoughtweweretalkingabouttwostocks.Well,twoassets,likemaybestocksandbonds.SoourprobemistogenerateadistributionforeachassetsothesetwodistributionshaveprescribedMean,VolatilityandCorrelation.

    Thenwe'dliketogeneratesomethinglikeFigure6A,wherexandyarerandomvariablesand,foreachpair(x,y),wehaveaprobabilitythatthatpairwilloccur.Theprobabilityisgivenbytheheightofthesurface.

    >Itgivestheprobabilitythatthetwovariablesareexactlyxandy?Well,no.It'stheprobabilityofbeinginsomesmallneighbourhoodof(x,y)...likeFigure1,above.

    Forexample,ifx=1andy=2,thentheheightmightbez=0.05sotheprobablilityis0.05(or5%)thatxliesinsomesmallintervalaboutx=1(saybetween0.95and1.05)andyliesinsomesmallintervalabouty=2(saybetween1.95and2.05).

    Figure6A

  • >Andthexandyvariableshavewhatkindofdistribution?InFigure6A,they'reeachnormallydistributed,but...

    >Andthat'stypical?Typical?Theycanhaveanydistributionsyoulike.That'snotthepoint.Thepointisthatwe'dliketohavethemcorrelatedinsomeprescribedmannerand...

    >Butyoualwayspicknormal!Okay!InFigure6B,oneisnormalandtheotherhasabetadistribution.

    >Betawho?ThebetadistributionslooklikeFigure6C,wherepandqareparametersthatyouselect,AandBarechosensothatAxBandKissuchthattheareaunderthecurve(showningreen)is"1"(meaningthere'sa100%probabilitythatxliessomewherein[A,B]).

    >AndinFigure6B,whichisnormalandwhichisbeta?Iforget

    Figure6B

    Figure6C

    .

    ConstructingCopulas

    We'dliketoconstructajointdistribution(likeFigure6)withprescribedproperties.Todothis,wecanusethefollowing:

    1. WeinventafunctionC(x,y)which,foreachpairxandylyingin[0,1],generatesanumberin[0,1].2. C(x,y)=0ifeitheroneofxoryis0.(Thatis:C(0,y)=C(x,0)=0forxandyin[0,1].)3. C(x,1)=xandC(1,y)=y.(Thatis,fory=1,C(x,1)=xincreasesfrom0to1asxincreasesfrom0to1.)4. C(x,y)isincreasinginbothxandy.(LikethebluecurveinFigure5.)

    >Don'ttellme...CstandsforCopula,right?

    Yes.ThevariousrequirementssaythatCmustbeincreasingandwhatshe'slikealongtheboundariesoftheunitsquare0x1,0y1.

    >AndthatdefinesC?Hardly.Thereareajillionfunctionsoftwovariablesthatsatisfythoserequirements...andthey'reallpossibleCopulas.

    Theneatthingisthat,havingpickedaCupola,wecangenerateajointdistributionfunctionforxandy(liketheoneshowninFigure6).

    Figure7

    SupposethedistributionfunctionsforxandyareF1(x)andF2(y).ThenC(F1(x),F2(y))isajointcumulativedistributionfunctionforxandy.

  • >Cumulative?Yousaidit'dgivesomethinglikeFigure6.Ilied.Figure6isthedensitydistribution.Cwillgivethe2dimensionalversionofthebluecurveinFigure5...likeFigure8.

    >IassumeyoujustinventedFigure8,right?Notatall.Themagicformulais:

    You'llnotice(nodoubt)thatallthefeaturesaboveareincorporatedinthisCopula.Forexample,C(x,1)=(1/d)log(edx)=x.

    >What'sthat"d"?YoupickittosuityourCopularequirements

    Figure8

    WecanalsowritethatformulaforCinamoresanitaryform:

    ...whichmakesiteasytogeneralizetoumpteenvariables:x,y,z,u,v,w,etc.etc.

    >Iassumeithasaname?Yes,it'sFrank'sCopula,namedafterM.J.Frank(whointroduceditin1979).

    >Arethereothers?Well,there'sClaytonCopulasandGumbelwithvarioustypesthatgobythenameofGaussianorArchimedian(Frank'sisArchimedean)and...

    >Yeah,thanks.Canwestopnow?No...

    forPartII