Shihong Ren
email: renshihong@hotmail.com

Laurent Pottier
email: laurent.pottier@univ-st-etienne.frmichel.buffa@univ-cotedazur.fr

Michel Buffa

F ROM D IAGRAM TO C ODE : A W EB -BASED I NTERACTIVE G RAPH E DITOR FOR F AUST DSP D ESIGN AND C ODE G ENERATION

F AUST , as a domain-specific language (DSL) initially designed to represent block-diagram algebra [1], is efficient through its syntax to describe DSPs because of its structural similarity to physical signal processing devices. This approach allows the F AUST compiler to generate an equivalent graphical representation of the coded algorithm as a block-diagram. Considering the nature of the language, the reverse should be possible as well (compiling an equivalent F AUST DSP code from a block-diagram). This paper discusses the possibility to achieve this process and proposes a web-based block-diagram graph editor for designing F AUST DSP.

1.

INTRODUCTION

Many visual programming languages (VPLs) such as Max [START_REF] Puckette | Max/msp[END_REF] or PureData [START_REF] Puckette | Pure Data[END_REF] provide a graphic canvas to allow developers to connect functions or data between them. This canvas with connected objects, also known as a patcher [START_REF] Puckette | The patcher[END_REF], is basically a graph, meant to be interpreted as dataflow computation [START_REF] Lee | Dataflow process networks[END_REF] by the system. These visual languages are user-friendly as they seem closer to the way things work in our physical world, especially in the audio processing field. Connecting signal processors using audio cables to produce sounds and effects is a common practice even though we can now bring this practice to the digital world. This is one of the reasons for the design of the F AUST programming language, that represents its code with its patcher-like graph called block-diagram algebra (BDA) [START_REF] Orlarey | An algebra for block diagram languages[END_REF].

By adopting the BDA as the core of the language, the drawbacks of the graph representation and dataflow model [START_REF] Stephens | A survey of stream processing[END_REF] are discussed mainly due to the complexity and difficulty on the performance optimization aspect and the lack of an explicit semantic of the algorithm written. As a result, F AUST is designed to be closer to machine-friendliness. It is, in the end, a text-based language that can be represented as a BDA that is optimized and transformed into a high-performance low-level code.

So, even if the BDA is "flattened" internally, the F AUST code is always represented by a graph that leaves the possibility to generate code from an equivalent graph. To understand or design a DSP, a patcher or a block-diagram is often more illustrative for audio developers than mere source code, the visual representation looks like electric/electronic diagrams and hides all the "plumbery," the developer does not have to master the details of the implementation language. In addition, some VPLs can group subgraphs into blocks and provide zoomable views of the diagram logic, making it easier to find errors. This is why we think that an editor for such diagrams would be a desirable addition/improvement to an Integrated Development Environment (IDE) for F AUST [START_REF] Michon | The Faust Online Compiler: a Web-Based IDE for the Faust Programming Language[END_REF]. A graph-to-code approach would help writing DSP algorithms, boosting the design while not impacting the performance.

Since Max and PureData, patcher-like VPLs are massively developed especially on the web. WebPd is a web-based 1 PureData patcher interpreter using JavaScript and the WebAudio 2 API. Cables.gl is a video-oriented patcher editor on the web that 3 also handles WebAudio nodes. WebAudio Visual Editor, 4 WebAudioDesigner, Mosaicode [START_REF] Schiavoni | Web Audio application development with Mosaicode[END_REF] and Olos are web-oriented VPLs for audio processing. Still, using F AUST as the graph-to-code compilation target will bring as well the advantage of being able to export efficient and robust DSPs to any supported platform including Max, PureData and WebAudio.

Along with the development of the F AUST compiler, the presented work may be considered as a universal DSP design tool for many DSP platforms.

In the next sections, we will take a look at Gen, one of the 8 most popular existing graph-to-code generators for DSP, then discuss the possible implementations of F AUST 's different features in a graph editor. Finally, we will propose a web-based application that implements the first version of the editor and the code generator.

the GenExpr code is interpreted to a lower-level code to get higher performance. The GenExpr code that the system compiles to is available to users who can also write directly GenExpr code as a part of the program. This makes the language rather similar to F AUST and serves as inspiration. In the presented work, we follow certain paradigms from Gen to offer developers a consistent experience across platforms.

Inlets, Outlets, Inputs and Outputs

When a Gen patcher is compiled, the boxes and lines in the patcher are analyzed to generate the GenExpr code. The boxes with different text on them represent different functions. They have a certain number of inlets and outlets as their function parameters and results (inputs and outputs). The text on the box can be followed by arguments to override its parameters and to suppress the inlets (Figure 1). Unconnected inlets will be replaced by 0 while compiled.

Figure 1 Gen example: the "+" function has two inlets by default, one will be suppressed by adding an argument When a DSP diagram is built by a Gen patcher, it should have at least one output. Outputs are the starting points of the analysis. Inputs are involved in the code generation only if a path from input to output can be found. Inputs and outputs are represented as boxes named in and out . For example, Figure 2 will be compiled to: out1 = in1 + in2; out2 = in2; out3 = 0;

Figure 2 Gen example: inputs and outputs

Figure 2 also shows that when two lines merge into one inlet, they will be added together. When two lines are coming from the same outlet, they will represent the same signal and be named identically in the code.

Subprocess and Identifiers

A Gen patcher can contain multiple Gen patchers or GenExpr code blocks. They can be considered as reusable user-defined functions. This approach is similar to defining a reusable function in Faust. A sub-patcher in Gen will have the same number of inlets and outlets as the amount of in and out objects used; the code block is also connectable when the code is properly written and compiled. For example, the patcher in Figure 3 has one code block and one sub-patcher that represent the same function. So, the resulting code is: expr_1 = max(in1, in2); out1 = expr_1; max_2 = max(in1, in2); gen_3 = max_2; out2 = gen_3;

Figure 3 Gen example: sub-patcher and code block

In this example, we also understand that each result of a function is named with an identifier formed by the concatenation of the name of the function or outlet, an underscore, and a unique number. These identifiers are thereby unique and will be reused if the result is passed to other functions. Although the system can add some redundancy, it allows the developer to easily find out the relation between the graph and the code.

Loops

Dealing with loops is a common and critical issue in DSP language design. In Gen, it is possible to create a loop only if a delay of at least one sample appears in the loop. The graph is similar to the block-diagram that a F AUST recursive composition produces, which creates automatically a one-sample delay. Figure 4 is an example of simple feedback with a one-sample delay function history .

Figure 4 Gen example: a feedback with one-sample delay

The graph is compiled to the following code:

History history_1(0); add_2 = in1 + history_1; out1 = add_2; history_1_next_3 = fixdenorm(add_2); history_1 = history_1_next_3;
The loop with the history object generates the code differently, as the delay is declared explicitly on the top, with an extra fixdenorm function to replace the denormal values by 0.

Explicit and Implicit

F AUST is a functional language that can be used to build concisely a graph. This allows us to create new functions by chaining defined functions. However, once a new function is written, it becomes difficult to tell its exact number of inputs and outputs until the code is compiled. The same implication happens when we compose blocks using operators: it is not possible to tell before compilation how each input and output are connected without deep information of blocks. We chose to adopt in the work presented in this paper Gen's graph representation which is explicit in terms of I/Os and connections, as one inlet or outlet represents exactly one signal. This, on one hand, may raise some limitations when one needs to connect a large amount of I/Os or need to create a function with a variable number of arguments (like pattern-matching in F AUST [START_REF] Smith | Audio signal processing in Faust[END_REF]), but, on the other hand, brings an easily understandable graph that matches the block-diagram being compiled.

3.

C OMPILE A G RAPH TO F AUST

Functions

Basically, in F AUST , each block (or box in the graph) can be transformed into a f(x) expression (with some exceptions) [START_REF] Orlarey | FAUST : an Efficient Functional Approach to DSP Programming[END_REF].

The expression (prefix application syntax) is widely used in F AUST even for algebra symbols. As an example, a -b is equivalent to -(a, b) . This feature allows us to generalize the way a functional box can be transformed into F AUST code.

Table 1 shows how we generate expressions from an unconnected, no-argument box with different numbers of I/Os. The generation rules are:

1. Inlets and outlets are filled by 0 if not connected.

2. If the number of inlets is 0, which means the function has no input, then no parameter will appear in the code. 3. The outlets are named from the function name, box's unique identifier number and the outlet index. 4. If the function has multiple outputs, an intermediate expression will be generated before splitting to each outlet.

