random(x, df, sigma)
sigma can be viewed as a shrinkage parameter.
x is returned with class
"smooth", with an attribute named
"call"
which is to be evaluated in
all.wam() by
gam()
This is an experimental
smootherfor use with factors in
gam(). It allows the fitted mean for a factor predictor to be shrunk towards the overall mean, where the amount of shrinking depends either on
sigma, or on the equivalent
df. Similar in spirit to smoothing splines, this fitting method can be justified on Bayesian grounds or by a random effects model.
Since factors are coded by
model.matrix() into a set of contrasts, care has been taken to add an appropriate
"contrast" attribute to the output of
random().
This zero contrast results in a column of zeros in the model matrix, which is
aliased with any column and is hence ignored.
gam(y ~ random(f1) + random(f2, df = 3) + x) # fit a random effects model using gam()