To implement the Wald test as previously done in the TI Nspire CX CAS on the Casio 9860, some programming can help achieve building the matrices more easily. In the Casio Basic, list and matrix are accessed in index and by looping through for loops, values from formula calculation can be assigned. This result in the same matrix constructed in using the constructMat() function in the Nspire.
The rest of calculations are the same.
Busy depot with trains going in and out on the same track!
Here’s how it is done: Send train to depot of type like the above, while it is half way in click the ignore traffic light button.
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.
The next step involved determining the y hat values from the regression model for each data row.
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.
Using a previous example on logistic regression, the likelihood ratio can be calculated for an estimate of goodness of fit of the parameters in the regression model. Assuming a confidence level of 95%, and hypothesis setting below:
Null hypothesis: A1=A2=0.
Alternative hypothesis: Not A1=A2=0.
Firstly, recall the parameters of the logistic regression are obtained by the Nelder-Mead method:
Since the maximum likelihood approach is used, the maximum likelihood value, L, is obtained:
The success and failure count are obtained, and then substituted into the equation below together with the maximum likelihood.
Finally, the χ² distribution for the value obtained above is determined, with degree of freedom of 2.
Since P-value is smaller than 0.05, therefore the conclusion is reject the null hypothesis A1=A2=0 and accept Not A1=A2=0.
This is handy for a lot of reasons, like rescuing disk data or fixing boot configuration. The detail is here at the Amazon documentation. The outline of steps is below:
- Stop the original instance.
- Detach the volume from the stopped instance.
- Create a new instance of similar type to the original instance and assign the same security group.
- Start the new instance.
- Attach the detached original volume to the new instance as /dev/xvdf
- Login to the new instance, create mount point and mount the original volume.
- Once completed, umount the original volume and detach from the new instance.
- Attach the original volume to the original instance as /dev/sda1
- Start the original instance.
Essential commands for this, based on Ubuntu. Some steps above are done in the AWS Console GUI.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 8G 0 disk
xvda1 202:1 0 8G 0 part /
xvdf 202:80 0 10G 0 disk
xvdf1 202:81 0 10G 0 part
ubuntu:~$ sudo file -s /dev/xvdf
/dev/xvdf: x86 boot sector
ubuntu:~$ sudo mkdir /rescue
ubuntu:~$ sudo mount /dev/xvdf1 /rescue
Decision tree classification can be done with ease in R with the help from the package
rpart. Additionally, the natural outcome of any decision tree is the visualization and can also be conveniently achieved by the package
A collection of some frequently used R commands.
Creating column for categorical group assignment. Shown below is to assign A/B/C according to some existing values.
Similarly for new column for derived values from existing column.
Sampling using the sampling package with strata.
With R Studio, view command can be invoked from clicking the variable under the Environment tab, and the frame will then be listed nicely in a tabular format in the data frame window.
Data frame at a glance – head, str, summary.