Skip to contents

Returns expected quantities or replicate observations at the original fitted units, using their original exposures and stored posterior latent effects. Every fitted regression, group, spatial, and composition-factor term is included.

Usage

# S3 method for class 'magComp'
fitted(object,
                         type = NULL,
                         target = c("expected", "observation"),
                         summary = c("mean", "samples", "quantile"),
                         probs = c(0.025, 0.5, 0.975), ...)

Arguments

object

A fitted magComp object.

type

Quantities to return; see magCompPrediction for supported choices. With NULL, defaults depend on the fitted components.

target

Use "expected" for conditional means or "observation" to simulate replicate observations from the fitted likelihood.

summary

Return posterior means, aligned retained samples, or quantiles. Means and quantiles pool all retained draws across chains.

probs

One or more probabilities strictly between zero and one, used for summary = "quantile".

...

Must be empty. Unknown arguments are rejected.

Details

target = "expected" constructs quantities from the stored parameter and latent-effect draws, without additional random simulation. For the observation target, a full model draws an NB total followed by multinomial allocation. With only magnitude, replicates draw just the total. With only composition, replicates allocate the observed total among categories with no abundance simulation. Expected composition-only category counts are that observed total times the fitted probabilities. Conditional densities additionally require the original area or BAF information. ppcSummary compares replicates with observed counts. Both targets support fixedAreaStems and pointBasalArea. Point-sampling replicates are in-tree tallies; observation magnitudes and category densities multiply those tallies by each point's BAF to give sampled basal-area estimates.

See magCompPrediction for the four returned quantities, their array dimensions, and the treatment of zero totals. New covariates or exposures belong in predict; fitted() always uses the original fitted units. Observation simulation uses R's current random-number state; use set.seed() externally for reproducibility.

Value

A magCompPrediction named list with the requested quantity components and metadata, even when only one quantity is requested. Access counts with result$count. See that help page for array dimensions and metadata fields.

See also

summary for summarizing stored draws; predict, ppcSummary, standSummary