[Date Index] [Thread Index] [Author Index]
Wald test on mathematica
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!