Description Slots Author(s) See Also Examples
The bse
class stores three variables that result from predicting
a given broken stick model. The bse
class extends
the xyz-class
class. The bse
class calculates
predicted values from the broken stick model fitted to the
values specified in the data
argument of the
new("bse", data)
function.
call
:An object of class call
that refers to an object
with a pre-fitted broken stick model. Evaluation by eval(call)
should
yield an object of class brokenstick
as created by
brokenstick
.
found
:Logical indicating whether the broken stick model
specified by call
was actually found.
zscale
:A logical indicating whether the broken stick model
models the outcome in the Z-scale (zscale = TRUE
, default) or Y-scale
(zscale = FALSE
). At initialization, the new()
function tries
to infer and set this flag from the model specified by call
.
Stef van Buuren
xyz-class
, brokenstick
,
predict.brokenstick
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | library(donorloader)
smocc_bs <- load_data(dnr = "smocc_bs")
# specify three height measures for child
child <- new("xyz", x = c(0, 0.2, 0.5), y = c(51.0, 54.1, 63.4))
# we get no Z-score conversion because haven't told the child's sex
child
boy <- new("xyz", x = c(0, 0.2, 0.5), y = c(51.0, 54.1, 63.4), sex = "male")
girl <- new("xyz", x = c(0, 0.2, 0.5), y = c(51.0, 54.1, 63.4), sex = "female")
boy
girl
d1 <- new("bse", child)
d1
# Same, but now for the girl
d2 <- new("bse", girl)
d2
# Calculate predicted value for each x
d3 <- new("bse", new("xyz", x = c(0, 0.2, 0.5), y = c(51.0, 54.1, 63.4),
sex = "female"))
d3
d4 <- new("bse", new("xyz", x = c(0, 0.2, 0.5), y = c(51.0, 54.1, 63.4),
sex = "female"), at = "knots")
d4
# use transform_y function instead of reference call
# now, -0.126 is converted to 41.2 cm
d5 <- new("bse", girl, usetransform = TRUE, ga = 32, sex = "female")
d5
d5@transform
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.