mocis: mocis

View source: R/mocis.R

mocisR Documentation

mocis

Description

The main analysis function

Usage

mocis(file, vars = NULL, n0 = 4, outdir = NULL, add.vars = NULL,
  sheet = 1, nyears = 5, alpha = 0.05, crit = "gcv",
  fat_adj = fat_adjust(), generate_tables = TRUE, verbose = FALSE,
  agesel = age_select(), GRU = 1, roblm = FALSE, robsm = FALSE,
  lims = limits(), ord = statorder(), stationnames = stations(),
  specs = species(), yearvar = "YWD", subset_years = 10,
  b.pow = 0.1, power = 0.8, n.pow = 10)

Arguments

file

The Excel file which holds the data

vars

Variables that should be analyzed

n0

For use in do_changep, the minimum number of year on each side of the change point

outdir

Output directory. Defaults to the current working directory in left empty.

add.vars

Additional variables. The function tries to guess some sensible variables if left empty.

sheet

The sheet containing the data in the Excel file. Deafults to 1.

nyears

The minimum number of years that should be available for analysis. Defaults to 5.

alpha

The p-value threshold. Defaults to 0.05

crit

Criterion for automatic bandwidth selection. A character, "gcv" or "aic". Degaults to "gcv".

fat_adj

A list with rules for fat adjustment. Defaults to fat_adjust().

generate_tables

Logical. Should tables be generated? Deafaults to TRUE.

verbose

Logical. If TRUE, prints the progress.

agesel

A list with rules for the age selection. Defaults to age_select.

GRU

For birds. Selection based on the GRU variable. Defaults to 1.

roblm

Logical. If TRUE, performs a robust linear model. Experimental.

robsm

Logical. If TRUE, performs a robust smooth. Experimental.

lims

Limits for the contaminants. Defaults to limits().

ord

A list of data.frames giving the ordering in the tables. Defaults to statorder().

stationnames

A list with station names. Defaults to stations().

yearvar

The variable containing the years. Defaults to "YWD".

subset_years

Select a subset of years to run the analyses on. Defaults to 10.

b.pow

The slope, as a fraction e.g. 10 power calculations. Deafults to 0.1.

power

The desired power. Befaults to 0.8.

n.pow

The number of years for the power calculations. Defaults to 10.

Details

Main function to perform the analyses, i.e. linear model fit, smooth fit, outlier detection and creation of tables

Value

A list with elements:

  • data A data.frame containing the raw data.

  • aggdata A data.frame containing the aggregated data (yearly geometric mean values, yearly geometric standard deviations, number of measurements per year, if all values were below the LOD).

  • m Overall geometric mean value with 95

  • limit A list with elements tv the target value and fat the average fat percentage in the series.

  • linmod Output from do_reg.

  • linmod10 Output from do_reg applied to the last 10 years in the series if applicable.

  • smooth Output from do_smooth.

  • changepoint Output from do_changep.

  • fatadjust Either 1 or 0 dependeing on whether fat adjustment was done or not.

  • stattype A character vector of length 2 denoting which type of file was analyzed.

Author(s)

Erik Lampa


NRM-MOC/MoCiS documentation built on March 27, 2023, 7:35 p.m.