retfit: Fit linear regression with covariate value lagged

Description Usage Arguments Value Examples

View source: R/retfit.r

Description

Fit a linear regression model where the covariate value used as explanatory variable is lagged by a user specified number of quarters. The effect of a covariate can be specified to be quarter specific, that is catch in Q1 may respond differently to the covariate than catch in Q4. Note: this is an outdated function not used since I switched to GAMs.

Usage

1
2
3
4
5
6
7
8
9
retfit(
  covname,
  catch.qtr = 1:4,
  lag = 0,
  boxes = 1:14,
  qtr.effect = FALSE,
  startyear = 1956,
  endyear = 2016
)

Arguments

covname

name of the covariate. Must be a colname in seio_covariates_qtr. If one of the covariates is from the boxes, then specify the part of the name in front of the number.

catch.qtr

what quarter(s) of catch to use as the response

lag

the lag specified in number of quarters. 0 means no lag.

boxes

for covariate from a box, the box number or numbers to use

qtr.effect

whether to make the covariate effect on catch depend on the quarter in which the catch is from

startyear

first year

endyear

last year

Value

An lm object of the fit

Examples

1
2
#Effect of precip in box 5 in qtr 1 in the previous year on catch
retfit("Precip", lag=1, boxes=5)

eeholmes/SardineForecast documentation built on July 17, 2021, 2:56 a.m.