plotmodelfit: Plot data and fitted model

View source: R/plotmodelfit.R

plotmodelfitR Documentation

Plot data and fitted model

Description

Makes plot of data and one fitted dynamic model. Can also add an additional fitted model to an existing plot

Usage

plotmodelfit(
  x,
  r,
  N0 = NULL,
  N1 = NULL,
  K = NULL,
  type = "Process",
  add.to.plot = F,
  diagnostic = F,
  diagnostic.type = NULL
)

Arguments

x:

the data frame containing month and population abundances

r:

the fitted parameter r

N0:

the fitted parameter N0 (only used for process error models)

N1:

the fitted parameter N1 (only used for observation error models)

K:

the fitted parameer K (only used for density dependent models

type:

must be either "Process" or "Observation". Density independent model appears as a blue line, Density dependent model appears as red line

add.to.plot:

if TRUE, then adds fitted model to an existing plot.

diagnostic:

if TRUE, then plots one of three diagnostics (must include diagnostic type)

diagnostic.type:

must be either "obs_vs_predicted", "res_vs_predicted", or "res_vs_time"

Examples


#Plot best fitting process, density independent model with data

di.mle.pars <- proc.di.fit$par
plotmodelfun(x = voles,
r = di.mle.pars[1],
N0= = di.mle.pars[2])
type = "Process")

# Add density dependent model fit to existing plot:

dd.mle.pars <- proc.dd.fit$par
plotmodelfun(x = voles,
r = dd.mle.pars[1],
K = dd.mle.pars[2],
N0 = dd.mle.pars[3]
type = "Process",
add.to.plot = TRUE)

tessington/quantecol documentation built on June 1, 2025, 9:06 p.m.