Wald test on mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg82487] Wald test on mathematica
- From: "Mauricio Esteban Cuak" <cuak2000 at gmail.com>
- Date: Mon, 22 Oct 2007 05:36:07 -0400 (EDT)
Hello there. I've been trying to make a Wald test, but I got into some problems. Lists are sort of vectors I guess, but they don't always function that way.Here is my ordinary least squares function: ols[x_, y_] := (Inverse[Transpose[x].x]).Transpose[x].y; And my wald test: wald[r_, q_, x_, y_] := (Transpose[(r.ols[x, y]) - q].Inverse[ r.Inverse[Transpose[x].x].Transpose[r]].(r.ols[x, y] - q)*(Part[ Dimensions[x], 1] - Part[Dimensions[xdmda], 2]))/((errors[x, y].errors[x, y])* Part[Dimensions[r], 1]) Where r and q make up the linear restrictions as in rb = q The thing that bothers me is (and it's the same with ols) that I can't use this same function if x is a vector instead of a matrix or if r is a vector, because mathematica will not allow me to transpose a one-dimensional list. What should I do? Should I make a "If, then" thingy or is there some simpler way I'm not aware of for dealing with this kind of situatitions? Thanks!