USE R: 使用sensitivity包中的fast99命令进行局部敏感性分析

R中进行敏感性分析的包sensitivity中的fast的全称是Extended Fourier Amplitude Sensitivity Test。

fast99 implements the so-called "extended-FAST" method (Saltelli et al. 1999). This method allows the estimation of first order and total Sobol' indices for all the factors (alltogether 2p indices, where p is the number of factors) at a total cost of n * p simulations.

 # install.packages('sensitivity')library(sensitivity)x <- fast99(model = ishigami.fun, factors = c('V1','V2','V3'), n = 1000,            q = "qunif", q.arg = list(list(min = -pi, max = pi),                                                       list(min = -2, max = 2),                                                       list(min = -3, max = 3)))print(x)plot(x)# ishigami.fun 是自带的模型，函数形式如下：# ishigami.fun<- function (X) #    {#      A <- 7#      B <- 0.1#      sin(X[, 1]) + A * sin(X[, 2])^2 + B * X[, 3]^4 * sin(X[, 1])# }

 # 可根据自己的需要进行修改模型和参数集X，以及参数的变化区间。library(sensitivity)yourmodel<- function (X)   {    A <- 7    B <- 0.1    X[, 1] + A * X[, 2]^2 + B * X[, 3]^4  }x <- fast99(model = yourmodel, factors = c('V1','V2','V3'), n = 1000,            q = "qunif", q.arg = list(list(min = 1, max = 10),                                      list(min = 0, max = 10),                                      list(min = 0, max = 10)))print(x)plot(x)

https://wap.sciencenet.cn/blog-526092-1134195.html

全部作者的其他最新博文

GMT+8, 2023-6-3 02:02