[PDF] Writing R Functions - CMU Statistics



Previous PDF Next PDF







Introduction to the R Language - Functions

The scoping rules for R are the main feature that make it di erent from the original S language The scoping rules determine how a value is associated with a free variable in a function R uses lexical scoping or static scoping A common alternative is dynamic scoping Related to the scoping rules is how R uses the search list to bind a value to



Writing R Functions - CMU Statistics

Programming in R is organized around functions You all know what a mathemat-ical function is, like logx or (z) or sin : it is a rule which takes some inputs and delivers a definite output A function in R, like a mathematical function, takes zero or more inputs, also called arguments, and returns an output The output is arrived



Apply functions with purrr : : CHEAT SHEET

purrr::map_lgl( x, f, Apply f element-wise to x, return a logical vector n_iris > transmute(n = map_lgl(data, is matrix)) purrr::map_int( x, f, Apply f



Package ‘futureapply’ - The Comprehensive R Archive Network

future apply future apply: Apply Function to Elements in Parallel using Futures Description The future apply packages provides parallel implementations of common "apply" functions pro-vided by base R The parallel processing is performed via the future ecosystem, which provides



list of some useful R functions - Columbia University

integrate() - adaptive quadrature over a nite or in nite interval 4 Plotting plot() - generic R object plotting par() - set or query graphical parameters



A ``Level-Zero Tutorial for Getting Started with R

a “level-zero" tutorial for getting started with r 2 This tutorial will use screenshots from the Mac version, but other than appearance, everything should be similar in Windows Opening R for the First Time When you open R, the main window that opens is the R console, shown in Figure 2 A second window, for a script editor, may also open



∫bf (x) ∫Af (x - ConsultGLP

Now, let’s see how we can use R language to plot a density function Define a vector x over the domain We can then apply the distribution’s density function to x and then plot the result The code sniper plots the standard normal distribution: > x plot(x,dnorm(x)) >



Package ‘xts’ - R

Apply a function to the data of an existing xts plot object and plot the result FUN should have arguments x or R for the data of the existing xts plot object to be passed to All other additional arguments for FUN are passed through Usage addPanel(FUN, main = "", on = NA, type = "l", col = NULL, lty = 1, lwd = 1, pch = 1, ) Arguments



Introduction to the eventstudies package in R

Introduction to the eventstudies package in R Ajay Shah Sargam Jain June 1, 2020 1 The standard event study in nance In this section, we look at using the ‘eventstudies’ package for the purpose of doing the standard event study using daily returns data in nancial economics This is a workhorse application of event studies



III17 The Lambert W Function - Princeton University

thereof Images of Wk(reiθ)for various k, r, and θare shown in figure 2 In contrast to more commonly encountered multi-branched functions, such as the inverse sine or cosine, the branches of Ware not linearly related However, by rephrasing things slightly, in terms of the unwinding number K(z):= z−ln(ez) 2πi and the related single

[PDF] croquis france potentialités et contraintes

[PDF] néon configuration électronique

[PDF] ion carbone formule

[PDF] le territoire français des milieux aménagés des milieux ? ménager

[PDF] ion sulfite

[PDF] exercice enthalpie libre et potentiel chimique

[PDF] palme funeraire

[PDF] ion sodium nombre de charges positives du noyau

[PDF] exercice potentiel chimique

[PDF] td potentiel chimique

[PDF] composition de l'atome d'oxygène

[PDF] exercices corrigés sur les équilibres chimiques pdf

[PDF] humidité du sol calcul

[PDF] potentiel matriciel du sol définition

[PDF] teneur en eau sol

22:41Wednesda y6

th

February,2013

AppendixA

WritingRFunctions

Theabilityt or ead,understand,modifyand writesimplepieces ofcodeisanessential skillfor moderndataanalysis. Lotsofhigh-qualitysof twar ealreadyexistsforspeciÞc purposes,whichyou canandshoulduse,butstatisticiansneedtograsphowsuchsoft- wareworks,tweak ittosuittheirneeds,recombineexisting piecesofcode,andwhen neededcreat etheirowntools.Someonewho justknowsho wtorun cannedroutines isnot adataanalyst butat echnicianwho tendsamachinetheydonot understand. Fortunately,writingcodeisnotactuallyveryhar d,especiallynot inR.All it demandsist hedisciplinet othinklogically, andthe patiencetopractice. Thischapter triestoillustr atewhatÕsin volved,startingfromthe verybeginning.Itisredundant formanystudents, butincludedthrough populardemand.

A.1Functions

ProgramminginRisorganizedaroundfunctions.You allknowwhatamat hemat- icalfunctionis, likelog xor(qz)orsin⇣:itis ar ulewhich takessome inputsand deliversadeÞniteoutput.Afunction inR,lik eamat hematicalfunction,tak eszero ormor einputs,alsocalledarguments,andreturnsanoutput. Theoutputis arriv ed atb ygoingthrougha seriesof calculations,basedontheinput,which wespecify inthe bodyofthefunction. Asthe computer followsourins tructions,it maydo otherthingstot hesystem;t hesearecalledside-effects.qThemos tcommonsor tof side-effect,inR,isprobably makingorupdating aplot onthe screen.)Thebasic declarationordeÞnitionofafunction lookslik eso: my.function<-functionqargument.1, argument.2,...) { ⌘clevermanipulationsofarguments returnqthe.return.value) Strictlyspeaking,weoftendonÕ tneedt hereturnq)command;wit houtit,thefunc- tionwillr eturn thelastthingitevaluated.But itÕsusually clearer,andnev erhurts,to bee xplicit. 500

