adjust: adjust

Description Usage Arguments Details Examples

View source: R/adjust.R

Description

Adjusting data below the MDL

Usage

1
2
3
4
5
6
7
8
9
adjust(x, ...)

## Default S3 method:
adjust(data, mdl, adjust = c("substitute", "exclude",
  "likelihood", "snrat"), unc = NULL, sub = 0.5, experc = 0.25, N = 10,
  burnin = 2, dattype = NULL, guess1 = NULL, ...)

## S3 method for class 'adjust'
print(x)

Arguments

data

data frame of daily constituent concentrations with date as first column

mdl

vector or matrix of MDLs for each variable of data

adjust

one of three methods. 'substitute' substitutes all censored constant proportion of the mdl (sub * mdl). 'exclude' excludes constituents with more than experc censored data. 'likelihood' multiply imputes censored data with a likelihood-based method.

sub

proportion of MDL to substitute censored concentrations. Default is 0.5.

experc

If a constituent exceeds this value, using the exclude method, the constituent will be dropped from the analysis.

N

number of draws from posterior for likelihood-based method

burnin

number of samples to discard for likelihood-based method

dattype

Only needed for model-based imputation approach. Specify lognormal if data should be logged before imputation.

guess1

Can specify guessvec for starting MCMC

Details

adjust adjusts censored concentrations below the MDL

These are functions to create complete PM2.5 constitutent concentrations by substituting, excluding, or imputing censored data. Works on dataframe where the first column is date and all subsequent columns are concentrations of chemical constituents.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(nycdat)
data(nycmdl)
#fix data totals
pm <- nycdat$PM25
whPM <- which(colnames(nycdat) == "PM25")
nycdat <- nycdat[, -whPM]
whPM <- which(colnames(nycmdl) == "PM25")
nycmdl <- nycmdl[, -whPM]
adjust(nycdat, mdl = nycmdl, adjust = "substitute", sub = 1/sqrt(2))
adjust(nycdat, mdl = nycmdl, adjust = "exclude", experc = 0.2)
adjust(nycdat, mdl = nycmdl, adjust = "likelihood", dattype = "lognormal")

kralljr/handles documentation built on Dec. 6, 2019, 3:39 p.m.