Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

re: st: All Possible 2-way Interactions


From   David Airey <[email protected]>
To   [email protected]
Subject   re: st: All Possible 2-way Interactions
Date   Thu, 30 Oct 2003 16:11:17 -0600

I posted this a while back.

/* This program generates all two way interactions.
It was written on 6/29/03 by David C. Airey, Ph.D.,
and meant to be used to aid testing a full model and
a reduced model with a general linear test, where
the full model has all interactions and the reduced
model has none. The general linear test is:
local F = ((`sser' - `ssef')/(`dfr' - `dff')) / (`ssef'/`dff')
local Fp = Ftail((`dfr'-`dff'),`dff', `F')
display `F', `Fp'
 */

program define atwi
	version 8
	syntax varlist(min = 2 numeric)
	local t : word count `varlist'
	tokenize `varlist'
	forvalues j = 1/`=`t'-1' {
		forvalues k = `=`j'+1'/`t' {
			generate ``j''x``k'' = ``j''*``k''
		}
	}
end

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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