501A.2. FIRSTEXAMPLE:PARETO QUANTILES

Wewritefunctions becauseweoftenÞndoursel vesgoing thr oughthesamese- quenceofst epsatt hecommandline,perhapswithsmallv ariations.It savesmental effortonourparttotak ethat sequenceand bindittoget herintoaninteg ratedpro- cedure,thefunction,so thatthenwe canthink aboutt hefunctionasawhole,r ather thantheindividuals teps.Italsoreduces error ,because,byinvokingt hesamefunc- tionev erytime,wedonÕthavet owor ryaboutmissinga step,orwonderingwhet her weforgot tochangethethirds teptobeconsis tentwiththesecond,andso on.

A.2FirstEx ample:ParetoQuantiles

Letmegivea really concreteex ample.In Chapter6,Imentionedthe Paretodistri- bution,which hastheprobabilitydensity function fqx;⌘,x 0 ⌘(1 x 0 x x 0 x⇣x 0 0xConsequently,theCDFis

Fqx;⌘,x

0 )=1( x x 0 (⌘+1 qA.2) andthe quantilefunctionis

Qqp;⌘,x

0 )=x 0 q1(p) 1 ⌘(1 qA.3) SayIwantt oÞndt hemedianofaP aretodistr ibutionwith ⌘=2.34andx 0

6⌘10

8 .Ican dot hat: >6e8*q1-0.5)^q-1/q2.33-1)) [1]1010391288 IfIdecide Iw antthe 40thper centileofthesamedis tribution,Icandot hat: >6e8*q1-0.4)^q-1/q2.33-1)) [1]880957225 IfIdecide tor aisethe exponentto2.5,lo werthet hresholdto1⌘10 6 ,andask about the92ndpercentile,I candot hat,too: >1e6*q1-0.92)^q-1/q2.5-1)) [1]5386087 Butdoingt hisall byhandgets quite tiresome,andatsomepoint IÕmgoingt o thereisonlyoneplacefor metomakea mistake: qpareto.1<-functionqp, exponent,threshold) { q<-threshold*qq1-p)^q-1/qexponent-1))) returnqq)

22:41W ednesday6

th

February,2013

A.3.FUNCTIONSWHICH CALLFUNCTIONS502

Thenameof thefunction iswhatgoes ontheleftof the assignment<-,with thedec- larationqbeginningfunction)ont heright. qIcalledthisqpareto.1todistinguishit fromlatermodiÞcations.)The threeter msint heparent hesisafterfunctionarethe argumentstoqparetoÑthe inputsithasto workwith.The bodyoft hefunction isjust likesomeRcodew ewouldtypeinto thecommand line,af terassigning values tothearguments. Theverylast linetellsthefunction, explicitl y,whatitsoutputor returnvalueshouldbe.Here,ofcour se,thebodyoft hefunction calculatest hepth quantileoftheP aret odistributionwith theexponentandthresholdweaskfor. WhenIent erthe codeabove,deÞningqpareto.1,into thecommandline,Rjus t acceptsitwithoutoutputting anything. Itthinksoft hisas assigningcertainvalue tothename qpareto.1,andit doesnÕt produceoutputs forassignmentswhenthey succeed,just asifIÕdsaidalpha<-2. 5. Allthat successfullycreatingafunction means,however ,isthatwe didnÕ tmake ahug eerrorint hesyntax.Weshouldstillchec kthat itworks,b yin vokingthe functionwith valuesofthear gumentswherewekno w, byothermeans, whatthe outputshouldbe. Ijust calculatedt hreeq uantilesofParet odistributionsabo ve,so letÕsseeifwecanreproduce them. [1]1010391288 [1]880957225 [1]5386087

