The generic function is only a copy of smooth.construct adding a argument. For objects of class "bamlss.frame" and "bamlss" the method extracts all smooth model terms, see function bamlss.frame for details on the setup of BAMLSS.

## Function as in package mgcv
## but with additional dots argument.
smooth.construct(object, data, knots, ...)

## For 'bamlss.frame's.
# S3 method for bamlss.frame
smooth.construct(object, data = NULL, knots = NULL,
  model = NULL, drop = TRUE, ...)

# S3 method for bamlss.formula
smooth.construct(object, data = NULL, knots = NULL,
  model = NULL, drop = TRUE, ...)

# S3 method for bamlss.terms
smooth.construct(object, data = NULL, knots = NULL,
  model = NULL, drop = TRUE, ...)

Arguments

object

Either a smooth specification object, or object of class "bamlss", "bamlss.frame", "bamlss.formula" or "bamlss.terms". For smooth specification objects, see function smooth.construct.

data

A data frame or list, see also see function smooth.construct.

knots

See function smooth.construct.

model

Character, specifies for which model parameter the smooth constructs should be created.

drop

If there is only one model parameter the returned named list is simplified.

Arguments passed to the smooth term constructor functions.

Value

For smooth specification objects see function see smooth.construct. For objects of class "bamlss.frame" or "bamlss" the list of smooth constructs, see function bamlss.frame for more details.

See also

Examples

