The Wald test can be demonstrated using example from the previous post on the likelihood test for logistic regression. Again, assuming a confidence level of 95%. The hypothesis setting is a little different because this test targets individual parameter in the regression model:
Null hypothesis: A1=0
Alternative hypothesis: A1≠0
To test the hypothesis, the statistic below is obtained using the following equation:
( ma × mb × mat )-1
where ma and mb are matrices and defined as below.
ma consists of the
x2 variables as first and second row, and all 1s as the third row. In the TI Nspire, the function
colAugment is convenient to construct matrix from multiple lists.
Once determined, the matrix mb can be defined as below. It is a diagonal matrix with values correspond to the equation of
y_hat × (1 - y_hat). Notice how
constructMat worked with the piece-wise expression for this diagonal matrix.
The calculation can then be performed. The final results as shown in the second equation below is then used for determination of the P-value of χ² distribution in 1 degree of freedom.
Since the value is less than 0.05, the conclusion is to reject the null hypothesis A1=0 and accept the alternative hypothesis A1≠0.