This code is not runnable unless you specify where you got the tauchen
function from. Is it a package? (There is no using
statement in the code you quoted.)
Also, you did’t quote the whole error message; what is the backtrace?
PS. Please quote your code.