unscale: Unscale Parameters

Description Usage Arguments Details Value

View source: R/unscale.R

Description

Unscale parameters from a polynomial multiple linear regression

Usage

1
unscale(a1, a2, a3, a4, a5, mu1, mu2, sigma1, sigma2)

Arguments

a1

intercept term

a2

coefficient for first predictor

a3

coefficient for first predictor squared

a4

cofficient for second predictor

a5

coefficient for second predictor squared

mu1

mean used to scale first predictor

mu2

mean used to scale second predictor

sigma1

standard deviation used to scale first predictor

sigma2

standard deviation used to scale second predictor

Details

Assume a model of the general form y ~ a1 + a2*x1 + a3*x1^2 + a4*x2 + a5*x2^2. Scaling is assumed to be scale(x1), e.g. All arguments can be vectors, for which each element should refer to a different model/ regression.

Created to unscale parameters used in an MSOM. In this case, each iteration on each chain effectively referes to a different set of parameters. So if the posterior was 100 iterations sampled, the 'a' arguments would be of length 100, and mu and sigma arguments could be length 1 (and recycled), or have the same value repeated 100 times. Alterntively, if the 'a' arguments refer to models for which the predictors were scaled differently, just make sure that the mu and sigma values are repeated to match to the corresponding models. No checking is done, but this should be fairly intuitive: the coefficients should match up with the scaling constants used to scale the predictors used in the model that estimated the coefficients.

Value

Either a vector (if a1 is of length 1) or a matrix (if a1 is longer than 1) of unscaled parameters.


rBatt/trawlDiversity documentation built on Aug. 14, 2021, 1:01 p.m.