## Generate some data. d <- GAMart() ## Create a "bamlss.frame". bf <- bamlss.frame(num ~ s(x1) + s(x2), data = d) ## Extract the smooth construct. sc <- smooth.construct(bf) str(sc)
#> List of 2 #> $ mu :List of 1 #> ..$ smooth.construct:List of 2 #> .. ..$ s(x1):List of 23 #> .. .. ..$ term : chr "x1" #> .. .. ..$ bs.dim : num 10 #> .. .. ..$ fixed : logi FALSE #> .. .. ..$ dim : int 1 #> .. .. ..$ p.order : num 0 #> .. .. ..$ by : chr "NA" #> .. .. ..$ label : chr "s(x1)" #> .. .. ..$ xt :List of 2 #> .. .. .. ..$ center: logi TRUE #> .. .. .. ..$ before: logi TRUE #> .. .. ..$ id : NULL #> .. .. ..$ sp : NULL #> .. .. ..$ drop.null : num 0 #> .. .. ..$ X : num [1:500, 1:9] 1.123 1.121 1.101 -0.303 -0.923 ... #> .. .. ..$ S :List of 1 #> .. .. .. ..$ : num [1:9, 1:9] 8.001 1.07 -4.043 0.675 -4.856 ... #> .. .. ..$ UZ : num [1:502, 1:10] -0.822 -0.803 -0.775 -0.763 -0.76 ... #> .. .. ..$ Xu : num [1:500, 1] -0.499 -0.496 -0.492 -0.49 -0.49 ... #> .. .. ..$ df : num 9 #> .. .. ..$ shift : num [1(1d)] 0.5 #> .. .. ..$ rank : num 8 #> .. .. ..$ null.space.dim: num 1 #> .. .. ..$ plot.me : logi TRUE #> .. .. ..$ side.constrain: logi TRUE #> .. .. ..$ S.scale : num 20.5 #> .. .. ..$ X.dim : int 9 #> .. .. ..- attr(*, "class")= chr [1:2] "tprs.smooth" "mgcv.smooth" #> .. .. ..- attr(*, "qrc")=List of 4 #> .. .. .. ..$ qr : num [1:10, 1] 1.982 -0.125 -0.385 -0.132 0.396 ... #> .. .. .. ..$ rank : int 1 #> .. .. .. ..$ qraux: num 1.47 #> .. .. .. ..$ pivot: int 1 #> .. .. .. ..- attr(*, "class")= chr "qr" #> .. .. ..- attr(*, "nCons")= int 1 #> .. ..$ s(x2):List of 23 #> .. .. ..$ term : chr "x2" #> .. .. ..$ bs.dim : num 10 #> .. .. ..$ fixed : logi FALSE #> .. .. ..$ dim : int 1 #> .. .. ..$ p.order : num 0 #> .. .. ..$ by : chr "NA" #> .. .. ..$ label : chr "s(x2)" #> .. .. ..$ xt :List of 2 #> .. .. .. ..$ center: logi TRUE #> .. .. .. ..$ before: logi TRUE #> .. .. ..$ id : NULL #> .. .. ..$ sp : NULL #> .. .. ..$ drop.null : num 0 #> .. .. ..$ X : num [1:500, 1:9] -1.058 -0.672 1.21 -1.089 -1.106 ... #> .. .. ..$ S :List of 1 #> .. .. .. ..$ : num [1:9, 1:9] 9.85 1.25 -4.96 0.81 -5.89 ... #> .. .. ..$ UZ : num [1:502, 1:10] -0.813 -0.791 -0.791 -0.785 -0.759 ... #> .. .. ..$ Xu : num [1:500, 1] -0.476 -0.472 -0.472 -0.471 -0.467 ... #> .. .. ..$ df : num 9 #> .. .. ..$ shift : num [1(1d)] 0.48 #> .. .. ..$ rank : num 8 #> .. .. ..$ null.space.dim: num 1 #> .. .. ..$ plot.me : logi TRUE #> .. .. ..$ side.constrain: logi TRUE #> .. .. ..$ S.scale : num 17.4 #> .. .. ..$ X.dim : int 9 #> .. .. ..- attr(*, "class")= chr [1:2] "tprs.smooth" "mgcv.smooth" #> .. .. ..- attr(*, "qrc")=List of 4 #> .. .. .. ..$ qr : num [1:10, 1] 1.964 -0.106 -0.378 -0.137 0.391 ... #> .. .. .. ..$ rank : int 1 #> .. .. .. ..$ qraux: num 1.48 #> .. .. .. ..$ pivot: int 1 #> .. .. .. ..- attr(*, "class")= chr "qr" #> .. .. ..- attr(*, "nCons")= int 1 #> $ sigma: Named list()
## Also possible with formulas. f <- bamlss.formula(list( num ~ s(x1) + te(lon,lat), sigma ~ s(x2) ), family = "gaussian") sc <- smooth.construct(f, data = d) str(sc)
#> List of 2 #> $ mu :List of 1 #> ..$ smooth.construct:List of 2 #> .. ..$ s(x1) :List of 23 #> .. .. ..$ term : chr "x1" #> .. .. ..$ bs.dim : num 10 #> .. .. ..$ fixed : logi FALSE #> .. .. ..$ dim : int 1 #> .. .. ..$ p.order : num 0 #> .. .. ..$ by : chr "NA" #> .. .. ..$ label : chr "s(x1)" #> .. .. ..$ xt :List of 2 #> .. .. .. ..$ center: logi TRUE #> .. .. .. ..$ before: logi TRUE #> .. .. ..$ id : NULL #> .. .. ..$ sp : NULL #> .. .. ..$ drop.null : num 0 #> .. .. ..$ X : num [1:500, 1:9] 1.123 1.121 1.101 -0.303 -0.923 ... #> .. .. ..$ S :List of 1 #> .. .. .. ..$ : num [1:9, 1:9] 8.001 1.07 -4.043 0.675 -4.856 ... #> .. .. ..$ UZ : num [1:502, 1:10] -0.822 -0.803 -0.775 -0.763 -0.76 ... #> .. .. ..$ Xu : num [1:500, 1] -0.499 -0.496 -0.492 -0.49 -0.49 ... #> .. .. ..$ df : num 9 #> .. .. ..$ shift : num [1(1d)] 0.5 #> .. .. ..$ rank : num 8 #> .. .. ..$ null.space.dim: num 1 #> .. .. ..$ plot.me : logi TRUE #> .. .. ..$ side.constrain: logi TRUE #> .. .. ..$ S.scale : num 20.5 #> .. .. ..$ X.dim : int 9 #> .. .. ..- attr(*, "class")= chr [1:2] "tprs.smooth" "mgcv.smooth" #> .. .. ..- attr(*, "qrc")=List of 4 #> .. .. .. ..$ qr : num [1:10, 1] 1.982 -0.125 -0.385 -0.132 0.396 ... #> .. .. .. ..$ rank : int 1 #> .. .. .. ..$ qraux: num 1.47 #> .. .. .. ..$ pivot: int 1 #> .. .. .. ..- attr(*, "class")= chr "qr" #> .. .. ..- attr(*, "nCons")= int 1 #> .. ..$ te(lon,lat):List of 22 #> .. .. ..$ margin :List of 2 #> .. .. .. ..$ :List of 18 #> .. .. .. .. ..$ term : chr "lon" #> .. .. .. .. ..$ bs.dim : num 5 #> .. .. .. .. ..$ fixed : logi FALSE #> .. .. .. .. ..$ dim : int 1 #> .. .. .. .. ..$ p.order : num NA #> .. .. .. .. ..$ by : chr "NA" #> .. .. .. .. ..$ label : chr "s(lon)" #> .. .. .. .. ..$ xt : NULL #> .. .. .. .. ..$ id : NULL #> .. .. .. .. ..$ sp : NULL #> .. .. .. .. ..$ X : num [1:500, 1:5] 0 0.55184 0.55184 -0.00612 1 ... #> .. .. .. .. ..$ S :List of 1 #> .. .. .. .. .. ..$ : num [1:5, 1:5] 102.86 -233.14 164.57 -41.14 6.86 ... #> .. .. .. .. ..$ rank : num 3 #> .. .. .. .. ..$ null.space.dim: num 2 #> .. .. .. .. ..$ df : num 5 #> .. .. .. .. ..$ xp : Named num [1:5] 0 0.25 0.5 0.75 1 #> .. .. .. .. .. ..- attr(*, "names")= chr [1:5] "0%" "25%" "50%" "75%" ... #> .. .. .. .. ..$ F : num [1:25] 0 0 0 0 0 ... #> .. .. .. .. ..$ noterp : logi TRUE #> .. .. .. .. ..- attr(*, "class")= chr "cr.smooth" #> .. .. .. ..$ :List of 18 #> .. .. .. .. ..$ term : chr "lat" #> .. .. .. .. ..$ bs.dim : num 5 #> .. .. .. .. ..$ fixed : logi FALSE #> .. .. .. .. ..$ dim : int 1 #> .. .. .. .. ..$ p.order : num NA #> .. .. .. .. ..$ by : chr "NA" #> .. .. .. .. ..$ label : chr "s(lat)" #> .. .. .. .. ..$ xt : NULL #> .. .. .. .. ..$ id : NULL #> .. .. .. .. ..$ sp : NULL #> .. .. .. .. ..$ X : num [1:500, 1:5] 1 0.55184 0 -0.00282 0.77109 ... #> .. .. .. .. ..$ S :List of 1 #> .. .. .. .. .. ..$ : num [1:5, 1:5] 102.86 -233.14 164.57 -41.14 6.86 ... #> .. .. .. .. ..$ rank : num 3 #> .. .. .. .. ..$ null.space.dim: num 2 #> .. .. .. .. ..$ df : num 5 #> .. .. .. .. ..$ xp : Named num [1:5] 0 0.25 0.5 0.75 1 #> .. .. .. .. .. ..- attr(*, "names")= chr [1:5] "0%" "25%" "50%" "75%" ... #> .. .. .. .. ..$ F : num [1:25] 0 0 0 0 0 ... #> .. .. .. .. ..$ noterp : logi TRUE #> .. .. .. .. ..- attr(*, "class")= chr "cr.smooth" #> .. .. ..$ term : chr [1:2] "lon" "lat" #> .. .. ..$ by : chr "NA" #> .. .. ..$ fx : logi [1:2] FALSE FALSE #> .. .. ..$ label : chr "te(lon,lat)" #> .. .. ..$ dim : int 2 #> .. .. ..$ np : logi TRUE #> .. .. ..$ id : NULL #> .. .. ..$ sp : NULL #> .. .. ..$ inter : logi FALSE #> .. .. ..$ xt :List of 2 #> .. .. .. ..$ center: logi TRUE #> .. .. .. ..$ before: logi TRUE #> .. .. ..$ mc : logi [1:2] FALSE FALSE #> .. .. ..$ plot.me : logi TRUE #> .. .. ..$ X : num [1:500, 1:24] -0.0137 0.2512 -0.0134 -0.0439 0.1802 ... #> .. .. ..$ S :List of 2 #> .. .. .. ..$ : num [1:24, 1:24] 0.16478 0.01293 0.01081 0.00496 0.05105 ... #> .. .. .. ..$ : num [1:24, 1:24] 1.0359 -0.8889 0.4242 -0.0363 0.035 ... #> .. .. ..$ df : int 24 #> .. .. ..$ null.space.dim: num 3 #> .. .. ..$ rank : num [1:2(1d)] 15 15 #> .. .. ..$ XP : list() #> .. .. ..$ side.constrain: logi TRUE #> .. .. ..$ S.scale : num [1:2] 0.368 0.368 #> .. .. ..$ X.dim : int 24 #> .. .. ..- attr(*, "class")= chr [1:2] "tensor.smooth" "mgcv.smooth" #> .. .. ..- attr(*, "qrc")=List of 4 #> .. .. .. ..$ qr : num [1:25, 1] -0.2217 0.1353 0.14 0.1462 0.0761 ... #> .. .. .. ..$ rank : int 1 #> .. .. .. ..$ qraux: num 1.04 #> .. .. .. ..$ pivot: int 1 #> .. .. .. ..- attr(*, "class")= chr "qr" #> .. .. ..- attr(*, "nCons")= int 1 #> $ sigma:List of 1 #> ..$ smooth.construct:List of 1 #> .. ..$ s(x2):List of 23 #> .. .. ..$ term : chr "x2" #> .. .. ..$ bs.dim : num 10 #> .. .. ..$ fixed : logi FALSE #> .. .. ..$ dim : int 1 #> .. .. ..$ p.order : num 0 #> .. .. ..$ by : chr "NA" #> .. .. ..$ label : chr "s(x2)" #> .. .. ..$ xt :List of 2 #> .. .. .. ..$ center: logi TRUE #> .. .. .. ..$ before: logi TRUE #> .. .. ..$ id : NULL #> .. .. ..$ sp : NULL #> .. .. ..$ drop.null : num 0 #> .. .. ..$ X : num [1:500, 1:9] -1.058 -0.672 1.21 -1.089 -1.106 ... #> .. .. ..$ S :List of 1 #> .. .. .. ..$ : num [1:9, 1:9] 9.85 1.25 -4.96 0.81 -5.89 ... #> .. .. ..$ UZ : num [1:502, 1:10] -0.813 -0.791 -0.791 -0.785 -0.759 ... #> .. .. ..$ Xu : num [1:500, 1] -0.476 -0.472 -0.472 -0.471 -0.467 ... #> .. .. ..$ df : num 9 #> .. .. ..$ shift : num [1(1d)] 0.48 #> .. .. ..$ rank : num 8 #> .. .. ..$ null.space.dim: num 1 #> .. .. ..$ plot.me : logi TRUE #> .. .. ..$ side.constrain: logi TRUE #> .. .. ..$ S.scale : num 17.4 #> .. .. ..$ X.dim : int 9 #> .. .. ..- attr(*, "class")= chr [1:2] "tprs.smooth" "mgcv.smooth" #> .. .. ..- attr(*, "qrc")=List of 4 #> .. .. .. ..$ qr : num [1:10, 1] 1.964 -0.106 -0.378 -0.137 0.391 ... #> .. .. .. ..$ rank : int 1 #> .. .. .. ..$ qraux: num 1.48 #> .. .. .. ..$ pivot: int 1 #> .. .. .. ..- attr(*, "class")= chr "qr" #> .. .. ..- attr(*, "nCons")= int 1