[R] wrong when use the function fast99 in package "Sensitivity"

David Winsemius dwinsemius at comcast.net
Tue Jul 9 19:08:50 CEST 2013


On Jul 8, 2013, at 11:57 PM, 何亮 wrote:

> 
> 
> Pn_I<-function(x){
> 
>  I<-1000
>  Rp<-x[4]*(1-x[5]*I)*I/(1+x[6]*I)
>  Pn<-x[1]*(1-x[2]*I)*I/(1+x[3]*I)-Rp-x[7]
>  return(Pn)
> 
> }
> 
> 
> 
> 
> Pn_I_sensitivity <- fast99(model = Pn_I, factors=c("alpha","beta","gamma","delta","lammda","omiga","Rd"),
>                           n = 3000,q =rep("qunif",7), q.arg = list(alpha=list(min=0,max=1),
>                           beta=list(min=0,max=1),gamma=list(min=0,max=1),delta=list(min=0,max=1),
>                           lammda=list(min=0,max=1),omiga=list(min=0,max=1), Rd=list(min=0,max=4)))
> 
> 
> print(Pn_I_sensitivity)
> plot(Pn_I_sensitivity)
> 
> 
> the results as follow
> 
> Error in response(x, ...) : 
>  (list) object cannot be coerced to type 'double'

Generally that error message means you are not using the correct extraction function. Try using "[[" instead of "["

-- 
David.
> 
> 
> does anybody know where is wrong in my code?
> --
> ºÎÁÁ
> Ö‹’ú¿ÆѧԺ´óѧ µØÀí¿ÆѧÓë◊ÊÔ´Ñ‹≤¿Ëù Â∏µØˮі»·ÓëµØ±í’‡“ÌÖصãʵÑéÊÒ
> ±±≤©Ê‹ “¯ÑôÇø ´óÍÍ·π◊11ºÅ
> µç»°£º13651318417
> Liang He
> Institute of Geographic Sciences and Natural resource research
> Chinese Academy of Science,
> No.11, Datun Road, Chaoyang District,
> Beijing 100101, China
> Email: xhl860728 at 163.com
> Tel: +86(10) 6488 9513
> Mob:+86 0 13651318417
> 
> 
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list