1.4.9 Multinomial and multi-response fits🔗ℹ

For the multinomial family, coef has one association list per class, keyed by the class label, and for the multi-response family one per response, keyed by the response’s name, as R names the elements of its lists:

> (define level
    (for/list ([b (in-list bp)])
      (cond [(< b 110) 0] [(< b 120) 1] [else 2])))
> (define pulse
    (for/list ([a (in-list age)])
      (+ 60 (* 0.2 a) (uniform -3 3))))
> (define more-patients
    (list* (cons "level" level) (cons "pulse" pulse) patients))
> (coef (formula-fit (~ level age dose) more-patients
                     #:family 'multinomial #:lambda 0.05))

'((0

   ("(Intercept)" . 3.2938252514019353)

   ("age" . -0.10571919431503617)

   ("dose" . 0.45469733094562814))

  (1 ("(Intercept)" . 0.20009627555682247) ("age" . 0.0) ("dose" . 0.0))

  (2

   ("(Intercept)" . -3.4939215269587582)

   ("age" . 0.07102576061614016)

   ("dose" . -0.24587979708768107)))

> (coef (formula-fit (~ (bp pulse) age dose marker) more-patients
                     #:family 'mgaussian #:lambda 0.5))

'(("bp"

   ("(Intercept)" . 93.41619573759917)

   ("age" . 0.5157630574231726)

   ("dose" . -1.773982431574007)

   ("marker" . 0.0))

  ("pulse"

   ("(Intercept)" . 60.949590000631915)

   ("age" . 0.17294527034748675)

   ("dose" . 0.09403996299630309)

   ("marker" . 0.0)))