This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-03
Channels
- # announcements (17)
- # asami (17)
- # babashka (20)
- # beginners (110)
- # calva (1)
- # cherry (3)
- # cider (1)
- # clj-kondo (21)
- # clj-on-windows (1)
- # cljsrn (5)
- # clojure (142)
- # clojure-austin (1)
- # clojure-europe (72)
- # clojure-france (28)
- # clojure-hungary (2)
- # clojure-nl (2)
- # clojure-norway (38)
- # clojure-poland (2)
- # clojure-uk (3)
- # clojurescript (4)
- # cursive (33)
- # data-science (3)
- # datahike (5)
- # datomic (1)
- # emacs (27)
- # events (3)
- # fulcro (15)
- # graalvm (4)
- # gratitude (2)
- # honeysql (7)
- # humbleui (8)
- # introduce-yourself (11)
- # jobs-discuss (9)
- # lambdaisland (3)
- # lsp (18)
- # malli (62)
- # music (1)
- # nbb (3)
- # off-topic (10)
- # pathom (3)
- # pedestal (6)
- # polylith (5)
- # re-frame (7)
- # releases (2)
- # shadow-cljs (33)
- # sql (1)
- # test-check (23)
- # vim (20)
- # xtdb (9)
I have a general question about linear regression models, hope that's allowed here. I'm struggling with the concept of simulations for linear regression models. I have a simple linear model for weight (W) on height (H), with 352 observations in the dataset.
Wi ~ N(μi, σ)
μi = α + β(Hi - Hbar)
(α, β are stochastic)
I run the model, conditioned on the dataset, and generate traces for the posteriors. For my trace, for μ, I get n samples for every value of H in the dataset. Say the first 2 values for H in the set are 151.76 and 139.70.
i → | 0 | 1 | ...
Height → | 151.76 | 139.70 | ...
-----------------------------------
PostSmples| 43.53 | 36.23 | ...
for μ | 42.84 | 34.88 | ...
↓ | ... | ... | ...
So now I can simulate weights for any value of H that is in the dataset by randomly picking a values of mu from the trace for that particular H (and sigma) and doing w=normal(μi, σ).sample()
But how do I generalize that to turn it into a simulation model for arbitrary H? i.e. for values of H that are not in the dataset?
ThanksLinear regression let's you find a straight line that best fits your data.
( y = m * x + c )
where m
is slope c
is y-intercept. So once you have m
and c
from linear regression, you can put any value of x
into the formula to predict y
.