R: Generates a random sample of the unknowns for a linear...
Xsample
R Documentation
Generates a random sample of the unknowns for a linear inverse problem
Description
Given an inverse input list, randomly samples the unknowns,
using an MCMC method
Usage
Xsample(lim, exact = NULL, ...)
Arguments
lim
a list that contains the linear inverse model
specification, as generated by function setup.limfile.
exact
if not NULL, a vector containing the numbers of
the equations to be solved exactly; if NULL, all equations
are considered exact.
...
extra parameters passed to function
xsample from packagelimSolve.
Details
For overdetermined LIM problems, the inverse equations may be split up
in equations which have to be exactly met and other equations which have
to be approximated.
exact is a vector with the exact equations
The default settings of xsample will often not do.
For instance, the default consists of 3000 iterations (iter) and
a jump length of jmp of 0.1.
You may need to increase one of those to ensure that the
entire solution space has been adequately sampled.
Value
a 2-columned vector containing the minimum (column 1) and
maximum (column 2) of each unknown.
Author(s)
Karline Soetaert <karline.soetaert@nioz.nl>
References
Van den Meersche K, Soetaert K, Van Oevelen D (2009). xsample(): An R
Function for Sampling Linear Inverse Problems.
Journal of Statistical Software, Code Snippets, 30(1), 1-15.
Varranges which estimates the ranges of inverse variables
Plotranges to plot the ranges
function xsample from packagelimSolve
Examples
# sample solution space
xs <- Xsample(LIMRigaAutumn, iter = 500, jmp = 5)
# remove flows that are invariable (sd=0)
xs <- xs[ ,-which(apply(xs, 2, sd) == 0 )]
#pairs plot
pairs(xs, gap = 0, pch = ".", upper.panel = NULL)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(LIM)
Loading required package: limSolve
Loading required package: diagram
Loading required package: shape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LIM/Xsample.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Xsample
> ### Title: Generates a random sample of the unknowns for a linear inverse
> ### problem
> ### Aliases: Xsample
> ### Keywords: optimize utilities
>
> ### ** Examples
> # sample solution space
> xs <- Xsample(LIMRigaAutumn, iter = 500, jmp = 5)
> # remove flows that are invariable (sd=0)
> xs <- xs[ ,-which(apply(xs, 2, sd) == 0 )]
> #pairs plot
> pairs(xs, gap = 0, pch = ".", upper.panel = NULL)
>
>
>
>
>
> dev.off()
null device
1
>