sensitivity analysis, input factors

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

sensitivity analysis, input factors

"Szalai Márk"
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
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: sensitivity analysis, input factors

milton ruser
Hi Szalai

I had used only "src" function, and on that case you need to
have a vector with your Y variable, and a data-frame with all
your X (i.e. explanatory) variables.

I have interest on stay in touch with others that have been using
sensitivity package!

bests

milton

On Tue, Apr 13, 2010 at 11:08 AM, "Szalai Márk" <[hidden email]>wrote:

> 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
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

[RPostgreSQL] Fails to load

Jim Hargreaves
In reply to this post by "Szalai Márk"
Hi List,

Running R 2.10.1 on a fresh install of Windows 7. I get the following
error when loading the RPostgreSQL package.


 >library(RPostgreSQL)
Loading required package: DBI
Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared library
'C:/Users/james/Documents/R/win-library/2.10/RPostgreSQL/libs/RPostgreSQL.dll':
  LoadLibrary failure:  The specified module could not be found.

Error: package/namespace load failed for 'RPostgreSQL'


I have reinstalled the RPostgreSQL package from several different
mirrors and reinstalled R, and the error remains. I know that
RPostgreSQL depends on libpq.dll and others, so I downloaded and
installed Postgres, then copied the contents of PostgreSQL\8.4\lib to
the RPostgreSQL library
(C:/Users/james/Documents/R/win-library/2.10/RPostgreSQL/libs/)

TIA to anyone who can shed some light.

Regards,
Jim Hargreaves

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: [RPostgreSQL] Fails to load

Dirk Eddelbuettel

On 13 April 2010 at 16:29, james wrote:
| Hi List,
|
| Running R 2.10.1 on a fresh install of Windows 7. I get the following
| error when loading the RPostgreSQL package.
|
|
|  >library(RPostgreSQL)
| Loading required package: DBI
| Error in inDL(x, as.logical(local), as.logical(now), ...) :
|   unable to load shared library
| 'C:/Users/james/Documents/R/win-library/2.10/RPostgreSQL/libs/RPostgreSQL.dll':
|   LoadLibrary failure:  The specified module could not be found.
|
| Error: package/namespace load failed for 'RPostgreSQL'
|
|
| I have reinstalled the RPostgreSQL package from several different
| mirrors and reinstalled R, and the error remains. I know that
| RPostgreSQL depends on libpq.dll and others, so I downloaded and
| installed Postgres, then copied the contents of PostgreSQL\8.4\lib to
| the RPostgreSQL library
| (C:/Users/james/Documents/R/win-library/2.10/RPostgreSQL/libs/)

Hm, why there?  

If you add Postgresql to the normal Windows path and you should be fine.
 
| TIA to anyone who can shed some light.

RPostgreSQL has its own (very low-volume) mailing list; the r-sig-db is a good
choice too.  

Dirk
 
|
| Regards,
| Jim Hargreaves
|
| ______________________________________________
| [hidden email] 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.

--
  Registration is open for the 2nd International conference R / Finance 2010
  See http://www.RinFinance.com for details, and see you in Chicago in April!

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: sensitivity analysis, input factors

"Szalai Márk"
In reply to this post by milton ruser
Hi Milton,

Thanks for your rapid answer.

As far as I know the src is a regression based method and can be separated from model evaluations. However, a screening method like Morris requires that the input factors of  latter model evaluations would be determined by the results of previous evaluations. Thus, there is no vector of responses (and data frame of factors) before the sensitivity analysis itself.

Bests,
Mark

----- Eredeti levél (Original Message) -----
Feladó: milton ruser <[hidden email]>
Dátum: Kedd, Április 13, 2010 5:16 du
Tárgy: Re: [R] sensitivity analysis, input factors
Címzett: Szalai Márk <[hidden email]>
Másolat: [hidden email]

> Hi Szalai
>
> I had used only "src" function, and on that case you need to
> have a vector with your Y variable, and a data-frame with all
> your X (i.e. explanatory) variables.
>
> I have interest on stay in touch with others that have been using
> sensitivity package!
>
> bests
>
> milton
>
> On Tue, Apr 13, 2010 at 11:08 AM, "Szalai Márk"
> <[hidden email]>wrote:
> > 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
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html<http://www.r-
> project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.


        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.