Skip to content

Instantly share code, notes, and snippets.

@bivoje
Created May 12, 2019 11:44
Show Gist options
  • Save bivoje/08e39f8be88ba0b153f52eedff739c87 to your computer and use it in GitHub Desktop.
Save bivoje/08e39f8be88ba0b153f52eedff739c87 to your computer and use it in GitHub Desktop.
Problem solved for Exercise 5.4.13 of "Probability and Statistical Inference 9th Ed"
(* Probability and Statistical Inference 9th *)
(* Exercise 5.4.13 *)
(* h1 == f *)
h1[x_] := (x+1)/6
(* adopted result of excercise 5.4.9. *)
lift[f_, n_] := Sum[f[x] f[#1-x], {x, Max[#1-n, 0], Min[n, #1]}] &
(* a,b) h2 == W1 == W2 *)
h2 := lift[h1, 2]
Map[h2,Range[0, 2 2]]
(* c) h4 == W *)
h4 := lift[h2, 4]
Map[h4,Range[0, 2 4]]
(* d) h8 == Y *)
h8 := lift[h4, 8]
Map[h8,Range[0, 2 8]]
(* e) they are all skewed *)
BarChart[Map[h1,Range[0, 2 1]]]
BarChart[Map[h2,Range[0, 2 2]]]
BarChart[Map[h4,Range[0, 2 4]]]
BarChart[Map[h8,Range[0, 2 8]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment