about sensitivity analysis USING SOBOL2002

20 views
Skip to first unread message

hana waga

unread,
Oct 16, 2019, 8:13:29 AM10/16/19
to hydroma...@googlegroups.com
Hi all of you how are you? This question is for the second time .
 when I run sensitivity analysis that mentioned in hydromad sensitivity.R   this one
## Save current time
st <- proc.time()

## Set number of samples desired
n <- 1000
ss <- sobol2002(model = evalPars,
                ## Draw two random samples of parameters
                X1 = parameterSets(getFreeParsRanges(modx),n),
                X2 = parameterSets(getFreeParsRanges(modx),n),
                ## Number of bootstrap replicates
                nboot = 100,
                ## Arguments to be passed to evalPars
                object=modx,
                ## NSElog* objective function (using the logarithm of Q and X)
                objective=~ hmadstat("r.sq.log")(Q, X) /(2-hmadstat("r.sq.log")(Q, X))
                )

## Print elapsed time
print(proc.time()-st)
 it gives an error like,Error in update.hydromad(object, newpars = p) : 
  elements of 'newpars' must be named. how to correct this error.

Willem Vervoort

unread,
Oct 16, 2019, 9:14:50 PM10/16/19
to hydromad-users
Hi Hana,
How is your modx defined? I'll have closer look later today. It was working fine for me earlier this month
Willem 

--
You received this message because you are subscribed to the Google Groups "hydromad users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hydromad-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hydromad-users/CAOmnh4t%3DzKfXLmpn8CP2UgdtaLH__b91cdMkaehTXSnYhsNtJA%40mail.gmail.com.

Willem Vervoort

unread,
Oct 17, 2019, 1:11:38 AM10/17/19
to hydromad-users
Hi Hana,
I can't see anything wrong in the code you posted, except I am not totally sure about the definition of the objective, but I think it should work.
So unless there is something in your "modx" that is not right then I am not sure.

I had the following in my code (which looks very similar):

# redefine the model, but with ranges of parameters
CMod <- hydromad(CoolacData[1:2000], sma="gr4j", routing="gr4jrouting",
  etmult=c(0.05,0.5),x1 = c(100,1500), x2 = c(-30,20),
  x3 =c(5,500), x4 = c(0.5,10))

# again of samples from the parameter sets
n <- 1000
# Find the parameter ranges from your model
# Make sure you define the right model!
X1 <- hydromad::parameterSets(getFreeParsRanges(CMod),n)
X2 <- hydromad::parameterSets(getFreeParsRanges(CMod),n)
# run the sensitivity
Sob_sens <- sobol2002(model = evalPars,
              # using these parameter ranges
               X1 = X1, X2 = X2,
              # relates to the boot strapping in the analysis
               nboot = 100,
              # The model to use
               object=CMod,
              # The objective function to use
               objective=~hmadstat("r.squared")(Q,X)
               
)
# Show output
Sob_sens

Willem

hana waga

unread,
Oct 17, 2019, 9:09:46 AM10/17/19
to hydromad users

hana waga

unread,
Oct 17, 2019, 9:14:25 AM10/17/19
to hydroma...@googlegroups.com
thank you willem simply you understand what I went. I will check it.

--
You received this message because you are subscribed to the Google Groups "hydromad users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hydromad-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages