Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf ·...

41
EBPI Epidemiology, Biostatistics and Prevention Institute Understanding and Applying Transformation Models Torsten Hothorn 2020-06-18

Transcript of Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf ·...

Page 1: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

EBPI Epidemiology, Biostatistics and Prevention Institute

Understanding and ApplyingTransformation ModelsTorsten Hothorn

2020-06-18

Page 2: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Regression Models

Unconditional distribution

Y ∼ PY

Conditional distribution

Y |X = x ∼ PY |X=x

Aim: Obtain estimates PY and PY |X=x

University of Zurich, EBPI 2020-06-18 Transformation Models Page 2

Page 3: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Unconditional Binary Response

Y ∈ {y1, y2}

P(Y ≤ y1) = π1

P(Y ≤ y2) = 1

with π1 ∈ [0, 1] or, equivalently, with ϑ1 ∈ R

P(Y ≤ y1) = FZ (ϑ1)

P(Y ≤ y2) = 1 = FZ (∞)

FZ : R→ [0, 1] is cdf of some continuous rv Z

University of Zurich, EBPI 2020-06-18 Transformation Models Page 3

Page 4: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

FZ

FZ (z) = Φ(z)

FZ (z) = FSL(z) = (1 + exp(−z))−1

FZ (z) = FMEV(z) = 1− exp(− exp(z))...

ϑ1 = log(π/(1− π)) for FZ = FSL

University of Zurich, EBPI 2020-06-18 Transformation Models Page 4

Page 5: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Conditional Binary Response

P(Y ≤ y1 | X = x) = π1(x>β) = FZ (ϑ1 + x>β)

P(Y ≤ y2 | X = x) = 1 = FZ (∞+ x>β)

Probit regression: FZ = ΦLogistic regression: FZ = FSLComplementary log-log regression: FZ = FMEV

University of Zurich, EBPI 2020-06-18 Transformation Models Page 5

Page 6: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Unconditional Ordered Categorical Response

Y ∈ {y1, y2, . . . , yK}

P(Y ≤ y1) = FZ (ϑ1)

P(Y ≤ y2) = FZ (ϑ2)...

P(Y ≤ yK−1) = FZ (ϑK−1)

P(Y ≤ yK ) = FZ (∞)

st ϑk < ϑk+1 for k = 1, . . . ,K − 1

aka multinomial model

University of Zurich, EBPI 2020-06-18 Transformation Models Page 6

Page 7: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Conditional Ordered Categorical Response (Simple)

P(Y ≤ y1 | X = x) = FZ (ϑ1 + x>β)

P(Y ≤ y2 | X = x) = FZ (ϑ2 + x>β)...

P(Y ≤ yK−1 | X = x) = FZ (ϑK−1 + x>β)

P(Y ≤ yK |X = x) = FZ (∞+ x>β)

st ϑk < ϑk+1 for k = 1, . . . ,K − 1

Proportional odds (FZ = FSL) and proportional hazards(FZ = FMEV) cumulative models

University of Zurich, EBPI 2020-06-18 Transformation Models Page 7

Page 8: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Conditional Ordered Categorical Response (Complex)

P(Y ≤ y1 | X = x) = FZ (ϑ1 + x>β1)

P(Y ≤ y2 | X = x) = FZ (ϑ2 + x>β2)...

P(Y ≤ yK−1 | X = x) = FZ (ϑK−1 + x>βK−1)

P(Y ≤ yK |X = x) = FZ (∞+ x>βK )

st ϑk + x>βk < ϑk+1 + x>βk+1 for k = 1, . . . ,K − 1 and all x

Non-proportional odds (FZ = FSL), aka logistic multinomialregression, and non-proportional hazards (FZ = FMEV)cumulative models

University of Zurich, EBPI 2020-06-18 Transformation Models Page 8

Page 9: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Simplify (?) Notation

Unconditional

P(Y ≤ y) = FZ (hY (y))

hY : {y1, . . . , yK} → R monotone, hY (yK ) =∞Conditional

P(Y ≤ y | X = x) = FZ (hY (y) + x>β(y))

st hY (yk) + x>β(yk) < hY (yk+1) + x>β(yk+1)for k = 1, . . . ,K − 1 and all x

University of Zurich, EBPI 2020-06-18 Transformation Models Page 9

Page 10: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Unconditional Continuous Response

y ∈ R

P(Y ≤ y) = FY (y) = FZ (hY (y))

hY : R→ Rst hY (y) < hY (y + δ) for all δ > 0

Note: hY = F−1Z ◦ FY always exists and Z = hY (Y )

University of Zurich, EBPI 2020-06-18 Transformation Models Page 10

Page 11: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Conditional Continuous Response (Simple)

y ∈ R

P(Y ≤ y | X = x) = FZ (hY (y) + x>β)

st hY (y) < hY (y + δ) for all δ > 0

Note: Z = hY (Y ) + x>β and thus E(hY (Y )) = E(Z )− x>β

University of Zurich, EBPI 2020-06-18 Transformation Models Page 11

Page 12: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Normal Linear Regression Model (NLRM)

Y |X = x ∼ N (α + x>β, σ2)

P(Y ≤ y | X = x) = Φ

(y − α− x>β

σ

)= Φ(ϑ1 + ϑ2y + x>β)

= FZ (hY (y) + x>β)

hY (y) is linear in y with positive slope ϑ2 = σ−1

E(hY (Y )) = E(ϑ1 + ϑ2Y ) = x>β

University of Zurich, EBPI 2020-06-18 Transformation Models Page 12

Page 13: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Beyond Normality

Linear Transformation Model:

P(Y ≤ y | X = x) = FZ (hY (y) + x>β)

hY Φ FSL FMEV

ϑ1 + ϑ2y NLRMϑ1 + ϑ2 log(y) log-normal log-logistic exponential/WeibullBox-Cox Box-Coxmonotone Cox

University of Zurich, EBPI 2020-06-18 Transformation Models Page 13

Page 14: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Beyond Normality

Linear Transformation Model:

P(Y ≤ y | X = x) = FZ (hY (y) + x>β)

hY Φ FSL FMEV

ϑ1 + ϑ2y NLRM ? ?ϑ1 + ϑ2 log(y) log-normal log-logistic exponential/WeibullBox-Cox Box-Cox ? ?monotone !!! !!! Cox

University of Zurich, EBPI 2020-06-18 Transformation Models Page 14

Page 15: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Conditional Continuous Response (Complex)

y ∈ R

P(Y ≤ y | X = x) = FZ (hY (y) + x>β(y))

st hY (y) + x>β(y) < hY (y + δ) + x>β(y + δ) for all δ > 0 andx

Note: Z = hY (Y ) + x>β(Y )

Time-varying Cox/AFT or non-proportional hazards models,distribution regression.

University of Zurich, EBPI 2020-06-18 Transformation Models Page 15

Page 16: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Conditional Continuous Response (Too Complex?)

y ∈ R

P(Y ≤ y | X = x) = FZ (h(y |x))

st h(y |x) < h(y + δ|x) for all δ > 0 and x

Note: Z = h(Y |x) instead of the usual

Y = h−1(Z |x) = g(x) + σZ

University of Zurich, EBPI 2020-06-18 Transformation Models Page 16

Page 17: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Unconditional Discrete Response

y ∈ N

P(Y ≤ y) = FZ (hY (y))

hY : N→ Rst hY (y) < hY (y + 1)

University of Zurich, EBPI 2020-06-18 Transformation Models Page 17

Page 18: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Conditional Discrete Response

y ∈ N

P(Y ≤ y | X = x) = FZ (h(y |x))

st h(y |x) < h(y + 1|x) for all x

University of Zurich, EBPI 2020-06-18 Transformation Models Page 18

Page 19: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Conditional Transformation Models

For all univariate Y

P(Y ≤ y | X = x) = FZ (h(y |x))

st h(y |x) monotone in y for all x

h is called “conditional transformation function” by Hothorn,Kneib and Buhlmann (2014, JRSS B)

University of Zurich, EBPI 2020-06-18 Transformation Models Page 19

Page 20: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

The Likelihood

Datum (¯y , y ] ⊂ R (continuous) or (

¯y , y ] = (yk−1, yk ] (discrete)

Fisher’s “exact” likelihood

L(h|Y ∈ (¯y , y ],X = x) := FZ (h(y | x))− FZ (h(

¯y | x))

= 1− FZ (h(¯y | x)) right-censored

= FZ (h(y | x))− 0 left-censored

University of Zurich, EBPI 2020-06-18 Transformation Models Page 20

Page 21: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

The Likelihood

Truncation to (yl , yr ]:

L(h|Y ∈ (¯y , y ],X = x)

L(h|Y ∈ (yl , yr ],X = x)

Closed forms for scores and Fisher information available

For continuous datum y ∈ R approximate by density

fY (y | x) = fZ (h(y | x))h′(y | x)

University of Zurich, EBPI 2020-06-18 Transformation Models Page 21

Page 22: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Parameterisation

With basis function c

h(y | x) = c(y , x)>ϑ

(FZ , c,ϑ) is a fully specified parametric model

c(y , x)>ϑML is called most likely transformation (MLT)

ϑML from constrained convex optimisation (augmentedLagrangian adaptive barrier minimization in alabama orspectral projected gradient in BB)

University of Zurich, EBPI 2020-06-18 Transformation Models Page 22

Page 23: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

mlt Package

The mlt package (on CRAN) implements maximum-likelihoodestimation for

– unconditional and conditional transformation models,including all stratified linear transformation models

– for discrete (also counts) and continuous responses

– under all forms of random censoring and truncation,

– based on a variety of basis functions (log, polynomial,Bernstein, Legendre, ...) and combinations thereof,

– allowing specification, inference and the model-basedbootstrap for unfitted (got no data yet) and fittedtransformation models.

University of Zurich, EBPI 2020-06-18 Transformation Models Page 23

Page 24: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Old Faithful

> library("mlt")> var_d <- numeric_var("duration", support = c(1.0, 5.0),+ add = c(-1, 1), bounds = c(0, Inf))> B_d <- Bernstein_basis(var = var_d, order = 8, ui = "increasing")> ctm_d <- ctm(response = B_d, todistr = "Normal")> str(nd_d <- as.data.frame(mkgrid(ctm_d, 200)))

'data.frame': 200 obs. of 1 variable:$ duration: num 0 0.0302 0.0603 0.0905 0.1206 ...

> data("geyser", package = "TH.data")> system.time(mlt_d <- mlt(ctm_d, data = geyser))

user system elapsed0.104 0.008 0.125

> logLik(mlt_d)

'log Lik.' -317.766 (df=9)

University of Zurich, EBPI 2020-06-18 Transformation Models Page 24

Page 25: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Old Faithful

> nd_d$d <- predict(mlt_d, newdata = nd_d, type = "density")> plot(d ~ duration, data = nd_d, type = "l", ylab = "Density",+ xlab = "Duration")

0 1 2 3 4 5 6

0.0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Duration

Den

sity

University of Zurich, EBPI 2020-06-18 Transformation Models Page 25

Page 26: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

A Bit Simpler

> library("tram")> BC_d <- BoxCox(duration ~ 1, data = geyser, support = c(1.0, 5.0),+ bounds = c(0, Inf), order = 8)> logLik(BC_d)

'log Lik.' -317.766 (df=9)

> max(abs(nd_d$d - predict(as.mlt(BC_d), newdata = nd_d,+ type = "density")))

[1] 1.371163e-05

University of Zurich, EBPI 2020-06-18 Transformation Models Page 26

Page 27: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Parametric Bootstrap Old Faithful

> new_d <- simulate(mlt_d, nsim = 100)> llr <- numeric(length(new_d))> pdist <- vector(mode = "list", length = length(new_d))> pdens <- vector(mode = "list", length = length(new_d))> ngeyser <- geyser> q <- mkgrid(var_d, 100)[[1]]> for (i in 1:length(new_d)) {+ ngeyser$duration <- new_d[[i]]+ mlt_i <- mlt(ctm_d, data = ngeyser, scale = TRUE,+ theta = coef(mlt_d))+ llr[[i]] <- logLik(mlt_i) - logLik(mlt_i, parm = coef(mlt_d))+ pdist[[i]] <- predict(mlt_i, newdata = data.frame(1),+ type = "distribution", q = q)+ pdens[[i]] <- predict(mlt_i, newdata = data.frame(1),+ type = "density", q = q)+ }

University of Zurich, EBPI 2020-06-18 Transformation Models Page 27

Page 28: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Parametric Bootstrap Old Faithful

0 1 2 3 4 5 6

0.0

0.2

0.4

0.6

0.8

1.0

Duration

Dis

trib

utio

n

0 1 2 3 4 5 60.

00.

20.

40.

60.

8

Duration

Den

sity

University of Zurich, EBPI 2020-06-18 Transformation Models Page 28

Page 29: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Boston Housing: Normal Linear Regression

medv|X = x ∼ N(α + x>β, σ2)

> data("BostonHousing2", package = "mlbench")> lm_BH <- lm(cmedv ~ crim + zn + indus + chas + nox + rm + age ++ dis + rad + tax + ptratio + b + lstat,+ data = BostonHousing2)> logLik(lm_BH)

'log Lik.' -1494.245 (df=15)

University of Zurich, EBPI 2020-06-18 Transformation Models Page 29

Page 30: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Boston Housing: Linear Transformation Model

P(medv ≤ y | X = x) = Φ(hmedv(y) + x>β)

= Φ(aBs,6(y)>ϑ+ x>β)