In Gen, the arguments attached after the function name in the box will be used to replace some function inputs by constant values.

To achieve this, we added more generation rules: 5. The arguments defined will be completely or partially applied to the beginning of available function inputs except for infix operators and their relatives. For these 14 11 ma.SR has 0 input, 1 output. 12 en.ar has 3 inputs, 1 output. 13 os.oscrq has 1 input, 2 outputs. 14 Functions that arguments are applied to the end of inputs in our implementation (the list is slightly different from Faust's infix operators): +, -, *, /, ^, %, &, |, xor, @, <, <=, exceptions, the arguments will be applied at the end of the available function inputs. 6. The _ (also known as identity block ) is used in F AUST to bypass a signal. We consider it as a placeholder in arguments to keep the inlet available.

Examples of unconnected boxes with arguments (Table 2): Now more rules about inlets: (Figure 5) 7. If an inlet is connected by one line, the identifier of the related outlet will be assigned to the function input. 8. If connected by more than one line, the outlets related will be merged into one signal before being assigned to the function input. 9. Inlets are one by one assigned to function inputs from start, skipping which is already replaced by arguments. For pattern-matching functions, the number of I/Os is variable. To make these functions usable in the graph, we allow setting the number of function I/Os explicitly using Gen's attribute syntax. For example, si.bus 5 @ins 6 @outs 5 declares that the function has 6 inputs and 5 outputs, then creates 5 inlets for the box as it already has one argument.

Main Process and Loops

The graph representation for loops in F AUST 's block-diagram or Gen is straightforward and intuitive. But compiling the graph to F AUST code is problematic. Indeed, if the loop is on the same level as other functions, the graph of the loop (recursion) is determined by the available number of I/Os of the process within the loop. In code generation, the recursive composition sign cannot be correctly placed unless the subprocess is compiled without any other loops. So, it is better to analyze these recursions with a higher priority and place them on an upper >, >=, <<, >>, ==, !=, pow, atan2, fmod, remainder, rdtable, rwtable.

This is an example of a parallel iteration which has 3 outputs (Figure 10), the fourth outlet is the local variable. The par box will look for a graph above its first inlet to take as its sub-process.

UI Components

As F AUST offers some primitives for UI description (checkbox, button, sliders, etc.), we implement them in the graph. Here is an example (Figure 11):

Figure 11 Graph with UI descriptors

The graph is similar to a F AUST block-diagram. The UI component name is optional. If omitted, it will be named using its box identifier.

W EB -BASED G RAPH E DITOR

The F AUST compiler is available altogether with an IDE on the Web platform since 2015 [START_REF] Denoux | Composing a Web of Audio Applications[END_REF][START_REF] Letz | Faust audio DSP language in the Web[END_REF]. Recently, W3C Web standards such as WebAudio, WebMIDI, WebAssembly,

15 16

opens a considerable potential for the F AUST ecosystem. For example. a ready-to-use JavaScript module named faust2webaudio has been developed in 2019, which allows us to evaluate F AUST DSP code and to compile to WebAssembly/WebAudio code that can run directly in a browser [START_REF] Ren | FAUST online IDE: dynamically compile and publish FAUST code as WebAudio Plugins[END_REF]. Web and web browsers, thanks to their accessibility and their increasing performance, became an attractive environment to develop F AUST -related tools.

Consequently, a modern web development tool-chain has been used to develop our editor, to ensure the efficiency of coding and compatibility across browsers.

Tool-chain

We are using TypeScript as our main development language 18 which provides an additional level of maintainability compared to JavaScript. It also supports multiple tools that we are working with: React, a framework we used mainly for the UI layer;

Data Structure

Inspired by Max and Gen's patcher structure, a patcher is basically an augmented graph with lines and boxes. They can be described in the form "Map" data structures: sets of key-value pairs (or more precisely key-objects). Their key/identifiers (IDs) are generated automatically using auto-incrementing numbers so that lines and boxes can be arranged by their creation order.

interface Patcher { lines: Record<string, Line>; boxes: Record<string, Box>; } Lines have some properties, such as their source and destination box. Boxes hold more information: number of I/Os, text content, position, dimensions, behavior, etc. The FaustOp object controls the lifecycle of the box: determines what to do when the box is created, connected, disconnected, destroyed, etc. It is also designed to output a part of F AUST code when requested. We will discuss this aspect in further subsections.

Patchers, lines, and boxes are all event emitters that fire different events when things happen. This mechanism allows us to separate them from the UI system in terms of data structure (loose coupling). UI components, since their creation, subscribe to these events to properly react to data changes. For example, each time the graph changes (is being edited), a new F AUST code will be generated (Figure 12).

Figure 12 The generated code can be previewed in real-time on the right panel (synchronized to the graph)

F AUST Standard Library Analysis

The faust2webaudio module which is included in the web version of the F AUST compiler comes with the F AUST 's standard library stdfaust.lib . [START_REF] Michon | New Signal Processing Libraries for Faust[END_REF] To use the functions from the library, we need to get a full list of available functions. All these library functions are well documented with a shared common format. To get a full list of available functions, a single traversal with a parser returns all the function names, and this result can be used both for syntax highlighting and for auto-completion in the code editor (also known as "IntelliSense features").

As the I/Os of these functions are implicit, the patcher needs to evaluate a function with the F AUST compiler to get their number of I/Os and to create box inlets and outlets. This is achieved by using a predefined method of faust2webaudio .

Graph Analysis

Code generation is the main task of the presented system. It regenerates the code by analyzing the graph in real time. The analysis is performed from bottom to top, more precisely, from each out box as the root of the tree traversal. This first full traversal is meant to find out all the boxes that are connected in the graph and to name their outlets using a unique F AUST identifier. A map is then created, that holds the relationship between lines and identifiers of their source outlet. Then a second traversal is performed: we call a method on all the boxes with the map as an argument, this method returns for each box the corresponding expression. These expressions are concatenated to the final code without any particular order. Indeed, most of the time, the F AUST compiler does not care about the order of expressions. For rare ones it does care, in an extra step, we locate them to the top of the code.

As an example, here (Figure 13) is a graph with one output.

Figure 13 Code generation steps example

Our first traversal brings back a map and visited boxes. The boxes are (Table 4): The map looks like that (Table 5): Then we get the expressions from the boxes. They are (Table 6): As ma.SR generated a special expression import(...); that should be included only once in the final code, we put it at the top.

Then we wrap the rest together with the main process using the out 's identifier: import("stdfaust.lib"); process = Out_1 with { ma_SR_3_0 = ma.SR; Const_4_0 = 1; Div_2_0 = /(Const_4_0, ma_SR_3_0); Out_1 = Div_2_0; };

C OMPILE A G EN P ATCHER TO F AUST

Since we are using the Gen approach to design the F AUST graph-to-code compiler, it is, therefore, possible to parse a Gen patcher and compile it to the F AUST code.

To achieve this process, we implemented all the Gen operators with F AUST functions in a separate F AUST library file gen2faust.lib which will be imported as a dependency of the generated F AUST code. Using this library file, we can interpret Gen boxes as F AUST expressions according to their box texts.

There are some differences in the interpretation of the box texts compared to the F AUST ones:

1. When Gen boxes are compiled to GenExpr, unconnected inputs can have their default value instead of 0. 2. Attributes (additional properties) can change the box's behavior. For example, the Gen cycle box has one input and two modes defined by the attribute @index . If the mode is set to freq , its input is 440 by default. We prepared two F AUST functions cycle and cycle_phase for these two modes (Table 7). By implementing these features to the editor, we managed to transform some Gen patchers to the F AUST code. However, some Gen operators which manipulate Max buffers remain difficult to interpret as F AUST 's audio import is not supported yet in the WebAssembly version of the F AUST compiler.

CONCLUSIONS

The traditional workflow, when developing DSP code with F AUST , is firstly to have a graph in mind, then transform it into code, then check if the code matches the original graph by comparing it visually with the diagram output by the compiler. The graph-to-code system presented in this paper sort of reverses this workflow: design graphically the graphic DSP algorithm, then generate the F AUST code. No need to check if the code matches the graph anymore. In addition, for pedagogical purposes, it can help beginners to easily build their DSP from scratch and to understand how F AUST works. Furthermore, thanks to modern web technology such as WebAssembly and the WebAudio API, we are able to compile, debug and run F AUST DSP just-in-time in a web browser. This can transform our system into another more graphical oriented, online IDE-like tool. For the moment, there are still some features in F AUST that are not yet implemented in the project; but, eventually, using such a patcher system, we will be able to manipulate between multiple F AUST DSPs or even with other WebAudio-compatible DSPs in a single workspace.

The graph editor with the code generator is being developed as an open-source project and is functional online with a video demonstration. It can save and load patchers as a JSON file.

26

Thanks to faust2webaudio and loose decoupling, it is possible to compile a graph file to F AUST code or to a WebAudio F AUST DSP automatically without any UI involved. So, the system can be integrated into F AUST IDEs or any WebAudio applications such as the WASABI Pedalboard. We are also developing a 27 web-based VPL for music composition and performance that use this project as its module.

R EFERENCES

  .ar(0, 0, 0); os.oscrq 13 os_oscrq_1 = os.oscrq(0); os_oscrq_1_0 = os_oscrq_1 : _, !; os_oscrq_1_1 = os_oscrq_1 : !, _;

Figure 5

 5 Figure 5 Graphs of Table3

Figure 10 par

 10 Figure 10 par iteration graph example

  import("stdfaust.lib"); process = Out_1 with { HBargraph_2_0 = VGroup_3_0 : hbargraph("monitor", -1, 1); Checkbox_7_0 = checkbox("Checkbox_7"); HSlider_8_0 = hslider("freq", 440, 20, 2000, 0.1); os_osc_6_0 = os.osc(HSlider_8_0); Mul_5_0 = *(os_osc_6_0, Checkbox_7_0); VGroup_3_0 = vgroup("VGroup_3", Mul_5_0); Attach_4_0 = attach(VGroup_3_0, HBargraph_2_0); Out_1 = Attach_4_0; };

19

  Babel, a set of JavaScript compilation utilities to keep our code 20 runnable on different browser versions; Webpack, a production 21 tool that manages code dependencies, etc. For the UI components based on React, we are using the React version of Semantic UI for the overall look and feel; the 22 Monaco source code editor, SCSS for page layout design, etc.23 24

Table 1

 1 Code

generated from unconnected functional boxes text code

Table 2

 2

	Code generated from unconnected functional
		boxes with arguments
	text	code
	+ 1	Add_1_0 = +(0, 1);
	@ 10	Delay_1_0 = /(0, 10);
	en.ar _ 0.1	en_ar_1_0 = en.ar(0, 0.1, 0);

Table 3

 3 Code

generated from connected functional boxes text code

Table 4

 4 Boxes visited

	box ID	box text
	1	out 1
	2	/
	3	ma.SR
	4	c 1 25

Table 5

 5 Line map

	line ID	F AUST code identifier
	line-1	Div_2_0
	line-2	ma_SR_3_0
	line-3	Const_4_0

Table 6

 6 Expressions generated

	box text	expressions
	out 1	Out_1 = Div_2_0;
	/	Div_2_0 = /(Const_4_0, ma_SR_3_0);
	ma.SR	import("stdfaust.lib"); ma_SR_3_0 = ma.SR;
	c 1	Const_4_0 = 1;

Table 7

 7 Compile Gen boxes

	box text		expressions
	cycle @index freq	cycle(440);
	cycle phase	@index	cycle_phase(0);

Proceedings of the 2 nd International Faust Conference (IFC-20), Maison des Sciences de l'Homme Paris Nord, Saint-Denis, France, December[START_REF] Orlarey | Syntactical and Semantical Aspects of Faust[END_REF][START_REF] Puckette | Max/msp[END_REF] 2020

https://mosaicode.github.io/

https://www.jasonsigal.cc/portfolio/olos .

https://docs.cycling74.com/max8/vignettes/gen_overview

https://fr0stbyter.github.io/jspatcher/dist/?mode=faust

https://docs.cycling74.com/max8/vignettes/gen_genexpr

https://www.w3.org/TR/webmidi

https://webassembly.org/

https://github.com/grame-cncm/faust2webaudio

https://www.typescriptlang.org/

https://reactjs.org/

https://babeljs.io/

https://webpack.js.org/

https://react.semantic-ui.com/

https://microsoft.github.io/monaco-editor/

https://sass-lang.com/

c represents a constant value.

level. As a result, these recursions are set aside and our main process will have a part of its I/Os dedicated to them.

For example, a process that has no input, 3 outputs and contains one recursion will be restructured as following (Figure 6): We are now able to compile the following graph (Figure 7):

Subprocess

Three subprocess design patterns are proposed: code in the graph, sub-patcher, F AUST iterations.

Code Block

F AUST offers several λ-function style syntaxes to facilitate the encapsulation of a subprocess. To integrate a separate F AUST DSP into a new process, we need the environment{...} syntax to ensure its independence and use its main process as our subprocess. This approach causes fewer problems as the F AUST compiler only allows using import syntax in a new environment.

The example below (Figure 8) shows how to integrate an independent F AUST code into the graph. In this example, the patcher already evaluated the code block to create two inlets and one outlet.

Sub-patcher

A patcher with outputs can be included in another patcher as a subprocess. We use F AUST 's with {...} expression which creates a local scope.

If we put the patcher of Figure 8 in a new patcher (Figure 9):

Iterations

F AUST offers four iteration functions: par, sum, prod and seq . Compared to other functions, they work with a variable that is local to their scope, which needs to be accessible in a local graph as a subprocess.

We propose a loop-like graph, using the same box to provide this scoped variable and to retrieve the sub-process graph. The iteration box will take from its inlet the sub-graph to repeat.


Romain Biard
email: romain.biard@univ-lyon1.fr

Claude Lefèvre
email: clefevre@ulb.ac.be

Impact of correlation crises in risk theory: asymptotics of finite-time ruin probabilities for heavy-tailed claim amounts when some independence and stationarity assumptions are relaxed 1

Keywords: Finite-time ruin probabilities, ruin theory, correlation crisis, Sub-prime effect, processes with dependent increments, asymptotic behavior, non-stationarity, heavy-tailed claim size distribution

In the renewal risk model, several strong hypotheses may be found too restrictive to model accurately the complex evolution of the reserves of an insurance company. In the case where claim sizes are heavy-tailed, we relax independence and stationarity assumptions and extend some asymptotic results on finite-time ruin probabilities, to take into account possible correlation crises like the one recently bred by the sub-prime crisis: claim amounts, in general assumed to be independent, may suddenly become strongly positively dependent. The impact of dependence and non-stationarity is analyzed and several concrete examples are given.

Introduction

In the Solvency II framework, computing the Solvency Capital Requirement (SCR) and the risk margin often involves approximation of finite-time ruin probabilities in internal models. For several kinds of insurance risks, heavy-tailed distributions may be used to model individual claim amounts. Pareto distributions, or more generally regular variation distributions are often preferred to log-normal distributions to fit empirical data. A natural way to tackle this kind of problem could be to use the classical compound renewal risk model with heavy-tailed claim size distribution. In the classical Sparre Andersen risk model, the classical risk process (R t ) t≥0 is defined as follows: for t ≥ 0,

R(t) = u + ct -S(t),
where u is the non-negative amount of initial reserves, c > 0 is the premium income rate. The cumulated claim amount up to time t is described by the compound renewal process

S(t) = N(t) i=1 X i ,
where amounts of claims X i , i = 1, 2, ... are non-negative independent, identically distributed random variables, distributed as X. As usual S t = 0 if N(t) = 0. The number of claims N(t) until t ≥ 0 is modeled by a renewal process (N(t)) t≥0 defined from the inter-occurrence times (T k ) k≥1 by N t = k≥1 1 {T k ≤t} . Claim amounts and inter-occurrence times times are assumed to be mutually independent. What we want to compute is the probability of ruin before time t with initial reserve u denoted by ψ(u, t): ψ(u, t) = P(∃s ∈ [0, t], R(s) < 0 | R(0) = u), u ≥ 0, t > 0.

Note that as we consider finite-time ruin probabilities, no profit condition has to be satisfied from a theoretical point of view. In this framework it is possible to adapt directly properties of sums of independent random variables with regular variation with index -α > 0 to derive the asymptotics of ψ(u, t) as u tends to infinity (see Section 2 for definitions and details):

ψ(u, t) ∼ 1 E(T 1 )
u -α as u → +∞.

(1.1)

The problem is that in real world, the mutual independence of X 1 , . . . , X n , . . . , T 1 , . . . , T n , . . . is not realistic for a certain number of reasons. First, the claim amounts X k , k ≥ 1 are not independent in practice, and may present complex forms of positive dependence: some factors may have an impact on those amounts; some claims of a certain type may have identical (in the sense of comonotonicity) severities depending on the outcomes of trials at the court. Second, weather or economic conditions can create as well strong positive dependence on claim amounts, which can be weakly dependent and independent in the usual regime, and suddenly become strongly positively dependent if a so-called correlation crisis breaks out. The marginal distribution of the claim amount may be modified as well, or remain identical. The most remarkable recent example of such a crisis is certainly the sub-prime crisis. Not only did the number of losses increase, but correlation was also raised. Dependence between claim amounts has been investigated by [START_REF] Ignatov | An improved finite-time ruin probability formula and its Mathematica implementation[END_REF] and by [START_REF] Lefèvre | Finite-time horizon ruin probabilities for independent or dependent claim amounts[END_REF] who provide recursive formulas that involve Appell-type properties for the finite-time ruin probability with dependent claim amounts. Sums of dependent random variables have been studied by many authors, in particular by [START_REF] Barbe | On the tail behavior of sums of dependent risks[END_REF] and by [START_REF] Kortschak | Asymptotic results for the sum of dependent non-identically distributed random variables[END_REF]. Dependence and non-stationarity have been partially taken into account for infinite-time ruin probabilities by [START_REF] Boudreault | On a risk model with dependence between interclaim arrivals and claim sizes[END_REF], and [START_REF] Albrecher | A ruin model with dependence between claim sizes and claim intervals[END_REF] who assume that the sequence (T k , X k ), k ≥ 1 is i.i.d. or that the (X k , T k 1 ), k ≥ 1 are i.i.d., and by [START_REF] Asmussen | Risk theory in a Markovian environment[END_REF] and many others who assume that the risk process is modulated by a Markovian environment process. The natural question that arises is the following: what is the impact of this dependence on the level of SCR in internal models of Solvency II, that is can we derive expressions equivalent to (1.1) when those independence and stationarity assumptions are relaxed? What is the impact of potential correlation crises on the asymptotic behavior of finite-time ruin probabilities for heavy-tailed claim amounts? This is the question we address in this paper, in the case where the X k , k ≥ 1 have distributions with regular variation. Our paper is organized as follows: in Section 2, we study a first example to show that the effect of positive dependence between claim amounts may vary a lot. In Section 3, we study a basic model with dependent claim amounts. We also consider stochastic correlation between claim amounts and use stochastic orderings to study the impact of stochastic correlation. In Section 4, we consider more complex dependence structures between the claim amounts. In Section 5, we use the results of the first Sections to analyze our main model, with possible outbreaks of correlation crises. We derive the corresponding of the finite-time ruin probability as the initial reserve tends to infinity. We illustrate our method on two examples in which the stationarity and independence properties mentioned above are relaxed. Throughout the paper, we assume that claim amount distributions belong to the regular variation class:

Definition 1.1 (Regular variation). A distribution function F is regularly varying of index -α with α ≥ 0 (written F ∈ R -α ) if lim x→∞ F(xy) F(x)
= y -α , for y > 0.

Before studying the correlation crisis model, let us first discuss preliminary models with static or stochastic dependence between claim amounts.

Varying effects of positive dependence

It is often believed that positive dependence between risks increases the probability of ruin over any given time horizon. This seems to be natural, for example, if the different claims are subjected to some exterior environment. Conclusions in that direction are indeed pointed out, e.g., in [START_REF] Cossette | The discrete-time risk model with correlated classes of business[END_REF], [START_REF] Frostig | Ordering ruin probabilities for dependent claim streams[END_REF] and [START_REF] Picard | Multirisks model and finite-time ruin probabilities[END_REF].

In this section, we show through a simple illustration that ruin probabilities can not only increase, but also decrease owing to the presence of positive dependence between claim amounts. Such a decreasing effect is possible in a different model where each claim size depends on the previous claim interval (as, e.g., in [START_REF] Albrecher | A ruin model with dependence between claim sizes and claim intervals[END_REF] and [START_REF] Boudreault | On a risk model with dependence between interclaim arrivals and claim sizes[END_REF]. In that case, positive dependence corresponds to a kind of mutualisation that plays a protective role. For the present example, the decreasing effect obtained comes rather from the claim size distribution itself as it is a consequence of the max-sum-equivalence property for heavy-tailed distributions.

Specifically, let us consider two particular risk models in which the successive claim amounts (X n ) n≥1 have the same distributions but are dependent in a comonotonic way. For both models, we will compare the ruin probability ψ(u, t) in the independent case, i.e. when the X n are independent identically distributed, and in a comonotonic case when all the X n = X 1 almost surely, i.e. under an extremal positive dependence.

(i) Let us assume that the successive claim amounts have a common biatomic distribution given by P(X 1 = 1) = 0.99 and P(X 1 = 1000) = 0.01.

(2.1)

Note that this law may be considered as heavy-tailed. Let us take λ = c = 1, an horizon of length t = 10 and u = 990 as initial surplus.

Intuitively, as the average number of claims up to t is equal to λt = 10, ruin will occur when u = 990 if there arises (at least) one large claim (of size 1000) before time t, or if there arise sufficiently many small claims (of size 1), this event being however of small probability. In addition, the probability of getting at least one large claim is clearly smaller in the comonotonic case than in the independent case. Thus, one expects that the ruin probability before time t = 10 will be also smaller in the comonotonic case.

Let (2.2)

In the comonotonic case, (2.2) yields the approximation ψ com a (990, 10) given by ψ com a (990, 10) = P(X 1 = 1000) P[1 ≤ N(10) ≤ 990],

while in the independent case, the corresponding approximation ψ ⊥ a (990, 10) is

ψ ⊥ a (990, 10) = 990 j=1 1 -P(X 1 = 1) j P[N(10) = j].
We so see that

[ψ ⊥ a -ψ com a ](990, 10) > P[2 ≤ N(10) ≤ 990] 1 -P(X 1 = 1) 2 -P(X 1 = 1000) 0.00227 >> 10 -500 > P[N(10) ≥ 991].
Thus, as for the exact ruin probabilities ψ ⊥ and ψ com , we get the inequality ψ ⊥ (990, 10) > ψ com (990, 10).

(ii) Let us consider another situation where the common claim amount distribution is still a biatomic law but now given by P(X 1 = 1) = 0.99 and P(X 1 = 10) = 0.01.

(2.3)

In comparison with (2.1), this law may be viewed as light-tailed. Let us take λ = c = 1, a n horizon of length t = 10 and u = 100 as initial surplus. This time, large claims (of size 10) will cause ruin before time t = 10 only if they are also relatively numerous, which is more probable in the comonotonic case. So, one expects intuitively that the comonotonic case could provide a higher ruin probability than the independent case. Let us establish this result. First, we observe that ruin is sure when there arise 11 large claims before t = 10. Thus, the ruin probability for the comonotonic case, ψ com (100, 10), satisfies ψ com (100, 10) > P[N(10) ≥ 11] P(X 1 = 10) 0.00417.

(2.4)

On the other hand, occurrence of ruin before t = 10 implies necessarily that the the total claim amount at t is larger than u = 100. Using (2.3), we then have (100-j)/9

k=0 j k [P(X 1 = 10)] k [P(X 1 = 1)] j-k .
Thus, the ruin probability for the independent model, ψ ⊥ (100, 10), satisfies

ψ ⊥ (100, 10) ≤ 1 - 100 j=0 P[N(10) = j]         (100-j)/9 k=0 j k [P(X 1 = 10)] k P(X 1 = 1)] j-k         10 -14 . (2.5)
Comparing (2.4) with (2.5) then gives the inequality ψ ⊥ (100, 10) < ψ com (100, 10).

Clearly, in general positive dependence will not affect ruin probabilities in a monotone way. Nevertheless, the two examples above show that asymptotically as u → ∞, such a property could be true for certain classes of dependent claim amounts with heavy-tailed distributions, as in example (i), or with light-tailed distributions, as in example (ii).

A basic situation with heavy-tailed claims

Following the previous illustration, we are going to establish that for certain heavy-tailed claim amount laws, positive dependence affects ruin probabilities in a monotone way, increasing or decreasing, when the initial surplus is large enough. For related questions on the asymptotic tail behaviour of sums of dependent risks, the reader is referred to, e.g., [START_REF] Alink | Diversification of aggregate dependent risks[END_REF], [START_REF] Albrecher | Tail asymptotics for the sum of two heavy-tailed dependent risks[END_REF], [START_REF] Kortschak | Asymptotic results for the sum of dependent non-identically distributed random variables[END_REF] and [START_REF] Barbe | On the tail behavior of sums of dependent risks[END_REF].

In the model under study, the different claim amounts have the same law but they are either independent or with a common level. Clearly, this assumption makes them exchangeable and positively correlated. A notation ∼ will mean that the ratio tends to 1 as u → ∞.

Proposition 3.1 Suppose that premiums arrive at a constant rate c and claims occur according to some point process N(t) t≥0 . Moreover, independently of this arrival claim process, the successive claim amounts (X n ) n≥1 are described by

X n = I n W 0 + (1 -I n )W n , n ≥ 1, (3.1)
where (W n ) n≥0 is a sequence of i.i.d positive random variables of distribution function F W with

F W ∈ R -α , α ≥ 0, (3.2)
and (I n ) n≥1 is a sequence of i.i.d Bernoulli random variables with

P(I 1 = 1) = p ∈ [0, 1], (3.3)
these two sequences being mutually independent. Let u be the initial reserve u and denote by ψ p (u, t) the corresponding ruin probability over any fixed finite-time horizon (0, t). Then, asymptotically for u large enough,

ψ p (u, t) ∼ (1 -p) E[N(t)] + E Z p (t) α F W (u + ct), (3.4)
where Z p (t) denotes a mixed binomial random variable Bin[N(t), p].

Proof. Let S p (t) = N(t) n=1
X n be the aggregate claim amount. To establish (3.4), we first calculate P[S p (t) > x] for large x, and we then approximate ψ p (u, t) by P[S p (t) > u].

Step 1. A key point is the convolution closure property and the max-sum-equivalence property of the regular variation class (see, e.g., [START_REF] Cai | On max-sum equivalence and convolution closure of heavy-tailed distributions and their applications[END_REF]). Specifically, when F 1 and F 2 belong to R -α , α ≥ 0, the convolution closure states that

F 1 * F 2 belongs to R -α ,
and the max-sum-equivalence means that

F 1 * F 2 (x) ∼ F 1 (x) + F 2 (x) for large x.
Since F W ∈ R -α by assumption, these properties allow us to write that for any k ≥ 1 and any pairwise distinct n 1 , ..., n k-j ≥ 1 with 0 ≤ j ≤ k -1,

P W n 1 + ... + W n k-j + jW 0 > x ∼ (k -j)F W (x) + F W x/ j ∼       k -j + F W x/ j F W (x)       F W (x) ∼ k -j + j α F W (x).
(3.5) Thus, (3.5) yields, for any k ≥ 1 and 0

≤ j ≤ k -1, P        S p (t) > x|N(t) = k, k i=1 I i = j        ∼ (k -j + j α ) F W (x).
(3.6)

We also have, for k ≥ 1 and j = k,

P        S p (t) > x|N(t) = k, k i=1 I i = k        = P(kW 0 > x) = F W (x/k) F W (x) F W (x) ∼ k α F W (x), (3.7)
and for k = j = 0,

P[S p (t) > x|N(t) = 0] = 0. (3.8)
>From (3.6), (3.7) and (3.8), and since N(t) t≥0 , (W n ) n≥0 , (I n ) n≥0 are mutually independent, we then get

P[S p (t) > x] ∼          ∞ k=1 P[N(t) = k] k j=0 k j p j (1 -p) k-j k -j + j α          F W (x).
(3.9)

Obviously, (3.9) can be rewritten as

P[S p (t) > x] ∼ (1 -p)E[N(t)] + E Z p (t) α F W (x), (3.10)
Step 2. Let us show that for any c, t > 0,

ψ p (u, t) ∼ P[S p (t) > u + ct], (3.11) as u → ∞. Indeed, we observe that 0 ≤ ψ p (u, t) -P[S p (t) > u + ct] ψ p (u, t) ≤ ψ p (u, t) -P[S p (t) > u + ct] P[S p (t) > u + ct] ≤ P[S p (t) > u] -P[S p (t) > u + ct] P[S p (t) > u + ct] ∼ F W (u) F W (u + ct) -1, ( 3
.12) using (3.10). For any x ∈ R, one knows that F W (u)/F W (u + x) → 1 as u → ∞ (see Lemma 1.3.5 in [START_REF] Embrechts | Modelling extremal events[END_REF]). Therefore, the approximation (3.11) follows from (3.12). Finally, combining (3.10) and (3.11) yields the formula (3.4).

By the approximation (3.4), ψ p (u, t) is simply given as a product of two distinct factors, the former in terms of N(t), p and α, and the latter in terms of F W , u and c. Note that the claim amount distribution plays a role in both factors. For example, choose F W (x) ∼ l(x) x -α , x > 0, where α > 1 and l(x) is slowly varying. This covers the Pareto law and the loggamma law, inter alia. From (3.4), if α increases,

F W (u + ct) decreases while E[Z p (t)] α increases.
Let us observe that in particular, (3.4) gives, if p = 0 (i.e. when X n = W n are i.i.d.),

ψ p (u, t) ∼ E[N(t)] F W (u + ct), while if p = 1 (i.e. when X n = W 0 for all n), ψ p (u, t) ∼ E[N(t)] α F W (u + ct).
Let us also indicate that by (3.1), any pair of claim amounts (X n , X m ), n m, has a correlation corr(X n , X m ) = p 2 var(W), which is positive and increasing in p as expected.

Proposition 3.1 can be extended to the case where the type of claim amount, either W n or W 0 , is influenced by a random environment. More precisely, suppose that the indicators (I n ) n≥1 have now a common random parameter P, with some distribution on [0, 1]. Let ψ P (u, t) be the ruin probability over (0, t). Then, as u → ∞,

ψ P (u, t) ∼ [1 -E(P)] E[N(t)] + E [Z P (t)] α F W (u + ct),
(3.13) Z P (t) being of mixed law MBin[N(t), P]. One easily checks that now, corr(X n , X m ) = E(P 2 ) var(W), n m, which is again positive but increasing in E(P 2 ) (i.e. in var(P) if the mean E(P) is fixed).

Let us examine how the law of P can affect ψ p (u, t). For that, we use the concept of s-convex stochastic ordering (see [START_REF] Lefèvre | Comparing sums of exchangeable Bernoulli random variables[END_REF] and [START_REF] Denuit | The s-convex orders among real random variables, with applications[END_REF]. By definition, given two random variables Y and Z, then for any s = 1, 2, . . .,

X ≤ D s-cx Y if E[φ(Y)] ≤ E[φ(Z)] for all s-convex function φ : D → R, (3.14)
i.e. in short, for any function φ on D whose s-th derivative exists and satisfies φ (s) ≥ 0. Note that the first s -1 moments of Y and Z are then necessarily equal. The order ≤ D 1-cx is just the stochastic order, ≤ D 2-cx is the usual convex order (which implies var(Y) ≤ var(Z)) and ≤ D 3-cx is also very popular (it means that Y has smaller right-side risk than Z). Put α [s] = α(α -1) . . . (αs + 1), and δ s,1 = 1 (0) if s = 1 ( 1). Property 3.2 Asymptotically for u large enough, given any s = 1, 2, . . .,

if α [s] ≤ (resp. ≥) δ s,1 , then P ≤ [0,1] s Q implies ψ P (u, t) ≥ (resp. ≤) ψ Q (u, t).
(3.15)

Proof. From (3.4), we have

ψ P (u, t) -ψ Q (u, t) ∼ E [Z P (t)] α -Z P (t) -E Z Q (t) α -Z Q (t) F W (u + ct). (3.16)
A binomial law Bin(n, p) is stochastically s-convex in the parameter p (see [START_REF] Dnuit | Stochastic s-(increasing) convexity. Generalized Convexity and Generalized Monotonicity[END_REF]). Thus, if P ≤ [0,1] s Q, then MBin(n, P) ≤ {0,...,n} s MBin(n, Q), so that Z P (t) ≤ N s Z Q (t). Now, consider the function f (x) ≡ x αx, x ∈ {0, 1, . . .}. We see that f (x) (resp.f (x)) is s-convex when α [s] ≥ (resp. ≤) δ s,1 . Therefore, from (3.16), we deduce the announced implication (3.15). So, Property 3.2 states that if P ≤

[0,1] 1 Q, then ψ P (u, t) ≥ (≤) ψ Q (u, t) for α ≤ (≥) 1.
In particular, this is true if P and Q reduce to two constants p and q such that p ≤ q.

An identical conclusion holds under the condition P ≤

[0,1] 2 Q, but remember that E(P) = E(Q)
here. For instance, one has P min 2

≤ [0,1] 2 P ≤ [0,1] 2 P max 2
, where P min 2 = E(P) and P max 2 is a variable with two atoms, 0 and 1, such that P(P max 2 = 1) = E(P). This yields

ψ P min 2 (u, t) ≥ (≤) ψ P (u, t) ≥ (≤) ψ P max 2 (u, t) for α ≤ (≥) 1, where ψ P max 2 (u, t) ∼ [1 -E(P)] {E[N(t)] + E[N(t)] α } F W (u + ct). If P ≤ [0,1] 3 Q, then ψ P (u, t) ≥ (≤) ψ Q (u, t) for α ≤ 1 or α ≥ 2 (1 ≤ α ≤ 2).
Let us recall that this time, E(P) = E(Q) and E(P 2 ) = E(Q 2 ). For instance, one might now use the inequality P min 3

≤ [0,1] 3 P ≤ [0,1] 3 P max
3 , where P min 3 is a variable with two atoms, 0 and E(P 2 )/E(P), such that P(P min 3 = 0) = var(P)/E(P 2 ), and P max 3 is a variable with two atoms, [E(P) -E(P 2 )]/[1 -E(P)] and 1, such that P(P max

More complex dependent cases

In this part, the framework of Section 3 is retained except that the claim amounts (X i ) i≥1 are no longer of the form (3.1), but with a dependence structure described by a specific copula. Denote by C (n) the copula of the vector (X 1 , X 2 , ..., X n ). To satisfy the condition of independence, the following relation must be hold

C (n) (u 1 , ..., u n-1 , 1) = C (n-1) (u 1 , ..., u n-1 ) , n ≥ 2.
(4.1)

A non-standard class of copulas

In section 3 we studied the asymptotic behavior of the finite-time ruin probability ψ(u, t) from initial reserve u within time t for regular variation claim amounts X i , i ≥ 0 such that each X i is equal to W 0 with probability p ∈ [0, 1] or equal to W i with probability 1p, where the W k , k ≥ 0 are i.i.d. regular variation random variables. We extend here the result to the more general model case where for n ≥ 2, (X 1 , . . . , X n ) has again identical marginals but with copula C (n) defined below. Let P ([1, n]) denotes the set of partitions of [1, n]. For A (n) ∈ P ([1, n]), consider all the subsets a in A (n) and define the associated copula

C A (n) (u 1 , . . . , u n ) = a∈A (n) min k∈a (u k ). (4.2)
Then, the copula C (n) is represented as a weighted average of these copulas over all possible partitions A (n) , i.e.

C (n) = A (n) ∈P([1,n]) λ A (n) C A (n) , (4.3)
where the nonnegative weights must satisfies, for all n ≥ 1 and A (n) ∈ P[1, n] :

             A (n) ∈P([1,n]) λ A (n) = 1, A (n+1) ∈P[1,n+1] A (n+1) \{n+1}=A (n) λ A (n+1) = λ A (n) , (4.4)
A (n+1) \{n + 1} meaning that {n + 1} is removed from all subsets of A (n+1) that contain {n + 1}.

Proposition 4.1 For all n ≥ 2, C (n) defined by (4.3) satisfies the condition (4.1).

Proof. By (4.2) and (4.3), we get

C (n) (u 1 , ..., u n-1 , 1) = A (n) ∈P([1,n]) λ A (n) C A (n) (u 1 , ..., u n-1 , 1) = A (n) ∈P([1,n]) λ A (n) a∈A (n) min k∈a\{n} (u k ) = A (n-1) ∈P([1,n-1]) A (n) ∈P[1,n] A (n) \{n}=A (n-1) λ A (n) a∈A (n) min k∈a\{n} (u k ) = A (n-1) ∈P([1,n-1]) B∈P[1,n] B\{n}=A (n-1) λ A (n) a∈A (n-1) min k∈a (u k ) = A (n-1) ∈P([1,n-1]) λ A (n-1) a∈A (n-1) min k∈a (u k ) = C n-1 (u 1 , ..., u n-1 ),
hence (4.1).

Proposition 4.2 For claim amounts (X i ) i≥1 that have the same marginal distribution F with F ∈ R -α , α > 0, and such that (X 1 , ..., X n ), n ≥ 2 has a copula C (n) given by (4.3), then for large u and any t > 0, we have

ψ(u, t) ∼          ∞ k=1 P [N(t) = k] A (k) ∈P([1,k]) λ A (k)        a∈A (k) Card(a) α                 F(u + ct). (4.5)
Proof. As in the proof of Proposition 3.1, we start by computing P (S t > x). For all n ≥ 1 and

A (n) ∈ P[1, n] denote (X (A (n) ) 1 , ..., X (A (n) ) n
) a copy of the vector (X 1 , . . . , X n ) with a dependence structure described by the copula C A (n) defined in (4.2). For all k ≥ 1 and x > 0, we have

P (X 1 + ... + X k > x) = A (k) ∈P[1,k] λ A (k) P X (A (k) ) 1 + ... + X (A (k) ) k > x
For all subsets a ∈ A (n) , denote X (A (n) ,a) the common variable the variables in (X

(A (n) ) 1 , ..., X (A (n) ) n
) whose index belongs to a are equal to ; then,

P (X 1 + ... + X k > x) = A (k) ∈P[1,k] λ A (k) P        a∈A Card(a)X (A (k) ,a) > x        .
Arguing as in Step 1 of Proposition 3.1, we obtain that

P (X 1 + ... + X k > x) ∼ A (k) ∈P[1,k] λ A (k) a∈A (k) P Card(a)X (A (k) ,a) > x ∼         A (k) ∈P[1,k] λ A (k)        a∈A (k) Card(a) α                F(x).
Thus, we may conclude in the same way as in Step 2 of Proposition 3.1. We note that the sequence (λ A (k) ) k≥1 can be built using a tree and appropriate transition probabilities. For all k ≥ 1, A (k) ∈ P([1, k]) and A (k+1) ∈ P([1, k + 1]), let p A (k) →A ( k+1) be the probability that (X 1 , ..., X k+1 ) has its dependence structure described by C A (k+1) knowing that (X 1 , ..., X k ) has its dependence structure described by C A (k) . This is illustrated in Figure 1. Then, for all k ≥ 1,

A (k) ∈ P([1, k]), we have λ A (k) = k-1 i=1 p A (i) →A (i+1) .

Classical copulas

A general result

Definition 4.3 (Multivariate regular variation). A random vector X = (X 1 , ..., X n ) belongs to MR -α , α ≥ 0 if there exists a θ ∈ S n-1 , where S n-1 is the unit sphere with respect to a norm

|•|, such that P (|X| > tu, X/ |X| ∈ •) P (|X| > u) v → t -α P S n-1 (θ ∈ •) ,
where v → denotes vague convergence on S n-1 .

Definition 4.4 (Extreme value copula)

. A copula such that C(u t 1 , ..., u t k ) = C t (u 1 , ..., u k ) , ∀t > 0, is called an extreme value copula. Proposition 4.6 For claim amounts (X i ) i≥1 , such that for all n ≥ 1, (X 1 , ..., X n ) ∈ MR -α with the same marginal distribution F and their dependence structure is described by a copula C (n) which belongs to the domain of attraction of C (n) * , then for large u and any t > 0,

ψ(u, t) ∼        ∞ k=1 P [N(t) = k] q k,α        F(u + ct), (4.6)
where

q k,α = T k p 1/α 1 + ... + p 1/α k α dU k (p),
where T k denotes the k-dimensional unit simplex and U k is the measure such that :

C (k) * (x 1 , .., x k ) = exp - T k max 1≤j≤k -p j log(x j ) dU k (p) .
Proof. This result follows directly from a theorem of [START_REF] Barbe | On the tail behavior of sums of dependent risks[END_REF]. Indeed under the assumptions made above, these authors show that

P         k p=1 X p > x         ∼ q k,α F(x).
With the same method as in Proposition 3.1 (step 1 and step 2), we then obtain the approximation 4.6. Remark. Another relation links C * with q k,α . From [START_REF] Resnick | The extremal dependence measure and asymptotic independence[END_REF] and [START_REF] Barbe | On the tail behavior of sums of dependent risks[END_REF], there exists a Radon measure ν on the punctured space E = [0, ∞] k \{0} such that q k,α = ν(Ω), (4.7)

where

Ω = (p 1 , ..., p k ) ∈ [0, ∞) k : p 1/α 1 + ... + p 1/α k > 1 and ν([0, x] c ) = -log C * (e -x ) , ∀x ∈ [0, ∞) k . (4.8)
Property 4.7 Under the assumptions of Proposition 4.6, comparing the case where (X 1 , . . . , X n ) ∈ MR -α , with the case where (X 1 , . . . ,

X n ) ∈ MR -β yield for large u α ≤ (resp. ≥ ) β ⇒ ψ α (u, t) ≤ (resp. ≥ ) ψ β (u, t).
Proof. Directly by checking that for fixed p ∈ T k , p 1/α 1 + ... + p 1/α k α is an increasing function of α.

Independent copula

Definition 4.8 The independent copula is

C ind (u 1 , ..., u k ) = k i=1 u i .
(4.9)

Remark. The independent copula is an extreme copula since

C t ind (u 1 , ..., u k ) =        d i=1 u i        t = d i=1 u t i = C ind (u t 1 , ..., u t k ).
It is easily seen that (4.6) simplifies here as follow.

Proposition 4.9 Under the assumptions of Proposition 4.6, with in addition C (n) ind as copula, then for large u ψ(u, t) ∼ λtF(u + ct).

Fréchet upper bound

Definition 4.10 The comonotonic copula is

C com (u 1 , ..., u k ) = min(u 1 , ..., u k ). (4.10)
Remark. The comonotonic copula is an extreme copula since

C t com (u 1 , ..., u k ) = min(u 1 , ..., u k ) t = min(u t 1 , ..., u t k ) = C com (u t 1 , ..., u t k )
Proposition 4.11 Under the assumptions of Proposition 4.6, with in addition C (n) com as copula, then for large u

ψ(u, t) ∼ E[N(t)] α F(u + ct).

Gaussian copula

Definition 4.12 The Gaussian or normal copula is

C Ga,Σ (u 1 , ..., u k ) = Φ k Σ Φ -1 (u 1 ), ..., Φ -1 (u k ) , (4.11)
where Φ k Σ denotes the joint distribution function of the k-variate standard normal distribution with correlation matrix Σ and Φ -1 denotes the inverse of the distribution function of the univariate standard normal distribution.

Remark. The Gaussian copula satisfies the condition (4.1) if the correlation matrix is adapted, that is if

C (k) Ga,Σ k (u 1 , ..., u k-1 , u k = 1) = C (k-1) Ga,Σ k-1 (u 1 , ..., u k-1 ), (4.12)
with Σ k-1 is formed with the first k -1 rows and columns of Σ k .

Lemma 4.13 [START_REF] Demarta | Diploma Thesis: Multivariate Extreme Value Theory and Copulas[END_REF]) The Gaussian copula belongs to the domain of attraction of the independent copula.

Proposition 4.14 Under the assumptions of Proposition 4.6, with in addition C (n) Ga,Σ n as copula, such 4.12 is satisfied, then for large u ψ(u, t) ∼ λtF(u + ct).

Archimedean copulas

Definition 4.15 Let φ : [0, 1] → [0, ∞] be continuous and strictly decreasing with φ(0) ≤ ∞ and φ(1) = 0. A pseudo inverse of φ is defined as

φ [-1] (t) = φ -1 (t) 0 ≤ t ≤ φ(0) 0 φ(0) ≤ t ≤ ∞ ,
where φ -1 is the classical inverse of φ. Functions φ are called generators of Archimedean copulas. If φ(0) = ∞, then φ is called a strict generator.

Definition 4.16 A decreasing (resp. increasing) function f : R → R is completely monotonic on an interval I if it is continuous on I and satisfies

(-1) k d k dt k f (t) ≥ 0, resp. (-1) k-1 d k dt k f (t) ≥ 0 ,
for all t in the interior of I and any k ≥ 1.

As a consequence, if f is completely monotonic on [0, ∞] and f (c) = 0 for some c > 0, then f must be identically zero on [0, ∞]. So if the pseudo-inverse φ [-1] of an Archimedean generator φ is completely monotonic, it must be positive on [0, ∞], i.e. φ is a strict generator and φ [-1] = φ -1 . Lemma 4.17 (see [START_REF] Nelsen | An Introduction to Copulas[END_REF]) Let φ be a continuous strictly decreasing function from

[0, 1] to [0, ∞] such that φ(0) = ∞ and φ(1) = 0. If C is the function from [0, 1] d to [0, 1] given by C φ (u 1 , ..., u k ) = φ [-1] φ(u 1 ) + ... + φ(u k ) , (4.13)
then C is a k-copula for all k ≥ 2 if and only if φ [-1] is completely monotonic on [0, ∞].

C φ given by (4.13) is named an Archimedean copula with generator φ. Since φ(1) = 0, the condition (4.1) is well satisfied. Proposition 4.18 Under the assumptions of Proposition 4.6, with in addition C (n) φ as copula, such that φ(1 -1/t) ∈ R -β for some β > 1, then for large u

ψ(u, t) ∼        ∞ k=1 P [N(t) = k] T k        k i=1 p 1/α i        α u k,β (p)dp        F(u + ct), where u k,β (p) = k-1 i=1 (iβ -1) k i=1 p i -β-1 k i=1 p -β i 1/β-k
.

Proof. This follows from [START_REF] Barbe | On the tail behavior of sums of dependent risks[END_REF] who proved that

P (X 1 + ... + X k > x) ∼        ∞ k=1 P [N(t) = k] T k        k i=1 p 1/α i        α u k,β (p)dp        F(x),
in the above notation. γ i = 1 and if we assume that C i ∈ CDA(C * i ) for i = 1, ..., n, and C * i is linked with a q (i) k,α like in (4.7) and (4.8). Then, for large u,

Mixture of copulas

ψ(u, t) ∼        ∞ k=1 P [N(t) = k] n i=1 γ i q (i) k,α        F(u + ct). (4.14)
Proof. This is immediate since if (X (i) 1 , ..., X (i) k ) is a copy of (X 1 , ..., X k ) with dependence structure described by C i , then, for all k ≥ 1 and large x,

P (X 1 + ... + X k > x) = n i=1 γ i P(X (i) 1 + ... + X (i) k > x) ∼       n i=1 γ i q (i) k,α       F(x).
Example. Let us consider a sequence of r.v. (X i ) i≥1 such that for i ≥ 1,

• P(X i = Y i ) = p, • P(X i = Z i ) = 1 -p,
where p ∈ [0, 1] and for all k ≥ 1, (Z 1 , ..., Z k ) and (Y 1 , ..., Y k ) belongs to MR -α with common cdf F. The dependence structure of (Y 1 , ..., Y k ) is described by a Gaussian copula which satisfies (4.1) and the dependence structure of (Z 1 , ..., Z k ) is described by the copula (4.3). Now, consider the risk process R(t) = u + ct -N(t) i=1 X i . By (4.5) and (4.14) we get large u that

ψ(u, t) ∼          pλt + (1 -p) ∞ k=1 P [N(t) = k] A (k) ∈P([1,k]) λ A (k)        a∈A (k) Card(a) α                 F(u + ct).
In particular we deduce that α > 1 resp. α < 1 ⇒ ψ(u, t)increases (resp. decreases) with p,

and if α = 1, ψ(u, t) = λtF(u + ct). Indeed, ∂ψ ∂p =          λt - ∞ k=1 P [N(t) = k] A (k) ∈P([1,k]) λ A (k)        a∈A (k) Card(a) α                 F(u + ct),
and we see that for all k ≥ 1 and

A ∈ P([1, k]), a∈A (k) Card(a) α          > < = k if          α > 1 α < 1 α = 1
, and

∞ k=1 P [N(t) = k] A (k) ∈P([1,k]) λ A (k) k = λt.

Dependence through an environment process

In this Section, we aim at taking into account the fact that one or several correlation crises may occur: claim amounts, in general independent or weakly dependent, may suddenly become comonotone or strongly positively dependent. The claim size distribution may become more dangerous as well. To this end, the dependence between claim amounts and the claim size distribution and intensity are modulated by a Markovian environment process. More precisely,

• there exists a Markovian environment process (J(t)) t≥0 with states i = 1, . . . , J ≥ 2 -with initial distribution π 0 , -and transition rate matrix Q.

• for i = 1, ..., J the claim amounts (X i n ) n≥1 are J independent sequences defined as in Proposition 3.1, i.e.

X i n = I i n W i 0 + (1 -I i n )W i n , n ≥ 1, -where the (W i n ) n≥0 are i.i.d. r.v.'s with cdf F i W ∈ R -α i , -the (I i n ) n≥1 are i.i.d. Bernoulli r.v.'s with parameter p i ∈ [0, 1], -the (W i n ) n≥0
, are independent from the (I i k ) k≥1 , -and the (W i n ) n≥0 and (I i k ) k≥1 are independent from a Poisson process N i (t) with parameter λ i .

Let us define the J independent processes

Y i (t) = c i t - N i (t) m i =1 X i m i , i = 1, ..., J.
Let T p be the instant of the p th jump of the process (J(t)) t≥0 , and define (R(t)) t≥0 by

R(t) = u + p≥1 1≤i≤n Y i (T p ) -Y i (T p-1 ) 1 {J T p-1 =i,T p ≤t} + p≥1 1≤i≤n Y i (t) -Y i (T p-1 ) 1 {J T p-1 =i,T p-1 ≤t<T p } .
Thus, we have built a modulated risk process. For an illustration see figure 2.

We now discuss our model with two situations of special interest. In the first one, the crisis causes the claim amounts to be more dangerous. In the second one, one pure correlation crisis is considered : the dependence between claim amounts increases, but the claim size distribution remains unchanged.

Correlation and severity crisis: case where one state dominates

In this Subsection, we suppose that the state 1 is more hazardous then the others states, that is to, for all i ≥ 2, we have α 1 < α i . Proposition 5.1 As u → +∞, we have for any t > 0

ψ(u, t) ∼        J i=1 π 0 (i)E M ⊥ i + M com i α 1        F1 (u), (5.1)
• where W 1 i (t) is the time spent by the environment process in state 1 during [0, t] given that J(0) = i,

• M ⊥ i follows a mixed Poisson distribution with random parameter λ 1 (1p 1 )W 1 i (t), • and M com i follows a mixed Poisson distribution with random parameter λ 1 p 1 W 1 i (t).

Proof. First, rewrite R(t) as follow,

R(t) = u + C(t) -S(t),
where

C(t) = p≥1 1≤i≤J c i (T p -T p-1 ) 1 {J T p-1 =i,T p ≤t} + p≥1 1≤i≤J
where for j = 1, ..., J and t > 0, W j (t) is the time spent by the environment process in state j during [0, t]. Thus,

P(R(t) < 0) = J j=1 π 0 (i)P(S(t) > u + C(t) |J(0) = i) = J j=1 π 0 (i)P( S(t) > u + C(t) |J(0) = i).
Let us define for i, j = 1, ..., J and t

> 0, W       N com j (W j i (t)) m j =1 W j 0 + N ⊥ j (W j i (t)) m j =1 W j m j > u          
, using the thinning property of the Poisson process and where N com j (W j i (t)) is a Poisson process with parameter λ j p j W j i (t) and N ⊥ j (W j i (t)) is a Poisson process with parameter λ j p j W j i (t). For i, j = 1, ...J, t > 0 and large u, we have

P           N com j (W j i (t)) m j =1 W j 0 > u           = P N com j (W j i (t))W j 0 > u = ∞ n=0 P N com j (W j i (t)) = n P W j 0 > u n ∼ ∞ n=0 P N com j (W j i (t)) = n n α j F(u) ∼ E(N com j (W j i (t))) α j F j (u) ∈ R -α j , and
P           N ⊥ j (W j i (t)) m j =1 W j m j > u           = ∞ n=0 P N ⊥ j (W j i (t)) = n P         n m j =1 W j m j > u         (5.2) ∼ ∞ n=0 P N ⊥ j (W j i (t)) = n nF(u)
∼ E(N ⊥ j (W j i (t)))F j (u) ∈ R α j .

(5.3)

Since for all i, j = 1, ...J N com j (W j i (t)) m j =1 W j 0 and

N ⊥ j (W j i (t)) m j =1
W j m j are independent and belong to R -α j , we have for t > 0 and large u,

P         N j (W j (t)) m j =1 X j m j > u |J(0) = i         ∼ E(N ⊥ j (W j i (t))) + E(N com j (W j i (t))) α j F j (u) ∈ R -α j
Since for all j = 2, ..., J, α 1 < α j , and for all i, j = 1, ..., J, i j (X i m i ) m i ≥1 and (X j m j ) m j ≥1 we have for t > 0 and large u, P (S(t) > u) =

m 1 =1 X 1 m 1 > u |J(0) = i) ∼ J j=1 π 0 (i) E(N ⊥ 1 (W 1 i (t))) + E(N com 1 (W 1 i (t))) α 1 F 1 (u) ∼        J i=1 π 0 (i)E M ⊥ i + M com i α 1        F1 (u).
and since for all s ∈ R, we have for large u F 1 (u + s) ∼ F 1 (u),

P       S(t) > u + sup j=1,...,J c j t       ∼        J i=1 π 0 (i)E M ⊥ i + M com i α 1        F1 (u).
We conclude with the inequality : The next Theorem gives a way to compute the moments of N com (t) when α 1 ∈ N using a result in [START_REF] Castella | Moments analysis in Markov reward models[END_REF] Proposition 5.2 If besides α 1 ∈ N, we have

P       S(t) > u + sup
E M ⊥ i = λ 1 (1 -p 1 )E W 1 i (t) = λ 1 (1 -p 1 )D 1 i (1, t),
and

E M com i α 1 = E        α 1 k=0 S(α 1 , k)(λ 1 p 1 ) k W 1 i (t) k        = α 1 k=0 S(α 1 , k)(λ 1 p 1 ) k D 1 i (k, t),
where S(α 1 , k) is the (α 1 , k) Stirling number of the second kind, and where

for m ≥ 1, D 1 i (m, t) = E W 1 i (t) m | J(0) = i
is the i th component of vector D 1 (m, t) defined by D 1 (0, t) = 1 and for m ≥ 1, D 1 (m, t) = r t 0 e Q(t-u) A 11 D 1 (m -1, u)du where A 11 is J × J with coeff. δ i1 δ j1 .

Proof. [START_REF] Castella | Moments analysis in Markov reward models[END_REF] gives the way to compute D 1 i (m, t) for m ≥ 1 and i = 1, ..., J. Moreover we know that the moments of a Poisson distribution X with parameter λ are given by, for m ≥ 1, EX m = m k=1 S(m, k)λ k .

Pure correlation crisis: a typical case

In this Subsection, let us assume that there exist three states such that • in state 1, the X 1 n , n ≥ 1 are i.i.d.,

• in state 2, there is a light correlation: the X 2 n , n ≥ 1 have Gaussian copulas,

• and in state 3, the X 3 n , n ≥ 1 are given by the basic dependence model with parameter p 3 .

Moreover claim amounts are identically distributed with common c.d.f. F such that F ∈ R -α for some α > 0 and for all n ≥ 1 (X 2 1 , ..., X 2 n ) belongs to MR -α .

Proposition 5.3 We have for any t > 0, as u → +∞,

ψ(u, t) ∼        3 i=1 π 0 (i)[λ 1 D 1 i (1, t) + λ 2 D 2 i (1, t) + λ 3 1 -p 3 D 3 i (1, t) +

  10) = j and at least one these j claims is of size 1000].

  10) = j, S(10) ≤ 100]. For 0 ≤ j ≤ 10, the event [N(10) = j, S(10) ≤ 100] is equivalent to [N(10) = j]. For 11 ≤ j ≤ 100, the event [N(10) = j, S(10) ≤ 100] means that the number of large claims, k say, satisfies the relation 10k + ( jk) ≤ 100; so, in the independent case, P[N(10) = j, S(10) ≤ 100] = P[N(10) = j]

Figure 1 :

 1 Figure 1: Step-by-step construction of the sequence (λ A (k) ) k≥1 with transition probabilities p A (k) →A (k+1) .

  Definition 4.5 (Domain of attraction of copula). Let C be a copula and let C * be an extreme value copula. The copula C belongs to the domain of attraction of C * , written C ∈ CDA(C * ), if for all u lim m→∞ C m (u 1/m ) = C * (u).

Figure 2 :

 2 Figure 2: A typical modulated risk process with two states (red and blue).

  P(R(t) < 0) ≤ P (S(t) > u) .

  Proposition 4.19 Under the assumptions of Proposition 4.6, with in addition C =

		n
		γ i C i as
	n	i=1
	copula with γ i ∈ R + and
	i=1

= 1) = var(P)/{[(1 -E(P)] 2 + var(P)}.

We conclude with Proposition 5.2. Similar results may be obtained with classical copulas, and dependence between different state processes.