Analyse the central tendency of a cantilever beam

In this example we perform a central tendency analysis of a random variable Y using the various methods available. We consider the cantilever beam example and show how to use the TaylorExpansionMoments and ExpectationSimulationAlgorithm classes.

from openturns.usecases import cantilever_beam
import openturns as ot
import openturns.viewer as otv

We first load the data class from the usecases module :

We want to create the random variable of interest Y=g(X) where g(.) is the physical model and X is the input vectors.

We create the input parameters distribution and make a random vector. For the sake of this example, we consider an independent copula.

f is the cantilever beam model :

The random variable of interest Y is then

Taylor expansion

Perform Taylor approximation to get the expected value of Y and the importance factors.

taylor = ot.TaylorExpansionMoments(Y)
taylor_mean_fo = taylor.getMeanFirstOrder()
taylor_mean_so = taylor.getMeanSecondOrder()
taylor_cov = taylor.getCovariance()
taylor_if = taylor.getImportanceFactors()
print("model evaluation calls number=", f.getGradientCallsNumber())
print("model gradient calls number=", f.getGradientCallsNumber())
print("model hessian calls number=", f.getHessianCallsNumber())
print("taylor mean first order=", taylor_mean_fo)
print("taylor variance=", taylor_cov)
print("taylor importance factors=", taylor_if)
model evaluation calls number= 1
model gradient calls number= 1
model hessian calls number= 1
taylor mean first order= [0.170111]
taylor variance= [[ 0.00041128 ]]
taylor importance factors= [E : 0.0471628, F : 0.703601, L : 0.0811537, I : 0.168082]
Importance Factors from Taylor expansions - Y

We see that, at first order, the variable F explains about 70% of the variance of the output Y. On the other hand, the variable E is the least significant in the variance of the output: E only explains about 5% of the output variance.

Monte-Carlo simulation

Perform a Monte Carlo simulation of Y to estimate its mean.

model evaluation calls number= 1001
monte carlo mean= [0.170757] var= [4.13399e-07]

Central dispersion analysis based on a sample

Directly compute statistical moments based on a sample of Y. Sometimes the probabilistic model is not available and the study needs to start from the data.

mean= [0.171122] stddev= [0.0208915] quantile@95% [0.207386]
graph = ot.KernelSmoothing().build(Y_s).drawPDF()
graph.setTitle("Kernel smoothing approximation of the output distribution")
view = otv.View(graph)
Kernel smoothing approximation of the output distribution