Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



--------------------------------------------------------------------------------

Nick has answered the first part of the question.

The extension you seek is an application of the code I sent you
yesterday. I leave finding the numbers corresponding to the median and
the minimum for you. If you run into difficulties, let me know.

/***********************************************/
clear*
sysuse auto, clear
set matsize 1200

foreach n1 in 0 5 10 {
	foreach n2 in 0 5 10 {
		foreach n3 in 0 5 10 {
			foreach n4 in 0 5 10 {
			
				generate su_`n1'_`n2'_`n3'_`n4'= ///
					(`n1'*mpg)/10+(`n2'*weight)/10+ ///
						(`n3'*length)/10+(`n4'*headroom)/10
				generate price_`n1'_`n2'_`n3'_`n4'= ///
					price- su_`n1'_`n2'_`n3'_`n4'
				regress price_`n1'_`n2'_`n3'_`n4'   ///
					turn displacement gear_ratio foreign, robust
				mat mBeta= (nullmat(mBeta) \  e(b))
				mat mN = (nullmat(mN)\ (`n1', `n2', `n3', `n4'))
			
			}
		}
	}
}
local matcolnames: colnames mBeta
mat colnames mN = n1 n2 n3 n4
local matcolnames2: colnames mN
mat mA = (mBeta, mN)
matlist mA



-- 
Zhi Su
348 Holmes Hall
Northeastern University
360 Huntington Avenue
Boston, MA 02115
Office:1-617-373-2316
email:[email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index