[R] sensitivity analysis, input factors

"Szalai Márk" Szalai.Mark at mkk.szie.hu
Tue Apr 13 17:08:02 CEST 2010


Hi,


I'm trying to conduct sensitivity analysis in R using the 'sensitivity' package. Although the description of functions seem straightforward, I can’t succeed. The definition of input factors can be the problem. 

library(sensitivity)
#A simple model with 4 input factor to test the morris function:
model01=function(a1,a2,a3,a4)            
{
Z<-numeric(10)
Z[1]<-runif(1)
Z[2]<-runif(1,a1,30)
Z[3]<-6*runif(1,min(a1,a2),max(a1,a3))
Z[4]<-runif(1,2,5)*runif(1,min(a2,a4),max(a2,a4))
Z[5]<-0.5*runif(1,min(a3,a4),max(a3,a4))
Z[6]<-2*runif(1,min(a1,a4),max(a1,a4))
Z[7]<-runif(1)
Z[8]<-2*runif(1,min(2*a1,5*a4),max(10*a1,100*a4))
Z[9]<-2.5*runif(1,min(a2,a3),max(a2,a3))
Z[10]<-rnorm(1,10*a1,1)
mean(Z)
}

xx=morris(model = model01, factors=c("a1","a2","a3","a4"), r=4,              
design=list(type="oat", levels = 5, grid.jump = 3), binf =1,bsup=20, scale=F)


Error message suggests that the second input factor is not used 
How should I define the input factors?


Thanks in advance,
Mark 


More information about the R-help mailing list