> BostonHousing2$medvc <- with(BostonHousing2,+ Surv(cmedv, cmedv < 50))> var_m <- numeric_var("medvc", support = c(10.0, 40.0),+ bounds = c(0, Inf))> fm_BH <- medvc ~ crim + zn + indus + chas + nox + rm + age ++ dis + rad + tax + ptratio + b + lstat> B_m <- Bernstein_basis(var_m, order = 6, ui = "increasing")> ctm_BH <- ctm(B_m, shift = fm_BH[-2L], data = BostonHousing2,+ todistr = "Normal")> system.time(mlt_BH <- mlt(ctm_BH, data = BostonHousing2,+ scale = TRUE))

user system elapsed0.071 0.000 0.072

> logLik(mlt_BH)

'log Lik.' -1324.698 (df=20)

University of Zurich, EBPI 2020-06-18 Transformation Models Page 30

Page 31: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

A Bit Simpler

> summary(BoxCox(fm_BH, data = BostonHousing2, support = c(10.0, 40.0),+ bounds = c(0, Inf), order = 6))

Non-normal (Box-Cox-Type) Linear Regression Model

Call:BoxCox(formula = fm_BH, data = BostonHousing2, support = c(10,

40), bounds = c(0, Inf), order = 6)

Coefficients:Estimate Std. Error z value Pr(>|z|)

crim -0.0436952 0.0074108 -5.896 3.72e-09 ***zn 0.0073865 0.0029986 2.463 0.01377 *indus 0.0115342 0.0131448 0.877 0.38023chas1 0.6042276 0.1862668 3.244 0.00118 **nox -4.8541649 0.8232730 -5.896 3.72e-09 ***rm 0.4850649 0.0958760 5.059 4.21e-07 ***age -0.0026669 0.0028333 -0.941 0.34656dis -0.3131881 0.0441232 -7.098 1.27e-12 ***rad 0.0792150 0.0142717 5.550 2.85e-08 ***tax -0.0036801 0.0008036 -4.580 4.66e-06 ***ptratio -0.2239607 0.0286362 -7.821 5.33e-15 ***b 0.0026304 0.0005753 4.572 4.83e-06 ***lstat -0.1649685 0.0122001 -13.522 < 2e-16 ***---Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Log-Likelihood:-1324.698 (df = 20)Likelihood-ratio Test: Chisq = 840.5506 on 13 degrees of freedom; p = < 2.2e-16

University of Zurich, EBPI 2020-06-18 Transformation Models Page 31

Page 32: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Boston Housing

Normal Linear Model

Linear predictor

Obs

erve

d

10

20

30

40

50

0 10 20 30 40

0.1

0.2

0.3

0.4

0.50.60.70.8

0.9

Linear Transformation Model

Linear predictor

Obs

erve

d10

20

30

40

50

−14 −12 −10 −8 −6 −4 −2

0.10.2

0.30.40.5

0.60.70.80.9

University of Zurich, EBPI 2020-06-18 Transformation Models Page 32

Page 33: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Boston Housing: Distribution Regression

P(medv ≤ y |X = x) = Φ

hY (y) +J∑

j=1

βj(y)xj

= Φ

aBs,6(y)>ϑ1 +J∑

j=1

aBs,6(y)>ϑj+1xj

> b_BH_s <- as.basis(fm_BH[-2L], data = BostonHousing2, scale = TRUE)> ctm_BHi <- ctm(B_m, interacting = b_BH_s, sumconstr = FALSE)> system.time(mlt_BHi <- mlt(ctm_BHi, data = BostonHousing2,+ scale = TRUE))

user system elapsed1.65 0.00 1.65

> logLik(mlt_BHi)

'log Lik.' -1274.373 (df=98)

University of Zurich, EBPI 2020-06-18 Transformation Models Page 33

Page 34: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Boston Housing

0 10 20 30 40

0.00

0.10

0.20

0.30

Linear Transformation Model

Median Value

Den

sity

0 10 20 30 400.

000.

100.

200.

30

Distribution Regression

Median Value

Den

sity

University of Zurich, EBPI 2020-06-18 Transformation Models Page 34

Page 35: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Boston Housing: Transformation Tree

P(medv ≤ y |X = x) = Φ(aBs,4(y)>ϑ(x))

lstatp < 0.001

1

≤ 14.98 > 14.98

rmp < 0.001

2

≤ 6.794 > 6.794

lstatp < 0.001

3

≤ 7.67 > 7.67

n = 74

10 20 30 40 50

0

0.2

0.4

0.6

0.8

1

crimp < 0.001

5

≤ 0.63 > 0.63

