Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Flip a matrix around

From   dferry <>
Subject   st: Flip a matrix around
Date   Wed, 2 Aug 2006 16:27:30 -0400

Dear Statalisters,

I am trying to write a program that will compute Pr(T>t) after running -dfgls-. It looks like this:

capture program drop get_dfglsResults;
program get_dfglsResults, rclass;

	version 9;
	local optlag = r(maiclag);
	matrix r = r(results);
	local T = r[`optlag', 5];
	local df = r(N) - `optlag';
	return scalar p = ttail(`df', `T');

The problem is that the results of dfgls for each lag are listed in reverse order (i.e., results for lag m are listed first and results for lag 1 are listed last). So, the line "local T = r[`optlag', 5]" does not grab the right row. Can I flip the matrix r around so (or re-sort the rows) so that the first row corresponds to the results for lag 1 and the row m corresponds to results for lag m? Or is there perhaps a better way to approach this?


*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index