I have written this simple code to demonstrate the concept of Generalized method of moments.
Follwoing are the ideas behind this tutorial/code:
1.We simulate random variables in T distribution with a given degrees of freedom.
2.Just for comparision purposes, we use maximum likelihood estimation to determine the estimation of the degrees of freedom parameter.
3.We use the property of the 2nd moment analytical formula, and solve the equation to find DF estimiate.
4.We use the property of the 4th moment analytical formula, and solve the equation to find DF estimiate. Note that this will be different from value result of (3)
5.We assume weight matrix as indentity matrix, and solve both the moments together by criteria function as mentioned in lecture notes
Generalized Method of Moments - lecture notes by Stanislav RadchenkoNote that W matrix used is an arbitrary choice and may be suboptimal. I will continue more about the optimization in next tutorial