||
R中进行敏感性分析的包sensitivity中的fast的全称是Extended Fourier Amplitude Sensitivity Test。
按照R自带的HELP的描述:Description
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 是自带的模型,函数形式如下: # { # 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) |
画图得到下图:
补充:这里使用fast99进行参数的局部敏感性分析(Local sensitivity),需要将其他变量(如上面的A,B)取固定值,A,B的取值也会影响,参数的效应值大小。如果AB变化如何分析呢?需要进行的全局敏感性分析。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-23 05:04
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社