Difference between revisions of "Category:OpasnetUtils"

From Testiwiki
Jump to: navigation, search
(update)
Line 1: Line 1:
 
[[Category:Opasnet]]
 
[[Category:Opasnet]]
 
[[Category:R tools]]
 
[[Category:R tools]]
:''This page is about an R package. For a previous version, see [http://en.opasnet.org/en-opwiki/index.php?title=Opasnet_(R_library)&oldid=25881 Opasnet (R_library)], which is currently redirected here.
 
  
'''This is a collection of the basic R-code functions used in Opasnet.  
+
==OpasnetUtils features==
 +
[[Modelling in Opasnet]] is done using R and the OpasnetUtils package provides most of the actual tools. Most of the package revolves around the ovariable-class.  
  
The list is not complete and neither is this page.
+
===Ovariables===
 +
The ovariable is a class defined by OpasnetUtils. It has eight separate "slots" that can be accessed using X@slot:
 +
*name
 +
**Name of <self> is a requirement since R doesn't support self reference.
 +
*output
 +
**Current definition of <self>.
 +
**A single data.frame (a 2D table type in R)
 +
**Not defined until <self> is evaluated.
 +
*data
 +
**A single data.frame that defines <self> as such.
 +
**May include textual regular expressions that describe probability distributions which can be interpreted by [[OpasnetUtils/Interpret]].
 +
*marginal
 +
**A logical vector that indicates full marginal indices of @output.
 +
*formula
 +
**A function that defines <self>.
 +
**Should return either a data.frame or an ovariable.
 +
*dependencies
 +
**A data.frame that contains names and Rtools or Opasnet tokens/identifiers of variables required for using @formula.
 +
**Dependencies will be fetched and evaluated upon <self> evaluation.
 +
*ddata
 +
**A string containing an Opasnet identifier (i.e. Op_en1000).
 +
**This identifier is used to download data from the Opasnet database for the @data slot upon <self> evaluation.  
  
;For code in the SVN repository, check these links:
+
The general nature of ovariables means that they should not be modified to match a specific model but rather define the variable in question as extensively as possible under it's scope. To match the scope of specific models variables can be modified by supplying orders upstream (outwards in the recursion tree). These orders are checked for upon evaluation. For example decisions in decision analysis can be supplied this way:  
*https://www.opasnet.org/svn/opasnet_utils/trunk/
+
#pick an endpoint
*https://www.opasnet.org/svn/opasnet_utils/trunk/R/ Function definitions
+
#make decision variables for any upstream variables
 +
#evaluate endpoint
 +
#optimize between options defined in decisions.
 +
Other orders include: collapse of marginal columns by sums, means or sampling to reduce data size and passing input from model level without redefining the whole variable. It is also possible to redefine any specific variable before starting the recursive evaluation, in which case the recursion stops at the defined variable (dependencies are only fetched if they do not already exist to avoid unnecessary computation).
  
'''Windows pre-built library'''
+
===Utilising ovariables===
 +
Defining and analyzing endpoints of a model can be as easy as Fetching a relevant variable, evaluating it (using EvalOutput) and using some of the available functions (i.e. summary() for ovariables).
  
[[File:OpasnetUtils_0.1.5.zip]]
+
...
  
'''Pdf manual'''
+
==Installation==
 +
OpasnetUtils is available for any platforms capable for running R from the CRAN repository. Use the drop down menu in the RGui or the R command install.packages("OpasnetUtils") to download the most recent official release.
 +
 
 +
===SVN repository===
 +
If you would like to acquire the most recent version, you are welcome to download and compile our source code which is available at https://www.opasnet.org/svn/opasnet_utils/trunk/. For most recent function definitions see [https://www.opasnet.org/svn/opasnet_utils/trunk/R/ the R sub folder]. Compilation on Windows machines requires R tools (See the CRAN homepage for more information).
 +
 
 +
==Files==
  
 
[[File:OpasnetUtils-manual.pdf]]
 
[[File:OpasnetUtils-manual.pdf]]

Revision as of 15:23, 8 August 2013


OpasnetUtils features

Modelling in Opasnet is done using R and the OpasnetUtils package provides most of the actual tools. Most of the package revolves around the ovariable-class.

Ovariables

The ovariable is a class defined by OpasnetUtils. It has eight separate "slots" that can be accessed using X@slot:

  • name
    • Name of <self> is a requirement since R doesn't support self reference.
  • output
    • Current definition of <self>.
    • A single data.frame (a 2D table type in R)
    • Not defined until <self> is evaluated.
  • data
    • A single data.frame that defines <self> as such.
    • May include textual regular expressions that describe probability distributions which can be interpreted by OpasnetUtils/Interpret.
  • marginal
    • A logical vector that indicates full marginal indices of @output.
  • formula
    • A function that defines <self>.
    • Should return either a data.frame or an ovariable.
  • dependencies
    • A data.frame that contains names and Rtools or Opasnet tokens/identifiers of variables required for using @formula.
    • Dependencies will be fetched and evaluated upon <self> evaluation.
  • ddata
    • A string containing an Opasnet identifier (i.e. Op_en1000).
    • This identifier is used to download data from the Opasnet database for the @data slot upon <self> evaluation.

The general nature of ovariables means that they should not be modified to match a specific model but rather define the variable in question as extensively as possible under it's scope. To match the scope of specific models variables can be modified by supplying orders upstream (outwards in the recursion tree). These orders are checked for upon evaluation. For example decisions in decision analysis can be supplied this way:

  1. pick an endpoint
  2. make decision variables for any upstream variables
  3. evaluate endpoint
  4. optimize between options defined in decisions.

Other orders include: collapse of marginal columns by sums, means or sampling to reduce data size and passing input from model level without redefining the whole variable. It is also possible to redefine any specific variable before starting the recursive evaluation, in which case the recursion stops at the defined variable (dependencies are only fetched if they do not already exist to avoid unnecessary computation).

Utilising ovariables

Defining and analyzing endpoints of a model can be as easy as Fetching a relevant variable, evaluating it (using EvalOutput) and using some of the available functions (i.e. summary() for ovariables).

...

Installation

OpasnetUtils is available for any platforms capable for running R from the CRAN repository. Use the drop down menu in the RGui or the R command install.packages("OpasnetUtils") to download the most recent official release.

SVN repository

If you would like to acquire the most recent version, you are welcome to download and compile our source code which is available at https://www.opasnet.org/svn/opasnet_utils/trunk/. For most recent function definitions see the R sub folder. Compilation on Windows machines requires R tools (See the CRAN homepage for more information).

Files

File:OpasnetUtils-manual.pdf