So,ourÞr stfunction seemstoworksuccessfully.

A.3FunctionsWhich CallFunctions

Ifwe examineot herquantilefunctionsqe.g.,qnorm),we seethatmostof themtak e anargument calledlower.tail,which controlswhether pisapr obabilityfrom the lowertailortheupper tail.qpareto.1implicitlyassumesthatitÕ sthe lowertail,but letÕsaddtheabilitytochang ethis. qpareto.2<- functionqp,exponent,threshol d,lower.tail=TRUE){ ifqlower.tail==FALSE){ p<-1-p q<-threshold*qq1-p)^q-1/qexponent-1))) returnqq) When,ina functiondeclaration, anargument isfollo wedby=andan expression, theexpressionse tsthedefaultvalueofthe argument,theonewhic hwillbeused unlessexplicitl yover-ridden.Thedef aultvalueoflower.tailisTRUE, so,unlessit isexplicitl ysettofalse,w ewillassumepisapr obabilitycounted from(Çonup.

22:41W ednesday6

th

February,2013

503A.3. FUNCTIONSWHICHCALLFUN CTIONS

Theifcommandisa controlstructure Ñift heconditionin parenthesisistr ue, thenthecommandsin thefollowingbr aceswillbe execut ed;ifnot,no t.Sincelower tailprobabilities plusuppertailprobabilitiesmus taddt oone, ifwe aregivenan uppertailpr obability,w ejustÞndthelower tailprobabilityandproceed asbefore.

LetÕstryit:

[1]1010391288 [1]1010391288 [1]5386087 [1]1010391288 [1]1057162 First:theanswerqpareto.2giveswithlower.tailexplicitlysettotrue matches whatwealreadygotfromqpareto.1.Secondand third:thedefaultvalueforlower.tail works,anditworksf ortwodifferentvaluesoftheotherarguments.FourthandÞfth: settinglower.tailtoFALSEworksproperlyqsincethe 50thpercentileisthesame fromabove orfrombelow,butthe 92ndpercentile isdifferent,and smallerfrom abovethanfrombelo w).

Thefunctionqpareto.2isequiv alenttothis:

qpareto.3<-functionqp, exponent,thresho ld,lower.tail=TRUE){ ifqlower.tail==FALSE){ p<-1-p q<-qpareto.1qp,exponent,threshold) returnqq) WhenRtr iesto executethis, itwilllookfora functionnamedqpareto.1inthe workspace.Ifwehavealready deÞnedsuchafunction,thenRwillexecuteit,withthe argumentsweha veprovided, andqwillbecomewhat ever isreturnedbyqpareto.1. Whenwe giveRtheabo vefunctiondeÞnitionfor qpareto.3,itdoes notc heck whetherqpareto.1existsÑitonlyhast obet hereat runtime.Ifqpareto.1 changes,thenthebehavior ofqpareto.3willchang ewithit,withoutourhaving toredeÞneqpareto.3. Thisisextremelyuseful.Itmeans thatw ecantak eourprogramming problemand sub-divideitint osmallertask sefÞciently.If Imadea mistakeinwr itingqpareto.1, whenIÞx it,qpareto.3automaticallygetsÞxedas wellÑalongwithanyo ther functionwhich callsqpareto.1,orqpareto.3forthatmatt er.IfIdiscov eramore efÞcientwayt ocalculatethequantilesandmodify qpareto.1,the improvements are likewisepassedalongtoe veryt hingelse.But whenIwriteqpareto.3,Idon Õtha veto worryabouthowqpareto.1works,Icanjustassumeitdoes whatIneed somehow.

22:41Wednesda y6

th

February,2013

A.4.LAYERING FUNCTIONSANDDEBUGGING504

A.3.1Sanity-CheckingAr guments

