This smooth constructor implements simple linear effects. The columns of the design matrix are automatically scaled. The main advantage of this constructor is speed when used in the BAMLSS boosting algorithm boost. Optionally, a ridge penalty can be added, please see the example.

## Linear smooth constructor.
lin(...)

## For mgcv.
# S3 method for linear.smooth.spec
smooth.construct(object, data, knots, ...)

Arguments

...

For function lin() a formula of the type ~x1+x2+x3 that specifies the covariates that should be modeled.

object, data, knots

See smooth.construct.

Value

Function lin(), similar to function s a simple smooth specification object.

Examples

if (FALSE) ## Simulate data.
set.seed(123)
d <- GAMart()

## Estimate model.
f <- num ~ lin(~x1+x2+x3+fac,ridge=TRUE)

b <- bamlss(f, data = d)
#> AICc 328.2219 logPost -168.649 logLik -157.258 edf 6.7460 eps 1.5021 iteration   1
#> AICc 306.1394 logPost -159.383 logLik -146.058 edf 6.9002 eps 0.3385 iteration   2
#> AICc 295.5924 logPost -155.273 logLik -140.746 edf 6.9379 eps 0.2123 iteration   3
#> AICc 290.4959 logPost -153.454 logLik -138.183 edf 6.9519 eps 1.5925 iteration   4
#> AICc 288.0301 logPost -152.685 logLik -136.943 edf 6.9588 eps 0.0900 iteration   5
#> AICc 286.8211 logPost -152.380 logLik -136.335 edf 6.9626 eps 0.0490 iteration   6
#> AICc 286.2149 logPost -152.274 logLik -136.029 edf 6.9649 eps 0.0394 iteration   7
#> AICc 285.9018 logPost -152.247 logLik -135.871 edf 6.9663 eps 0.0311 iteration   8
#> AICc 285.7343 logPost -152.250 logLik -135.787 edf 6.9672 eps 0.0532 iteration   9
#> AICc 285.6412 logPost -152.261 logLik -135.740 edf 6.9678 eps 0.0841 iteration  10
#> AICc 285.5874 logPost -152.273 logLik -135.712 edf 6.9681 eps 0.0100 iteration  11
#> AICc 285.5553 logPost -152.283 logLik -135.696 edf 6.9684 eps 0.0187 iteration  12
#> AICc 285.5355 logPost -152.290 logLik -135.686 edf 6.9686 eps 0.0085 iteration  13
#> AICc 285.5230 logPost -152.296 logLik -135.680 edf 6.9687 eps 0.0036 iteration  14
#> AICc 285.5150 logPost -152.300 logLik -135.675 edf 6.9688 eps 0.0022 iteration  15
#> AICc 285.5098 logPost -152.302 logLik -135.673 edf 6.9688 eps 0.0015 iteration  16
#> AICc 285.5063 logPost -152.304 logLik -135.671 edf 6.9688 eps 0.0010 iteration  17
#> AICc 285.5040 logPost -152.305 logLik -135.670 edf 6.9689 eps 0.0007 iteration  18
#> AICc 285.5025 logPost -152.306 logLik -135.669 edf 6.9689 eps 0.0005 iteration  19
#> AICc 285.5015 logPost -152.307 logLik -135.669 edf 6.9689 eps 0.0003 iteration  20
#> AICc 285.5008 logPost -152.307 logLik -135.668 edf 6.9689 eps 0.0002 iteration  21
#> AICc 285.5004 logPost -152.308 logLik -135.668 edf 6.9689 eps 0.0001 iteration  22
#> AICc 285.5001 logPost -152.308 logLik -135.668 edf 6.9689 eps 0.0001 iteration  23
#> AICc 285.5001 logPost -152.308 logLik -135.668 edf 6.9689 eps 0.0001 iteration  23
#> elapsed time:  0.12sec
#> Starting the sampler...
#> 
#> |                    |   0%  1.19sec
#> |*                   |   5%  1.08sec  0.06sec
#> |**                  |  10%  1.04sec  0.12sec
#> |***                 |  15%  1.01sec  0.18sec
#> |****                |  20%  0.96sec  0.24sec
#> |*****               |  25%  0.94sec  0.31sec
#> |******              |  30%  0.88sec  0.38sec
#> |*******             |  35%  0.83sec  0.45sec
#> |********            |  40%  0.77sec  0.51sec
#> |*********           |  45%  0.74sec  0.60sec
#> |**********          |  50%  0.67sec  0.67sec
#> |***********         |  55%  0.61sec  0.74sec
#> |************        |  60%  0.54sec  0.81sec
#> |*************       |  65%  0.47sec  0.87sec
#> |**************      |  70%  0.41sec  0.95sec
#> |***************     |  75%  0.34sec  1.01sec
#> |****************    |  80%  0.27sec  1.08sec
#> |*****************   |  85%  0.20sec  1.15sec
#> |******************  |  90%  0.14sec  1.22sec
#> |******************* |  95%  0.07sec  1.29sec
#> |********************| 100%  0.00sec  1.36sec
#> .. not computing effect plot for term lin(~x1+x2+x3+fac), use predict() instead!

summary(b)
#> 
#> Call:
#> bamlss(formula = f, data = d)
#> ---
#> Family: gaussian 
#> Link function: mu = identity, sigma = log
#> *---
#> Formula mu:
#> ---
#> num ~ lin(~x1 + x2 + x3 + fac, ridge = TRUE)
#> -
#> Parametric coefficients:
#>                Mean    2.5%     50%   97.5% parameters
#> (Intercept) -0.1843 -0.2388 -0.1833 -0.1350     -0.185
#> -
#> Acceptance probability:
#>       Mean 2.5% 50% 97.5%
#> alpha    1    1   1     1
#> -
#> Smooth terms:
#>                             Mean    2.5%     50%   97.5% parameters
#> lin(~x1+x2+x3+fac).tau21 0.07251 0.01449 0.04914 0.28027      0.058
#> lin(~x1+x2+x3+fac).alpha 1.00000 1.00000 1.00000 1.00000         NA
#> lin(~x1+x2+x3+fac).edf   4.95496 4.87434 4.96262 4.99337      4.969
#> ---
#> Formula sigma:
#> ---
#> sigma ~ 1
#> -
#> Parametric coefficients:
#>               Mean   2.5%    50%  97.5% parameters
#> (Intercept) -1.141 -1.200 -1.141 -1.080     -1.148
#> -
#> Acceptance probability:
#>         Mean   2.5%    50% 97.5%
#> alpha 0.9842 0.8754 1.0000     1
#> ---
#> Sampler summary:
#> -
#> DIC = 285.6311 logLik = -139.2622 pd = 7.1066
#> runtime = 1.378
#> ---
#> Optimizer summary:
#> -
#> AICc = 285.5001 edf = 6.9689 logLik = -135.6683
#> logPost = -152.3082 nobs = 500 runtime = 0.117
#>