{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Create a composed distribution" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this example we are going to create a multidimensional distribution described by its marginal distributions and optionally its dependence structure (a particular copula)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from __future__ import print_function\n", "import openturns as ot" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# create the marginals\n", "marginals = [ot.Normal(), ot.Gumbel()]" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# create the multivariate distribution, assume no dependency structure\n", "distribution = ot.ComposedDistribution(marginals)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n" ], "text/plain": [ "class=Graph name=[X0,X1] iso-PDF implementation=class=GraphImplementation name=[X0,X1] iso-PDF title=[X0,X1] iso-PDF xTitle=X0 yTitle=X1 axes=ON grid=ON legendposition=topright legendFontSize=1 drawables=[class=Drawable name=[X0,X1] iso-PDF implementation=class=Contour name=[X0,X1] iso-PDF x=class=Sample name=Unnamed implementation=class=SampleImplementation name=Unnamed size=129 dimension=1 data=[[-3.73116],[-3.67286],[-3.61456],[-3.55626],[-3.49796],[-3.43966],[-3.38136],[-3.32306],[-3.26477],[-3.20647],[-3.14817],[-3.08987],[-3.03157],[-2.97327],[-2.91497],[-2.85667],[-2.79837],[-2.74007],[-2.68177],[-2.62347],[-2.56517],[-2.50687],[-2.44857],[-2.39027],[-2.33198],[-2.27368],[-2.21538],[-2.15708],[-2.09878],[-2.04048],[-1.98218],[-1.92388],[-1.86558],[-1.80728],[-1.74898],[-1.69068],[-1.63238],[-1.57408],[-1.51578],[-1.45748],[-1.39919],[-1.34089],[-1.28259],[-1.22429],[-1.16599],[-1.10769],[-1.04939],[-0.991089],[-0.93279],[-0.874491],[-0.816191],[-0.757892],[-0.699593],[-0.641293],[-0.582994],[-0.524694],[-0.466395],[-0.408096],[-0.349796],[-0.291497],[-0.233198],[-0.174898],[-0.116599],[-0.0582994],[0],[0.0582994],[0.116599],[0.174898],[0.233198],[0.291497],[0.349796],[0.408096],[0.466395],[0.524694],[0.582994],[0.641293],[0.699593],[0.757892],[0.816191],[0.874491],[0.93279],[0.991089],[1.04939],[1.10769],[1.16599],[1.22429],[1.28259],[1.34089],[1.39919],[1.45748],[1.51578],[1.57408],[1.63238],[1.69068],[1.74898],[1.80728],[1.86558],[1.92388],[1.98218],[2.04048],[2.09878],[2.15708],[2.21538],[2.27368],[2.33198],[2.39027],[2.44857],[2.50687],[2.56517],[2.62347],[2.68177],[2.74007],[2.79837],[2.85667],[2.91497],[2.97327],[3.03157],[3.08987],[3.14817],[3.20647],[3.26477],[3.32306],[3.38136],[3.43966],[3.49796],[3.55626],[3.61456],[3.67286],[3.73116]] y=class=Sample name=Unnamed implementation=class=SampleImplementation name=Unnamed size=129 dimension=1 data=[[-3.47309],[-3.4068],[-3.34052],[-3.27423],[-3.20795],[-3.14166],[-3.07538],[-3.00909],[-2.94281],[-2.87652],[-2.81024],[-2.74395],[-2.67766],[-2.61138],[-2.54509],[-2.47881],[-2.41252],[-2.34624],[-2.27995],[-2.21367],[-2.14738],[-2.0811],[-2.01481],[-1.94852],[-1.88224],[-1.81595],[-1.74967],[-1.68338],[-1.6171],[-1.55081],[-1.48453],[-1.41824],[-1.35196],[-1.28567],[-1.21938],[-1.1531],[-1.08681],[-1.02053],[-0.954243],[-0.887957],[-0.821672],[-0.755386],[-0.689101],[-0.622815],[-0.55653],[-0.490245],[-0.423959],[-0.357674],[-0.291388],[-0.225103],[-0.158817],[-0.0925318],[-0.0262464],[0.0400391],[0.106325],[0.17261],[0.238895],[0.305181],[0.371466],[0.437752],[0.504037],[0.570323],[0.636608],[0.702894],[0.769179],[0.835464],[0.90175],[0.968035],[1.03432],[1.10061],[1.16689],[1.23318],[1.29946],[1.36575],[1.43203],[1.49832],[1.5646],[1.63089],[1.69718],[1.76346],[1.82975],[1.89603],[1.96232],[2.0286],[2.09489],[2.16117],[2.22746],[2.29374],[2.36003],[2.42632],[2.4926],[2.55889],[2.62517],[2.69146],[2.75774],[2.82403],[2.89031],[2.9566],[3.02288],[3.08917],[3.15546],[3.22174],[3.28803],[3.35431],[3.4206],[3.48688],[3.55317],[3.61945],[3.68574],[3.75202],[3.81831],[3.8846],[3.95088],[4.01717],[4.08345],[4.14974],[4.21602],[4.28231],[4.34859],[4.41488],[4.48116],[4.54745],[4.61374],[4.68002],[4.74631],[4.81259],[4.87888],[4.94516],[5.01145]] levels=class=Point name=Unnamed dimension=10 values=[2.55855e-10,1.09564e-05,0.000106015,0.000378586,0.00114454,0.00284155,0.00624559,0.0143045,0.0346523,0.0891452] labels=[2.55855e-10,1.09564e-05,0.000106015,0.000378586,0.00114454,0.00284155,0.00624559,0.0143045,0.0346523,0.0891452] show labels=true derived from class=DrawableImplementation name=[X0,X1] iso-PDF legend=[X0,X1] iso-PDF data=class=Sample name=Unnamed implementation=class=SampleImplementation name=Unnamed size=16641 dimension=1 data=[[1.21962e-16],[1.51341e-16],[1.8716e-16],...,[3.84178e-06],[3.10654e-06],[2.50349e-06]] color=blue fillStyle=solid lineStyle=solid pointStyle=plus lineWidth=1]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# draw PDF\n", "distribution.drawPDF()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
NormalCopula(R = [[ 1 0.3 ]
\n",
" [ 0.3 1 ]])
\n",
"