Itis goodpractice, thoughno tstrictlynecessary,towrite functionswhichcheck that theirargumentsmake sensebeforegoingt hroughpossiblylongand complicat edcal- culations.F orthePare toquantilefunction,f orinstance,pmustbein[0,1],the exponent⌘mustbeatleast 1,and thet hresholdx 0 mustbepositive,or elset he mathematicalfunctionjustdoesn Õtmak esense.

Hereishowt ochec kallthesereq uirements:

qpareto.4<-functionqp, exponent,threshold, lower.tail=TRUE){ stopifnotqp>=0, p<=1, exponent>1, threshold>0) returnqq) allofits argumentsdo note valuatetoTRUE.Ifall thoseconditions are met,howev er, Rjust goesontothe nextcommand, whichher ehappenstobe runningqpareto.3. Ofcourse, Icouldhave written thec hecksontheargumentsdir ectlyintothelatter.

LetÕsseethisinaction:

[1]1010391288 [1]1057162

Error:p<= 1isnot TRUE

Error:p>= 0isnot TRUE

Error:exponent> 1isnot TRUE

Error:threshold> 0isnot TRUE

Error:p>= 0isnot TRUE

TheÞrs ttwolinesgivethesame resultsasourearlier functionsÑas theyshould, allshow thatqpareto.4stopswithanerror messagewhenoneof theconditions in thestopifnotisviolated. Noticethat theerrormessagesay swhichconditionwas violated.Thesevent hlinesho wsonelimitationofthis:thearguments violatetwo conditions,butstopifnotÕserror messagewillonlymentiontheÞrstone.qWhatis theotherviolation?)

A.4Layering FunctionsandDebugging

Functionscancallfunctions whichcall functions,andso onindeÞnitel y.Toillus- trate,IÕllwriteafunction whichg eneratesPareto-distr ibuted randomnumber s,using

22:41Wednesda y6

th

February,2013

505A.4. LAYERINGFUNCTIONS ANDDEBUGGING

theÒquantiletransf ormÓmethodfr omLecture7.This,remember,isto generatea uniformrandomnumberUon[0,1],andpr oduceQqU),with Qbeingthe quantile functionoft hedesired distribution. TheÞrst versioncontainsadeliber atebug,which Iwillshowhow totr ack downandÞx. rpareto<-fu nctionqn,exponent,threshold){ x<-vectorqlength=n) forqi in1:n){ x[i]<-qpa reto.4qp=rnormq1),exponent=exponent,threshold=threshold) returnqx) Noticethatthiscalls qpareto.4,which callsqpareto.3,which callsqpareto.1.

LetÕsthisout:

>rparetoq10)

Errorinexpo nent>1 :ÕexponentÕismissing

Thisisa puzzlingerr ormessage Ñthe expressionexponent>1nev erappearsin rpareto(Theer roris comingfromfurtherdownt hechain ofe xecution.Wecan seewhere ithappensbyusingt hetracebackq)function,which givesthechain of functioncallsleading tot helates terror: >rparetoq10)

Errorinexp onent>1 :ÕexponentÕismissing

>tracebackq)

3:stopifnotqp>= 0,p<= 1,exponent >1,threshold >0)

2:qpareto.4qp= rnormq1),exponent= exponent,threshold= threshold)

1:rparetoq10)

tracebackq)outputsthe sequenceoffunctioncallsleading uptotheer rorin re verse order,sothatthe lastline, numbered1,iswhat weactuall yenter edonthecommand line.Thist ellsust hattheerror ishappeningwhen qpareto.4triestochec kthe argumentstot hequantilefunction.Andt hereasonitishappening isthatwear enot providingqpareto.4withanyvalue ofexponent.Andt her easonthatishappening isthat wedidnÕtgiv erparetoanyvalueofexponentasane xplicitargument when wecalledit,and ourdeÞnitiondidn Õtse tadef ault.

LetÕstrythisagain.

>rparetoqn=10,exponent=2.5,threshold=1)

Error:p<= 1isnot TRUE

>tracebackq)

4:stopqpasteqch, ⇣isnot⇣,ifqlengthqr) >1L)⇣all ⇣,⇣TRUE⇣,

sep=⇣⇣), call.=FALSE)

3:stopifnotqp>= 0,p<= 1,exponent >1,threshold >0)

2:qpareto.4qp= rnormq1),exponent= exponent,threshold= threshold)

1:rparetoqn =10,exponent =2.5,threshold =1)

22:41Wednesda y6

th

February,2013

