Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: matrix colnames manipulation


From   <S.Jenkins@lse.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: matrix colnames manipulation
Date   Thu, 5 Jul 2012 10:06:48 +0100

Thanks for Maarten Buis and Nick Cox for their solutions. Note to self:
persevere. I should have got those myself.  
[In case you were wondering why I wanted to do this: -gllamm- has a
cluster-robust standard error option whereas -xtprobit- does not.]

Stephen
-------------------------------------
Professor Stephen P. Jenkins <s.jenkins@lse.ac.uk>
Department of Social Policy 
London School of Economics and Political Science
Houghton Street, London WC2A 2AE, U.K.
Tel: +44 (0)20 7955 6527
Changing Fortunes: Income Mobility and Poverty Dynamics in Britain, OUP
2011, http://ukcatalogue.oup.com/product/9780199226436.do
Survival Analysis using Stata:
http://www.iser.essex.ac.uk/survival-analysis  
Downloadable papers and software: http://ideas.repec.org/e/pje7.html 

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

Date: Wed, 4 Jul 2012 11:20:44 +0200
From: Maarten Buis <maartenlbuis@gmail.com>
Subject: Re: st: matrix colnames manipulation

On Wed, Jul 4, 2012 at 11:06 AM,  <S.Jenkins@lse.ac.uk> wrote:
> I want to use estimates derived using -xtprobit- as starting values
for
> estimation using -gllamm, family(binomial) link(probit)
> from(mat_start)-. (-gllamm- is on SSC.)  To use the "from" option, I
> want to manipulate the full column names of the e(b) matrix produced
by
> -xtprobit-. The issue is that -gllamm- labels the column corresponding
> to the variance of the random effect differently to -xtprobit-. So,
> specifically, how, within a long list of colnames stored with a macro,
> does one change the final name?

What about the following solution:

*---------------------- begin example ------------------------
local coln `"bu_SA:Lfemale bu_SA:Ledq_low lnsig2u:_cons"'
local coln : subinstr local coln "lnsig2u:_cons" "pid1:_cons"
di "`coln'"
*----------------------- end example -------------------------
(For more on examples I sent to the Statalist see:
 http://www.maartenbuis.nl/example_faq )

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

Date: Wed, 4 Jul 2012 10:24:32 +0100
From: Nick Cox <njcoxstata@gmail.com>
Subject: Re: st: matrix colnames manipulation

In the same spirit -- but assuming each name is different --

local nnames : word count `longmacro'
local last : word `nnames' of `longmacro'
local longmacro : subinstr local longmacro "`last'" "<whatever>"

Nick


Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer

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