Quiz 1.2: Missingness and stochasticity
Q1: Missingness
Which of the following questions are correct ?
RESOLUTION
Missing
and Nothing
are the name of the types of the singleton instances missing
and nothing
respectively. The former (missing
) is used to signal the missingness of information concerning some data, and propagates silently (i.e., without generating an error) across function calls, the latter (nothing
) instead should never appear as argument of a function, so to raise an error if indeed it appears. So none of the above sentences is true. Note that this is how nothing
and missing
are intended to be used, and the way they are used across Julia base and all the most used packages, but "nothing" ( :) ) forbids you to implement a custom function to process a nothing
or missing
value.
The correct answers are:
- "None of the (other) sentences is correct"
Q2: Stochasticity
Given that after running the following code:
myRNG = MersenneTwister(123)
a1 = rand(myRNG,10:100,3)
a2 = rand(myRNG,10:100,3)
myRNG = MersenneTwister(123)
b1 = rand(myRNG,10:1000,2)
b2 = rand(myRNG,10:100,4)
You end up with:
- a1 = [97,42,?₁]
- a2 = [?₂,?₃,?₄]
- b1 = [959,364]
- b2 = [34,54,67,56]
Which is the sum of ?₁ + ?₂ + ?₃ + ?₄
?
RESOLUTION
The flow of random numbers in the two sets of commands (a1
and a2
vs. b1
and b2
) must be the same, as both follow the initialization of the random number generator with the same fixed seed, little matter if they are scaled over a 10:100 or 10:1000 range. From the provided information we know that the 4th, 5th, 6th and 7th values, scaled over the 10:100 range, are respectivelly 34
, 54
, 67
and 56
. so ?1
(the third value in the first flow of random numbers) must be also 34
and a2
must be [54,67,56]
. The sum is then 211
The correct answers is: 211