fit.final_space: Fit n parameters to observations

View source: R/fit_final_space.R

fit.final_spaceR Documentation

Fit n parameters to observations

Description

A function to find the combinations of values of n parameters producing final state delta values fitting within confidence intervals of observations.

Usage

fit.final_space(
  workdir,
  obs_file_name,
  sweep_space_digest_folders,
  fit_name = NULL,
  output_dir = NULL,
  delta_reference_box = NaN,
  excluded_boxes = NULL,
  print_correlogram = FALSE,
  print_lda = FALSE,
  print_LS_surfaces = FALSE,
  parameter_subsets = NULL,
  custom_expressions = NULL,
  save_outputs = FALSE,
  export_fit_data = FALSE
)

Arguments

workdir

Working directory of 0_ISOBXR_MASTER.xlsx master file,
of the dynamic sweep master file (e.g., 0_EXPLO_DYN_MASTER.xlsx)
and where output files will be stored if saved by user.
(character string)

obs_file_name

Name of csv file containing observations with csv extension.
Stored in workdir. Example: "observations.csv"
Should contain the following columns:

  1. BOX_ID: BOX ID (e.g., A, OCEAN...) as defined in isobxr master file.

  2. delta.def definition of delta value, e.g., d18O

  3. delta.ref BOX_ID of reservoir used as a reference.

  4. obs.delta average observed delta numerical value

  5. obs.CI confidence interval of delta value

  6. obs.CI.def definition of confidence interval, e.g., 95

  7. obs.file name of data source file

sweep_space_digest_folders

Name of sweep.final_nD digest directory.
Should start with "4_FINnD" and end with "_digest"

fit_name

Name given to specific fit. If NULL, output are named after date and time of fit.

output_dir

Destination directory for fit outputs. If NULL, outputs are stored in sweep_space_digest_folders directory. Default is NULL.

delta_reference_box

BOX ID of reference box, used to calculate difference between any box delta and reference box delta. Default is NaN.
delta_reference_box should match at least one of the values declared in the delta.ref column of observation csv file.

excluded_boxes

list of boxes to exclude from fit. Default is NULL.

print_correlogram

If TRUE, includes correlograms to final report when applicable.
Default is FALSE.

print_lda

If TRUE, includes linear discriminant analysis to final report when applicable.
Default is FALSE.

print_LS_surfaces

If TRUE, includes surfaces of least squarred residuals to final report when applicable.
Default is FALSE.

parameter_subsets

List of limits vectors for parameters to subset before fit.
For instance: list(swp.A.A_B = c(1, 1.00001)) to subset the swept fractionation factor from box A to B between 1 and 1.00001.

custom_expressions

Vector of expressions to add to the list of fitted parameters.
For instance: c("m0.A/f.A_B") to add the ratios of mass of A over A to B flux to the list of parameters.

save_outputs

If TRUE, saves all run outputs to local working directory (workdir).
By default, run outputs are stored in a temporary directory and erased if not saved. Default is FALSE.

export_fit_data

If TRUE, exports fitted data as csv and rds files.

Value

A observation fit graphical report, in R session or exported as pdf, and a data report as R list or xlsx if required.


isobxr documentation built on Aug. 23, 2023, 5:06 p.m.