A.4.LAYERING FUNCTIONSANDDEBUGGING506

Thisispr ogress( Thestopifnotinqpareto.4isatleas tablet oevaluate allthe conditionsÑit justhappens thatone ofthemisfalse. qTheline 4herecomesfrom theinternalw orkingsofstopifnot.)Thepr oblem,then, isthatqpareto.4isbeing passedanegativ evalue ofp.Thist ellsust hattheproblemis comingfrom thepartof rpareto.1whichsetsp.Lookingat that, p=rnormq1) theculpritis obvious:Istupidly wrot ernorm,which generatesaGaussianrandom number,whenImeant towr iterunif,which generatesa uniformrandomnumber. 1

Theobvious Þxisjustto replacernormwithrunif

rpareto<-fu nctionqn,exponent,threshold){ x<-vectorqlength=n) forqi in1:n){ x[i]<-qpar eto.4qp=runifq1),exponent=exponent,threshold=threshold) returnqx) LetÕsseeifthisisenought oÞxt hings,orif Ihaveany other err ors: >rparetoqn=10,exponent=2.5,threshold=1) [1]1.0007362.764087 2.7758801.0589101.061712 2.1429504.220731 [8]1.4967933.004766 1.194545 Thisfunctionat leastpr oducesnumerical returnvalues ratherthan errors(Are they therightvalues? WecanÕte xpectarandomnumbergenerat ortoalway sgive thesameresults,so Ican Õtcross-checkthisfunction againstdirectcalculation,thewayIcould check qpareto.1.qActuall y,onewaytochecka randomnumber generatoristomak e sureitdoesnÕtgiveidenticalresultswhen runtwice() ItÕsatleast encouragingt hatall thenumbersare abovethreshold,butt hatÕs notmuchofatest.Howe ver,sincethis isarandom numbergenerator, ifIuse ittoproducealotofrandomnumbers,t he quantilesoftheoutput shouldbeclose tothetheor eticalq uantiles,which Idoknow howtocalculate. [1]1.587401 >quantileqr,0.5)

50å

1.598253

[1]1.072766 >quantileqr,0.1)

10å

1 Iactually madethisexact mistake theÞrsttime Iwrotethefunction, backin2004.

22:41Wednesda y6

th

February,2013

507A.5. AUTOMATINGREPETITION ANDPASSINGARGUMENTS

1.072972

[1]4.641589 >quantileqr,0.9)

90å

4.526464

Thislooks prettygood.F igureA.1showsaplo tcompar ingallthetheoreticalper - centilesto thesimulatedones,conÞr mingthatwedidn Õtjustge tluc kywithchoosing particularpercentilesabov e.

A.4.1Moreon Debugging

2 .There aresome guidelinesfor makingiteasierandlesspainful. CharacterizetheBugWeÕvegotabugwhenthecodew eÕvewritt enwon Õtdo whatwe want.ToÞxt his,ithelpsalot toknowe xactly whaterrorwe Õre seeing. TheÞrs tsteptothis istomaketheerr orreproducible.Canw ealwaysg et theerror whenr e-runningthesamecodeandvalues? Ifwestart thesame codeina cleancop y ofR,does thesame thinghappen? Oncewecanrepr oducethe error,w emapits boundaries.Howmuch canwechange theinputsandg ett hesameerror? Adifferent error?Forwhatinputsqif any)doesthebug goaw ay?Howbig isthe error? Localizethe BugTheproblem maybeadif fuseall-pervadingwrongness,butoft en itÕsalotmorelocalized, to afewlinesor evenjustone lineofcode; ithelpstoknow where(Wehav eseensometoolsf orlocalizingthebugabove:tracebackq)and stopifnotq).Anot herveryhelpfuloneisto addprintstatements,sothatour functiongiv esusmessagesaboutt heprog ressofitscalculations,select edvar iables, etc.,asitgoes;t hewarningcommandcan beusedt omuch thesame effect 3 FixtheBug Onceyou knowwhatÕsgoing wrongandwhereit Õsgoingwrong,itÕs oftennottoohar dtospott heerror,eit heroneofsyntaxqsay =vs.==)or logic.Tr y aÞxand seeifit makesit better .Dot heinputs whichgave yout hebugsbeforenow workproperly?Ar eyougettingdifferenterr ors?

A.5AutomatingR epetitionandPassingArguments