rmp < 0.001

6

≤ 6.059 > 6.059

n = 65

10 20 30 40 50

0

0.2

0.4

0.6

0.8

1n = 62

10 20 30 40 50

0

0.2

0.4

0.6

0.8

1n = 55

10 20 30 40 50

0

0.2

0.4

0.6

0.8

1

crimp < 0.001

10

≤ 0.091 > 0.091

n = 48

10 20 30 40 50

0

0.2

0.4

0.6

0.8

1n = 40

10 20 30 40 50

0

0.2

0.4

0.6

0.8

1

agep < 0.001

13

≤ 92.1 > 92.1

n = 51

10 20 30 40 50

0

0.2

0.4

0.6

0.8

1

crimp < 0.001

15

≤ 7.404 > 7.404

n = 56

10 20 30 40 50

0

0.2

0.4

0.6

0.8

1n = 55

10 20 30 40 50

0

0.2

0.4

0.6

0.8

1

University of Zurich, EBPI 2020-06-18 Transformation Models Page 35

Page 36: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Growth Curves: Head Circumference (HC)

P(HC ≤ y | age = a) = Φ((aBs,3(y)> ⊗ bBs,3(a1/3)>)ϑ)

> data("db", package = "gamlss.data")> db$lage <- with(db, age^(1/3))> var_head <- numeric_var("head", bounds = range(db$head),+ support = quantile(db$head, c(.1, .9)))> B_head <- Bernstein_basis(var_head, order = 3, ui = "increasing")> var_lage <- numeric_var("lage", bounds = range(db$lage),+ support = quantile(db$lage, c(.1, .9)))> B_age <- Bernstein_basis(var_lage, order = 3, ui = "none")> ctm_head <- ctm(B_head, interacting = B_age)> system.time(mlt_head <- mlt(ctm_head, data = db, scale = TRUE))

user system elapsed0.617 0.012 0.629

University of Zurich, EBPI 2020-06-18 Transformation Models Page 36

Page 37: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Growth Curves: Head Circumference

Age (years)

Hea

d ci

rcum

fere

nce

(cm

)

35

40

45

50

55

60

65

0.5 1.0 1.5 2.0

0.0040.020

0.1000.2500.5000.7500.9000.9800.996

Age < 2.5 yrs

5 10 15 20

0.0040.020

0.1000.250

0.5000.7500.900

0.9800.996

Age > 2.5 yrs

University of Zurich, EBPI 2020-06-18 Transformation Models Page 37

Page 38: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Computing on Models

> pY <- function(x) pchisq(x, df = 20)> dY <- function(x) dchisq(x, df = 20)> qY <- function(p) qchisq(p, df = 20)> yvar <- numeric_var("y", support = qY(c(.001, 1 - .001)),+ bounds = c(0, Inf))> By <- Bernstein_basis(yvar, order = ord <- 15, ui = "increasing")> mod <- ctm(By)> h <- function(x) qnorm(pY(x))> x <- seq(from = support(yvar)[["y"]][1],+ to = support(yvar)[["y"]][2],+ length.out = ord + 1)> mlt::coef(mod) <- h(x)> d <- as.data.frame(mkgrid(yvar, n = 500))> d$grid <- d$y> d$y <- simulate(mod, newdata = d)> fmod <- mlt(mod, data = d, scale = TRUE)> logLik(fmod)

'log Lik.' -1586.462 (df=16)

> logLik(fmod, parm = coef(mod))

'log Lik.' -1591.712 (df=16)

University of Zurich, EBPI 2020-06-18 Transformation Models Page 38

Page 39: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Computing on Models

y

Den

sity

0 10 20 30 40

0.00

0.02

0.04

0.06

TrueApproximatedEstimated

University of Zurich, EBPI 2020-06-18 Transformation Models Page 39

Page 40: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Where to?

– understanding and teaching: Distributions, not means

– rethink parametric vs. non-parametric statistics

– top-down model diagnostics and checking

– boosting, forests, penalisation, mixed-effects, ...

University of Zurich, EBPI 2020-06-18 Transformation Models Page 40

Page 41: Understanding and Applying Transformation Modelsuser.math.uzh.ch/hothorn/talks/mlt_Linz_2020.pdf · {under all forms of random censoring and truncation, {based on a variety of basis

Resources

– CRAN packages mlt.docreg, mlt, tram, basefun,variables, trtf, tbm, tramME, tramnet, cotram

– http://doi.org/10.18637/jss.v092.i01

– http://ctm.r-forge.r-project.org/

[email protected]

University of Zurich, EBPI 2020-06-18 Transformation Models Page 41