Skip to contents

strb

Description

This function helps in the visual search of the starting input parameters for nlsLM, to fit the specified model (mod), using a graph for visual adjustment of model parameters (Trial and Error Strategy).

It returns: a plot with the observed, fitted values and its confidence interval, and a model settings list.

The function requires defining:

  • b3: The initial value for the medium asymptote. Valid only for double sigmoid model, NA is assigned for the simple model.
  • b4: The initial value for the coordinate at the inflection point for simple sigmoid model. For the double sigmoid model, it corresponds to the first inflection point.
  • b5: The initial value for the amplitudes of the sigmoid, for the double sigmoid model corresponds to the amplitude of the first sigmoid. b5= L95a-b4 ,L95a is the lengths at 95 percent maturity for the complete sigmoid (single model) or the first sigmoid (double model).
  • b6: The coordinate at the second inflection point. Valid only for double sigmoid model, NA is assigned for the simple model.
  • b7: The initial value for the amplitude of the second sigmoid. Valid only for double sigmoid model, NA is assigned for the simple model. b7= L95b-b6 ,L95b is the lengths at 95 percent maturity from the second distribution.
  • x: independent variable.
  • y: dependent variable.
  • mod: A nonlinear model formula including variables and parameters.
  • modelo: function from Repbio, to fit the specified model (mod).
  • bl: Lower (bl) weight values apply to each parameter (bi).
  • bu: Upper (bu) weight values apply to each parameter (bi)
  • xl: Title label for X axis.
  • yl: Title label for Y axis.

See also: nlsLM from minpack.lm (version 1.2-4).

strb

The function is included in the Repbio package Reproductive biology analysis.

#library(Repbio)

The function is detailed below.

strb <- function(b3,b4,b5,b6,b7,x,y,mod,modelo, bl, bu, xl, yl){
  bb <- c(b3=b3,b4=b4,b5=b5,b6=b6,b7=b7)
  bb <- bb[!is.na(bb)]
  bmin <- c(bb*bl)
  bmax <- c(bb*bu)
  fit <- modelo(x,y,mod,bb,bmin,bmax)

  plot(x,y,
       xlab=xl,
       ylab= yl)
  lines(x,fitted(fit))

  fit
} # End function

Examples

Falta detallar el ejemplo

    # strb(b3,b4,b5,b6,b7,x,y,mod,modelo, bl, bu, xl, yl)

References

Salas‐Singh, C., Morales‐Bojórquez, E., & Aguirre‐Villaseñor, H. (2022). Reproductive biology of the bullseye puffer Sphoeroides annulatus: Gonadosomatic index and its suitability for estimating length at maturity. Journal of Fish Biology, 101(5), 1119-1133.https://doi.org/10.1111/jfb.15174