balancing: Balancing algorithm via Maximum Likelihood

Description Usage Arguments Value

Description

This function balances the data using maximum likelihood.

Usage

1
2
3
4
balancing(param1, param2, sign, dist = rep("Normal", length(param1)),
  optimize = "solnp", lbounds = rep(0, length(param1)), ubounds = rep(Inf,
  length(param1)), forceInitialConstraint = TRUE, tol = 1e-05,
  constrTol = 1e-06, plot = FALSE, plotSigma = 3)

Arguments

param1

A vector of the first parameter for each of the elements. For a normal distribution, this is the mean.

param2

A vector of the second parameter for each of the elements. For a normal distribution, this is the standard deviation.

sign

A vector of the sign of each element. These values should all be +1 or -1, and they indicate if Delta_1, Delta_2, ... should be pre-multiplied by a negative or not. Usually, these will all be +1.

dist

A vector of the name of the distribution for each distribution. Currently, only "Normal" is implemented. Working in progress for different distribution

optimize

A string with the method of optimization of the Maximum Likelihood, default solnp (Rsolnp dependency). Must be one of "solnp", "L-BFGS-B" (uses optim and is NOT recommended, as it hasn't been tested thoroughly and doesn't enforce all constraints), or "constrOptim" (using constrOptim from base package).

lbounds

A Vector of the lower bounds for each element. These values should all be numeric

ubounds

A Vector of the upper bounds for each element. These values should all be numeric

forceInitialConstraint

Should the initial parameter vector be forced to satisfy the constraints? If TRUE, the initial value for one element will be adjusted in an attempt to satisfy the constraints, but this may not be possible. If not, a warning is given and optimization proceeds with the provided starting value.

tol

The level of tolerance of the balancing (numeric). By default is set up to 1e-5. Currently only used if all elements are fixed, and in this case it provides the numerical tolerance requried to check if the balance is satisfied.

constrTol

The tolerance to pass to the constrOptim algorithm. This algorithm does not force that the equation is balanced but rather forces that the equation is within +/- constrTol example, if constrTol = 0.0001, then a tolerable error of .01 in the balance. This should be set very small as later any lack of balance is assigned to food, and such assignment could create negative values.

plot

Logical. Should a plot be generated which shows the result of the balancing?

plotSigma

A plotting parameter. See ?plotBalancing.

Value

A vector of the final balanced values


SWS-Methodology/faoswsBalancing documentation built on May 9, 2019, 11:47 a.m.