FitModel: FitModel

Description Usage Arguments Details Value References See Also

View source: R/FitModel.R

Description

This function fits a generalized additive model to a loads dataset

Usage

1
2
3
4
FitModel(x, parms = list(flow = FALSE, seasonal = FALSE,
          RFlimb = FALSE, MA = c(MA1day = FALSE, MA2days = FALSE,
          MAweek = FALSE, MAmonth = FALSE, MA6months = FALSE,
          MA12months = FALSE), trend = FALSE, correlation = FALSE))

Arguments

x

The loads dataset, CQ object resulting from the CreateData function.

parms

A list comprising terms to fit in a model: flow: linear ("linear") and quadratic ("quadratic") terms for flow. Default: FALSE seasonal: logical term indicating whether seasonal terms are fitted. Default:FALSE RFlimb: logical term indicating whether a rising/falling limb term is fitted. Default: FALSE, MA: vector indicating whether one or more moving average terms are fitted. Default:c(MA1day = FALSE, MA2days = FALSE, MAweek = FALSE, MAmonth = FALSE, MA6months = FALSE, MA12months = FALSE) trend: logical term indicating whether a long term trend is fitted. Default: FALSE correlation: AR1 correlation structure incorporated. Default: FALSE

Details

This is a wrapper function for fitting a generalised additive model using the link{mgcv} package. Terms are fitted in the model by "switching" terms on and off. Apart from the flow term, all other terms are logical. If a term is intended to be included in a model, then that term can be set to TRUE.

To include additional terms to those specified, the user will need to run the gam function from the mgcv package that this method is based upon. The following is an example where an additional variable, "dam" is included into the model. mod <- gam(log(Conc) ~ log(pQ) + I(log(pQ)^2) + per(days, k=2) + s(MA1day) + s(trend) + dam, family = gaussian, data = loaddata$CQ, control = gam.control(keepData = TRUE)) where loaddata$CQ contains an additional column of data labelled, "dam".

Value

an object of class fitmodel with elements as described in gamObject from the mgcv package. Standard summary and anova functions apply.

References

Kuhnert, P.M., Henderson, B.L., Lewis, S.E., Bainbridge, Z.T., Wilkinson, S.N. and Brodie, J.E. (2012) Quantifying total suspended sediment export from the Burdekin River catchment using the loads regression estimator tool, Water Resources Research, 48, W04533,doi:10.1029/2011WR011080.

See Also

ReadInData, CreateData, gam, diagnostic


pkuhnert/LRE documentation built on March 4, 2021, 2:50 a.m.