Uses random samples of an under- or overdetermined linear problem to estimate the distribution of equations
Based on a random sample of x (e.g. produced with
produces the corresponding set of "variables" consisting of linear
equations in the unknowns.
Var = EqA.x+EqB
matrix whose rows contain the sampled values of the unknowns
numeric matrix containing the coefficients that define the variables.
numeric vector containing the right-hand side of the variable equation.
a matrix whose rows contain the sampled values of the variables.
Karline Soetaert <[email protected]>
Minkdiet, for a description of the Mink diet example.
varranges, to estimate ranges of inverse variables.
xsample, to randomly sample the lsei problem.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# The probability distribution of vertebrate and invertebrate # food in the diet of Mink # food items of Mink are (in that order): # fish mussels crabs shrimp rodents amphipods ducks # V I I I V I V # V= vertebrate, I = invertebrate # In matrix form: VarA <- matrix(ncol = 7, byrow = TRUE, data = c( 0, 1, 1, 1, 0, 1, 0, # invertebrates 1, 0, 0, 0, 1, 0, 1)) # vertebrates # first sample the Minkdiet problem E <- rbind(Minkdiet$Prey, rep(1, 7)) F <- c(Minkdiet$Mink, 1) X <- xsample(E = E, F = F, G = diag(7), H = rep(0, 7), iter = 1000)$X #then determine Diet Composition in terms of vertebrate and invertebrate food DC <- varsample(X = X, EqA = VarA) hist(DC[,1], freq = FALSE, xlab = "fraction", main = "invertebrate food in Mink diet", col = "lightblue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.