Statalist


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

st: multivariate normal regression with ml, linear form


From   "Carlo Fezzi" <c.fezzi@uea.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: multivariate normal regression with ml, linear form
Date   Wed, 18 Feb 2009 12:59:18 -0000

Dear all,

I am trying to write my likelihood function to estimate a multivariate
normal regression using the method ?lf?.

I am not sure how write a function flexible enough to work with different
numbers of equations, in particular, I don?t know how to define the
arguments. For example, given a model with 5 equations:

------------------
clear
set obs 1000

global neq = 5

matrix r = (1, 0.35, 0.5, 0.7, 0.1 \ 0.35, 1, 0.2, 0.1, 0.6 \ ///
0.5, 0.2, 1, 0.4, 0.3 \ 0.7, 0.1, 0.4, 1, 0.4 \ ///
0.1, 0.6, 0.3, 0.4, 1)

drawnorm u1 u2 u3 u4 u5, corr(r)

gen x1 = uniform() -0.5
gen x2 = 2*uniform() + 0.5

gen y1 = 0.5 + 4*x1 + u1
gen y2 = -1 -2*x1 + 3*x2 + u2
gen y3 = 3 + 3*x1 - 2*x2 + u3
gen y4 = -3 +x1 + x2 + u4
gen y5 = 6 - 4*x1 + u5

capture program drop multireg_lf
program multireg_lf
	version 10.1
	args ???????
------------------

I don?t know how to define the args. For example, if it is a bivariate
equations it would be mu1 mu2 lnsigma1 lnsigma2 r12, but for a 4 or 5
equations model it would have of course more arguments. I guess it could be
a function of the global var neq, but I don?t know which is the correct way
to specify the args. I am having a look at the book ?maximum likelihood
estimation with Stata? but they show how to do it with the method ?d1?,
which is not really what I want. I would by far prefer ?lf?.

I would be very grateful to any of the expert users of ml for their advice,

All the best,

Carlo


**************************************************
Carlo Fezzi
Senior Research Associate
Centre for Social Research on the Global Environment (CSERGE)
Department of Environmental Sciences
University of East Anglia
Norwich (UK) NR2 7TJ 
Telephone: +44(0)1603 591385
Fax: +44(0)1603 593739
*************************************************



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index