4.1 Why normal distributions are normal

Code 4.1

Code 4.2

Code 4.3

Code 4.4

Code 4.5

4.2 A language for describing models

Code 4.6

4.3 Gaussian model of height

Code 4.7

Code 4.8

Code 4.9

Code 4.10

Code 4.11

Code 4.12

Code 4.13

Code 4.14

Code 4.15

Code 4.16

Code 4.17

Code 4.18

Code 4.19

Code 4.20

Code 4.21

Code 4.22

Code 4.23

Code 4.24

Code 4.25

Code 4.26

Code 4.27

Code 4.28

Code 4.29

Code 4.30

Code 4.31

Code 4.32

Code 4.33

Code 4.34

Code 4.35

Code 4.36

4.4 Linear predictions

Code 4.37

Code 4.38

Code 4.39

Code 4.40

Code 4.41

Code 4.42

Code 4.43

Code 4.44

Code 4.45

Code 4.46

Code 4.47

Code 4.48

Code 4.49

Code 4.50

Code 4.51

Code 4.52

Code 4.53

Code 4.54

Code 4.55

Code 4.56

Code 4.57

Code 4.58

Code 4.59

Code 4.60

Code 4.61

Code 4.62

Code 4.63

4.5 Curves from lines

Code 4.64

Code 4.65

Code 4.66

Code 4.67

Code 4.68

Code 4.69

Code 4.70 and 4.71

Looks like Julia plots don't support change of ticks proposed in the book. But much more natural way will be to remap values we're plotting back to the original scale. Example of this is below.

Code 4.72

Code 4.73

Code 4.74

Code 4.75

Code 4.76

This way of calucalting bsplines is slightly slower, than shown in the book (with pre-calculated matrix) but it is much cleaner in my perspective.

You can do comparison yourself by precalculating spline matrix outside of the model and do matrix multiplication in the model instead of spline evialutaion. Example of doing this is at code block 4.79

Code 4.77

Code 4.78

Code 4.79

How to build the model with explicit spline matrix calculation