Statalist


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

RE: st: multivariate normal regression with ml, linear form


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

Thanks Maarten,

Sound really a good idea! Just a follow up question. I am trying to check what the code does and therefore look into the macro `u_k' to make sure it contains what I want. In this simple case I want it to contain "u1 u2 u3". So I am typing:

-----
clear

scalar u1 = 1
scalar u2 = 5
scalar u3 = -1

local u_k "u1"

forvalues i = 2/3 {
	local u_k "`u_k' u`i'"
	display `u_k'
      }

display `u_k'
-----

Why when I ask Stata to display the macro content inside the loop it works fine but when I ask it just after the loop, Stata does not return any value?

I guess this is probably a naive question from a beginner Stata programmer, sorry!

Cheers

Carlo




-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maarten buis
Sent: 18 February 2009 13:33
To: stata list
Subject: RE: st: multivariate normal regression with ml, linear form

--- Carlo Fezzi wrote:
> 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.

In -dirifit- (downloadable from SSC) I stored the number of depedent
variables in a global $S_k and the file dirifit_lf.ado started with:

*! MLB 1.0.0 23 Mar 2006 
program dirifit_lf
        version 8.2

        local alpha_k "ln_alpha1"
        forvalues i = 2/$S_k {
                local alpha_k "`alpha_k' ln_alpha`i'"
        }

        args lnf `alpha_k'
 

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      

*
*   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/


*
*   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