Thematch betweenthet heoreticalquantilesandthesimulat edonesinFigur eA.1is close,butit Õsno tperfect.Ontheonehand, thismightindicate somesubtlemistake. Onthe otherhand,itmight justberandomsamplingnoiseÑ rparetoissupposed 2 Thosewhodon Õtwr itetheirowncodebutuse computersanywayspend alotoftime puttingupwith otherpeopleÕsbugs. 3 Realsoftware engineerslookdownonthis,infav orofmoresophisticat edt ools,likeinteractiv ede- buggers.Theyhavesome thingofapoint,but thatÕsusuallyover -killforthepurposesof thisclass.

22:41W ednesday6

th

February,2013

A.5.AUTOMATIN GREPETITIONANDPASSINGARGUMENTS508

5101520

5 10 15 20 theoretical.percentiles simulated.percentiles simulated.percentiles<- quantileqr,q0:99)/100) ablineq0,1) FigureA.1:Theoreticalper centilesofthePar etodistributionwith ⌘=2.5,x 0 =1, andempir icalpercentilesfromasample of10 4 valuessimulatedfrom itwiththe rparetofunction.qThesolid lineist hex=ydiagonal,for visualreference.)

22:41Wednesda y6

th

February,2013

509A.5. AUTOMATINGREPETITION ANDPASSINGARGUMENTS

tobear andomnumberg enerator ,afterall.W ecouldc heckthisbyseeingwhether wege tdifferentdeviationsaroundthe linewithdiffer entrunsofrpareto,orif on thecontraryt heyallpullinthesamedir ection.Wecouldjustmake manyplo tsby hand,the waywemade thatplotbyhand,butsince weÕre doingalmost exactlythe samething manytimes,let Õswritea function. pareto.sim.vs.theory<-functionq) { ThisdoesnÕ treturnanything.All itdoesisdrawanewsample fromthesameParet o distributionasbefore,re-calculatethesimulatedpercentiles,andaddthem toanexist- ingplo tÑthisisan exam pleofaside-effect. Notice alsothat thefunctionpresumes thattheoretical.percentilesalreadyexists.qThe theoreticalpercentileswonÕ t needt ochangefrom onesimulationdrawtothe next,soitmakes senseto only cal- culatethemonce.) FigureA.2showsho wwecanuseit toproducemultiplesimulationruns. Wecan seethat, lookingovermany simulationruns, thequantilesseemtobe toolargeabout asoft en,andasmuch,asthey aret oolow ,whichisr eassuring. Onet hingwhichthatÞgur edoesnÕtdois letustracet heconnectionsbetween pointsfrom thesamesimulation.Mor egenerally, wecan Õtmodify theplottingpr op- erties,whichis kindofannoying.Thisis easilyÞx edmodifyingt hefunctiont opass alongarguments : pareto.sim.vs.theory<-functionq...) { Puttingtheellipsesq...)int heargumentlistmeansthatwecangivepareto.sim.vs.theory.2 anarbitrar ycollectionofarguments,butwitht heexpectation that itwillpassthem alongunc hangedtosomeotherfunction thatitwillcallwit h...Ñher e,thatÕst he pointsfunction.Figur eA.3showshow wecanusethis, bypassingalonggraph- icalarguments topointsÑinpar ticular,t ellingittoconnectthepointsb ylines qtype=⇣b⇣),var yingtheshapeofthepointsq pch=i)andt helines tyleqlty=i). TheseÞgures arereasonably convincingthatnot hingisgoingseriouslywrong withthesimulationf ortheseparametervalues.Tocheck otherparamet ersettings, again,Icould repeat allthese stepsbyhand, orIcould writeanother function: check.rpareto<- functionqn=1e4,exponent=2.5,threshold=1,B=10){ ⌘Onesetofpercentilesforeverything threshold=threshold)

22:41W ednesday6

th

February,2013

A.5.AUTOMATIN GREPETITIONANDPASSINGARGUMENTS510

5101520

5 10 15 20 theoretical.percentiles simulated.percentiles simulated.percentiles<- quantileqr,q0:99)/100) ablineq0,1) forqiin 1:10){ pareto.sim.vs.theoryq) FigureA.2:Comparing multiplesimulatedquantilev aluestothetheoretical quan- tiles.

22:41Wednesda y6

th

February,2013

511A.5. AUTOMATINGREPETITION ANDPASSINGARGUMENTS

quotesdbs_dbs16.pdfusesText_22