Learn R Programming

hydroPSO (version 0.3-1-1)

lhoat: Latin-Hypercube One-factor-At-a-Time

Description

This function implements the Latin-Hypercube One-factor-At-a-Time procedure developed by van Griensven et al., (2006) for sensitivity analysis of model parameters

Usage

lhoat(fn="hydromod", lower=-Inf, upper=Inf, control=list(),
      model.FUN=NULL, model.FUN.args=list() )

Arguments

fn
character, name of a valid R function to be analysed or the character value hydromod. -) When fn!='hydromod', the first argument of fn has to be a vector of parameters over which the analysis is going to take pl
lower
numeric, lower boundary for each parameter Note for optim users: in hydroPSO the length of lower and upper are used to defined the dimension of the solution space
upper
numeric, upper boundary for each parameter Note for optim users: in hydroPSO the length of lower and upper are used to defined the dimension of the solution space
control
a list of control parameters. See Details
model.FUN
OPTIONAL. Used only when fn='hydromod' character, valid R function representing the model code to be calibrated/optimised
model.FUN.args
OPTIONAL. Used only when fn='hydromod' list with the arguments to be passed to model.FUN

Value

  • A list of two elements:
  • ParameterSetsa matrix with all the parameter sets used in the LH-OAT
  • Rankinga dataframe with a ranking, parameter id, and relative importance indicator for each parameter, sorted in decreasing order of importance

Details

The control argument is a list that can supply any of the following components: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

References

A. van Griensven, T. Meixner, S. Grunwald, T. Bishop, M. Diluzio, R. Srinivasan, A global sensitivity analysis tool for the parameters of multi-variable catchment models, Journal of Hydrology, Volume 324, Issues 1-4, 15 June 2006, Pages 10-23, DOI: 10.1016/j.jhydrol.2005.09.008.

See Also

hydroPSO, hydromod

Examples

Run this code
##################################################
# Example 1: Linear model (n=3)                  #
##################################################
# Distributions for the three parameters, are all uniform in the intervals
# [0.5, 1.5], [1.5, 4.5], and [4.5,13.5], respectively.

# 1.1) defining the dimension of the parameter space
nparam <- 3

# 1.2) defining the model
linear <- function(x) x[1] + x[2] + x[3]

# 1.3) Running the LH-OAT sensitivity analysis for the 'linear' test function
#      The model is linear and since x[3] has the largest mean value, it should
#      be the most important factor. 
set.seed(123) 
lhoat(
      fn=linear, 
      lower=c(0.5, 1.5, 4.5), 
      upper=c(1.5, 4.5, 13.5),
      control=list(N=100, f=0.1, write2disk=FALSE, verbose=FALSE)      
      )

##################################################
# Example 2: non-linear monotonic model (n=2)    #
##################################################
# A uniform distribution in the interval [0, 5] was assigned to both parameters. 
# This makes the second factor more important than x[1]

# 2.1) defining the dimension of the parameter space
nparam <- 2

# 2.2) defining the model
non.linear <- function(x) x[1] + x[2]^4

# 2.3) Running the LH-OAT sensitivity analysis for the 'non.linear' test function
#      The model is linear and since x[3] has the largest mean value, it should
#      be the most important factor. 
setwd("~")
set.seed(123) 
lhoat(
      fn=non.linear, 
      lower=rep(0, nparam), 
      upper=rep(5, nparam),
      control=list(N=1000, f=0.1, write2disk=TRUE, verbose=FALSE)      
      )

# 2.4) reading ALL the parameter sets used in LH-OAT, and plotting dotty plots     
params <- read_params(file="LH_OAT/LH_OAT-gof.txt", header=TRUE, skip=0, 
                      param.cols=2:(nparam+1), of.col=1, of.name="non.linear", 
                      ptype="dottyplot")


##################################################
# Example 3: non-monotonic model (ishigmai, n=3) #
##################################################
#  All three input factors have uniform distributions in the range [-pi, pi]. 

# 3.1) defining the dimension of the parameter space
nparam <- 3

# 3.2) defining the model
ishigami <- function(x, a=7, b=0.1) {
  sin(x[1]) + a*(sin(x[2]))^2 + b*(x[3]^4)*sin(x[1]) 
}

# 3.3) Running the LH-OAT sensitivity analysis for the 'lineal' test function
#      first order analytical sensitivity indices for the Ishigami function are:
#      S1=0.3138, S2=0.4424, S3=0.0000. Therefore, the first order sensitivity 
#      indices indicate that factor x[2] is more important than factor x[1].

setwd("~")
set.seed(123) 
lhoat(
      fn=ishigami, 
      lower=rep(-pi, nparam), 
      upper=rep(pi, nparam),
      control=list(N=5000, f=0.1, write2disk=TRUE, verbose=FALSE)      
      )

# 3.4) reading ALL the parameter sets used in LH-OAT, and plotting dotty plots     
params <- read_params(file="LH_OAT/LH_OAT-gof.txt", header=TRUE, skip=0, 
                      param.cols=2:(nparam+1), of.col=1, of.name="non.linear", 
                      ptype="dottyplot")

Run the code above in your browser using DataLab