Input Modeling: Estimation, Testing and Correlation
Estimate parameters from data, test a candidate distribution and measure dependence: Exercise 4 solved step by step.
Modeling and Simulation (2026-2027) · Input Modeling: Estimation, Testing and Correlation01 / 70
Input modeling works on recorded data. It estimates the parameters of the data, tests whether a candidate distribution fits it, and checks whether two variables depend on each other. All six problems of Exercise 4 are solved step by step.
Objectives
Estimate the sample mean and the sample variance from a frequency table.
Check whether two jointly discrete random variables are independent.
Estimate the parameters of lognormal data from its natural logarithms.
Use the chi-square test to check whether data is Poisson distributed.
Compute E, Var, Cov and Cor for two jointly continuous random variables.
Measure the correlation between two recorded variables.
1. What this exercise does
Job
What you compute
Questions
Estimate parameters from data
Sample mean and sample variance
Q1, Q3
Test a candidate distribution
Chi-square statistic and the decision
Q4
Check dependence
The product of the two distributions against the joint one
Q2, Q5
Measure correlation
Covariance and correlation coefficient
Q5, Q6
Q1 and Q4 use the same data: Q4 tests the arrivals of Q1 and uses the mean computed in Q1.
2. Sample mean and variance
Q1: arrivals over 100 days
At a particular time of day, for a fixed time (10 minutes for example), the arrivals are recorded for 100 days and classified as in the table. Estimate the sample mean and variance.
Each row holds a value mj (arrivals per day) and its frequency fj (the number of days). Two extra columns prepare the two sums:
Note on the exercise sheet. The sheet writes the sum as (fjmj)2, and expands it as (0×12)2+(1×10)2+…. Taken literally, that sum is 13684. The correct term is fjmj2, which gives the 2080 that the sheet itself uses, so its answer 7.63 is right.
3. Dependence of jointly discrete variables
Q2: a joint probability function
X and Y are jointly discrete random variables with:
p(x,y)=⎩⎨⎧30x+y0x=0,1,2and y=0,1,2,3otherwise
Check the dependence of X and Y.
X and Y are independent if PX(x)PY(y)=p(x,y). Get PX(x) by summing over all y:
Therefore X and Y are not independent. Three points show what the inequality means:
Point (x,y)
p(x,y)
PX(x)PY(y)
Match
(0, 0)
0 / 150
3 / 150
No
(1, 2)
15 / 150
15 / 150
Yes
(2, 3)
25 / 150
28 / 150
No
The two sides match at (1, 2), in fact at every point with x = 1. A match at one point proves nothing: independence needs a match at every point, and one point that fails is enough to show dependence.
4. Parameters of lognormal data
Q3: the rate of return on 10 investments
For a lognormal distribution, suppose you are given the rate of return on 10 investments: 18.8, 27.9, 21, 6.1, 37.4, 5, 22.9, 1, 3.1, 8.3.
To estimate the parameters of this lognormal data, take the natural logarithm of every value:
Note on the exercise sheet. The sheet rounds 22.5/10 to 2.3 and then uses 2.3 in the variance, which gives (62.29−52.9)/9=1.04. Rounding the mean before squaring it changes the answer by a large amount. The correct values from the sheet's logarithms are μ^=2.25 and σ^2=1.30. With the logarithms at full precision, they are μ^=2.27 and σ^2=1.32.
5. Testing a distribution: the chi-square test
Q4: is the arrival data Poisson?
Use the chi-square test to check the following data as Poisson distributed:
Arrivals/day
0
1
2
3
4
5
6
7
8
9
10
11
Observed frequency
12
10
19
17
10
8
7
5
5
3
3
1
This is the data of Q1, so n = 100, and the parameter is estimated by the mean: α^=3.64. The hypothesis H0: the data is Poisson distributed. The symbol α has two meanings in this question: α^=3.64 is the Poisson parameter, and α=0.05 later is the level of significance.
The Poisson probability function gives the expected frequency:
Note on the exercise sheet. The denominator of f(x) on the sheet is written as x with a subscript. It must be the factorial x!. The sheet also calls f(x) a probability density function, although x here is discrete. And it cuts 0.0956 to 0.095, which gives E=9.5. Rounded correctly, E=9.6.
Similarly, for all values:
x
O
f(x)
E
0
12
0.0263
2.6
1
10
0.0956
9.6
2
19
0.1739
17.4
3
17
0.2110
21.1
4
10
0.1920
19.2
5
8
0.1398
14.0
6
7
0.0848
8.5
7
5
0.0441
4.4
8
5
0.0201
2.0
9
3
0.0081
0.8
10
3
0.0030
0.3
11
1
0.0010
0.1
Intervals of small values (for example ≤5) are combined with adjacent intervals. Here x = 0 joins x = 1, and x = 7 to x = 11 join into one interval, which leaves 7 intervals. Then compute (Oi−Ei)2/Ei for each:
From the chi-square table, read the value for α=0.05 and k−s−1 degrees of freedom. Here k = 7 is the number of class intervals after combining the small ones, and s = 1 is the number of estimated parameters of the candidate distribution:
k−s−1χ0.05,52=7−1−1=5=11.1
Since χ02=27.69>χ0.05,52=11.1, H0 is rejected: the data is not Poisson distributed.
Note on the exercise sheet. The sheet's term for x = 6 is 0.72, but (7−8.5)2/8.5=0.26. With E=9.5 it also has 12.1 and 8.1 for the first interval, where the correct values are 12.2 and 7.87. Its last term 11.62 should round to 11.63, because 88.36/7.6=11.626. Its total is therefore 28.37, where the correct total is 27.69, or 27.63 when nothing is rounded before the sum. The decision does not change: each of these totals is above 11.1.
The chi-square table
The table on the sheet, with ν the degrees of freedom. Q4 reads row 5 in the column χ0.052.
ν
χ0.0052
χ0.012
χ0.0252
χ0.052
χ0.102
1
7.88
6.63
5.02
3.84
2.71
2
10.60
9.21
7.38
5.99
4.61
3
12.84
11.34
9.35
7.81
6.25
4
14.86
13.28
11.14
9.49
7.78
5
16.7
15.1
12.8
11.1
9.2
6
18.5
16.8
14.4
12.6
10.6
7
20.3
18.5
16.0
14.1
12.0
8
22.0
20.1
17.5
15.5
13.4
9
23.6
21.7
19.0
16.9
14.7
10
25.2
23.2
20.5
18.3
16.0
11
26.8
24.7
21.9
19.7
17.3
12
28.3
26.2
23.3
21.0
18.5
13
29.8
27.7
24.7
22.4
19.8
14
31.3
29.1
26.1
23.7
21.1
15
32.8
30.6
27.5
25.0
22.3
16
34.3
32.0
28.8
26.3
23.5
17
35.7
33.4
30.2
27.6
24.8
18
37.2
34.8
31.5
28.9
26.0
19
38.6
36.2
32.9
30.1
27.2
20
40.0
37.6
34.2
31.4
28.4
21
41.4
38.9
35.5
32.7
29.6
22
42.8
40.3
36.8
33.9
30.8
23
44.2
41.6
38.1
35.2
32.0
24
45.6
43.0
39.4
36.4
33.2
25
46.9
44.3
40.6
37.7
34.4
26
48.3
45.6
41.9
38.9
35.6
27
49.6
47.0
43.2
40.1
36.7
28
51.0
48.3
44.5
41.3
37.9
29
52.3
49.6
45.7
42.6
39.1
30
53.7
50.9
47.0
43.8
40.3
40
66.8
63.7
59.3
55.8
51.8
50
79.5
76.2
71.4
67.5
63.2
60
92.0
88.4
83.3
79.1
74.4
70
104.2
100.4
95.0
90.5
85.5
80
116.3
112.3
106.6
101.9
96.6
90
128.3
124.1
118.1
113.1
107.6
100
140.2
135.8
129.6
124.3
118.5
Note on the exercise sheet. In the column χ0.0052, the printed table on the sheet reads 14.96 in row 4 and 49.6 in row 25. The correct values are 14.86 and 46.9, and the table above uses them. Q4 does not read these rows.
6. Jointly continuous variables
Q5: dependence, covariance and correlation
X and Y are jointly continuous random variables with:
f(x,y)=⎩⎨⎧y−x00≤x≤1and 1≤y≤2otherwise
(a) Check the dependence of X and Y. (b) Compute E(X), Var(X), E(Y), Var(Y), Cov(X,Y) and Cor(X,Y).
Q5 (a): the dependence
Integrate over y to get fX(x), and over x to get fY(y):
Note on the exercise sheet. The second line of this integral on the sheet is written with xy(x−y). Since f(x,y)=y−x, the correct form is xy(y−x). With x−y the result would be −2/3. The sheet's next line follows from y−x, so its value 2/3 is correct. The sheet also writes this expected value as E(x,y); it is the expected value of the product XY. It also writes the double integral with dx dy, although its next line integrates over y first, so this page writes dy dx.
The value is close to 1, so X1 and X2 are very strongly positively correlated.
Note on the exercise sheet. The sheet adds "if X1<μ1 then X2<μ2, and if X1>μ1 then X2>μ2". This is a tendency and not a rule: 8 of the 10 years follow it, and the years (5.8, 106) and (6.3, 96) do not.
8. Common mistakes
Squaring the whole product. The variance term is fjmj2. In Q1, (fjmj)2 would add up to 13684, not 2080.
Rounding the mean before squaring it. In Q3, 2.3 in place of 2.25 turns the variance 1.30 into 1.04.
Stopping at one matching point. In Q2 the two sides match at every point with x = 1, and X and Y are still not independent.
Forgetting the factorial. The Poisson denominator is x!. It decides every expected frequency from x = 2 upward.
Wrong degrees of freedom. Count k after combining the small intervals, and subtract s for the estimated parameter: 7 - 1 - 1 = 5 in Q4, not 12 - 1 = 11.
Reversing the decision. A statistic larger than the table value means H0 is rejected.
9. Practice
Solve each problem, then check the answers at the end of this page. All of them use the data and the table of this exercise.
For Q2, compare p(x,y) with PX(x)PY(y) at the point (2, 0).
For Q4, compute f(2) and the expected frequency E from the formula.
For Q4, repeat the decision at α=0.01.
For Q5, integrate f(x,y) over its whole range, and give the result.
Repeat Q3 with the logarithms rounded to two decimals, and compute μ^ and σ^2.
Key takeaways
From a frequency table, the sample mean uses ∑fjmj and the sample variance uses ∑fjmj2.
Two variables are independent only if the product of their distributions equals the joint function at every point.
For lognormal data, take the natural logarithms first, then compute their mean and variance.
Chi-square: compute Ei=nf(x), combine the small intervals, sum (Oi−Ei)2/Ei, and compare with the table at k−s−1 degrees of freedom.
Var(X)=E(X2)−[E(X)]2 and Cov(X,Y)=E(XY)−E(X)E(Y).
Cor=Cov/(σ1σ2): a value close to 1 means a strong positive correlation.
Answers
Practice 1
p(2,0)=2/30=10/150. PX(2)=7/15 and PY(0)=1/10, so the product is 7/150. The two values do not match, as expected for dependent variables.
Practice 2
f(2)E=2!e−3.64(3.64)2=0.1739=100×0.1739=17.4
This is the value in the table of Q4.
Practice 3
The degrees of freedom stay at 5, and the table gives χ0.01,52=15.1. Since 27.69>15.1, H0 is still rejected.