Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Gllamm for location choice with location specific variables


From   Paulo Guimaraes <[email protected]>
To   [email protected]
Subject   st: Gllamm for location choice with location specific variables
Date   Mon, 20 Nov 2006 09:22:47 -0500

Dear Kevin,

I suspect that if you want to estimate the conditional logit model for a location choice model (where the
number of alternatives is typically very large) then GLLAMM may not be a viable alternative.
If all you want is to add a random effect to the profit specification you may want to look at the Dirichlet-Multinomial
model, which is a generalization of the conditional logit model and works well with large choice sets.
There is a stata command to estimate the dirichlet-multinomial - see my presentation in the NASUG

http://ideas.repec.org/p/boc/asug06/7.html

Hope this helps

Paulo Guimaraes




Date: Sat, 18 Nov 2006 21:49:20 +0000
From: Xiaoheng Zhang <[email protected]>
Subject: st: Gllamm for location choice with location specific variables

Dear all,

I am working on the conditional logit model to look for the determinants of
multinational's location choice of new firms. I used the traditional -CLOGIT-
command and decided to go further using -GLLAMM-.

I redid the discrete choice model example in GLLAMM's manual(Rabe-Hesketh et
al.2004) in Chatper 9.Unfortunately in that example only one explanatory
variable was used and this variable is choicer specific variable-SEX-.In my case
I have some country level variables,i.e. tax rate as well as firm level
variables(nationality) but I cannot figure out how to put both knid of variables
into the model.Besides, my computer took 15 hours to maximize the likelihood but
end up with nothing so I can not even try different combinations..........

Anyone having experiences can give me a hint on how to do it?Data is already in
the "expand" form as required by -CLOGIT-.

Thanks a lot!

Kevin in Dublin

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

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

Date: Sun, 19 Nov 2006 08:47:59 -0500
From: Kit Baum <[email protected]>
Subject: st: ivreg2 updated
The -ivreg2- package of Baum, Schaffer, Stillman has been updated. We have added an improved test for weak instruments---the Cragg/Donald test---for which critical values are available from the work of Jim Stock and Moto Yogo. We thank them for permission to reproduce their published critical values in our code.

The ivreg2 program's output now features hyperlinks to the relevant section of the help file for a number of the statistics reported. The help file itself has been extensively redone with embedded hyperlinks and section headings to ease navigation.

ivreg2 requires Stata 8.2 or better. Users of Stata 7 may use the version accessible from the Stata Journal. You may download the updated ivreg2 using the ssc command or by adoupdate. Please do not download these routines with a web browser, especially in a Windows environment.

We thank the many users who have helped us improve this routine. We are working on more formal documentation of its enhanced abilities, and will circulate that when it is completed. The ivreg2 package includes, as an ancillary file, the certification script which we use to test its reliability. For more information on Stata software certification, please see Bill Gould's paper
http://ideas.repec.org/a/tsj/stataj/v1y2001i1p29-50.html

Kit

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


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

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

Date: Sun, 19 Nov 2006 07:14:41 -0800 (PST)
From: george owuor <[email protected]>
Subject: [none]

Dear all,

i am running instrumental variables estimations. y=f(X,W), and W is endogenours, so stage one becomes W=f(Z), and stage 2 becomes y=f(X, Predicted W). My function is aproduction function with conventional inputs such as fertiliser, seeds, labour and then credit which is the (W). Must the number of RHS variables in stage one be the same number as RHS ones in stage two.

Please help.

Owuor



____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. $510k for $1,698/mo. Calculate new payment! www.LowerMyBills.com/lre

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

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

Date: Sun, 19 Nov 2006 15:39:12 +0000
From: Socrates Mokkas <[email protected]>
Subject: st: Join String Variables

Hi People,

OK, I know how to split string variables but have not found a way to join string variables. Did a search but could not source something out. Can you direct me to a command? Or if not is there a way round it. I just want to put two or more strings in one even if missing values exist. For example,

obs Var1 Var2 Var3 Var3
1 A B K ABK
2 C C
3 D ED BED

I have Var1 and Var2 and want to create Var3.
Thanks a lot.

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

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

Date: Sun, 19 Nov 2006 16:45:01 +0100
From: "Daniel Stegmueller" <[email protected]>
Subject: Re: st: RE: rename individual columns/rows of a matrix

Nick,

thank you very much for your suggestions!

Best,
Daniel




2006/11/17, Nick Cox <[email protected]>:


I think whatever you do will end in something like

matrix rownames ... = ...

or

matrix colnames ... = ...

where the RHS includes the new names. This is adoable,
as I understand it. The question is whether the result
is any less awkward than doing it directly. Here is one stab,
not tested much.

-------------------------------------------- matrcrename.ado
// NJC 1.0.0 17 November 2006
// matrix row_or_column rename
program matrcrename
version 8
// syntax matrixname row_or_col which_row_or_col new_name

// matrix name
gettoken matrix 0 : 0
confirm matrix `matrix'

// row or column
gettoken which 0 : 0
local length = length("`which'")
if lower("`which'") == substr("row",1,`length') {
local which row
}
else if lower("`which'") == substr("column",1,`length') {
local which col
}
else {
di as err "second argument should specify row or column"
exit 198
}

// which row or column
gettoken where newname : 0
if "`which'" == "row" {
capture local found = inrange(`where', 1, rowsof(`matrix'))
if _rc {
di as err "inappropriate row number?"
exit 498
}
if !`found' {
di as err "row out of range"
exit 498
}
}
else {
capture local found = inrange(`where', 1, colsof(`matrix'))
if _rc {
di as err "inappropriate column number?"
exit 498
}
if !`found' {
di as err "column out of range"
exit 498
}
}

// test newname
tempname moo
matrix `moo' = J(1,1,1)
capture matrix rownames `moo' = `newname'
if _rc {
local what = cond("`which'" == "col", "column", "row")
di as err "inappropriate `what' name?"
exit 498
}

// in business!
local names : `which'names `matrix'
tokenize `names'
local `where' `newname'
local newnames "`*'"
matrix `which'names `matrix' = `newnames'
end
--------------------------------------------

Examples:
-----------------------------------------------------------------------------------------------------------
. mat li z

symmetric z[3,3]
X Y Z
a 1
b 1 1
c 1 1 1

. matrcrename z row 3 Stata

. mat li z

symmetric z[3,3]
X Y Z
a 1
b 1 1
Stata 1 1 1

. matrcrename z col 4 SAS
column out of range
r(498);

. matrcrename z col 3 Some Alternative Software
inappropriate column name?
r(498);

. matrcrename frog col 3 toad
matrix frog not found
r(111);

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

Nick
[email protected]

Daniel Stegmueller



is there a quick way to change individual columns or rows of a matrix?
The 'matrix rownames' command is not useful, since I want to use a
loop to rename rows and columns step-by step.

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



- -- Blore's Razor:
Given a choice between two theories, take the one which is funnier.


- ------------------------------------------------------------
Daniel Stegm�ller
Elisabethstr. 3
68165 Mannheim

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

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

Date: Sun, 19 Nov 2006 10:59:58 -0500
From: Kit Baum <[email protected]>
Subject: st: instrumental variables

George said

i am running instrumental variables estimations. y=f(X,W), and W is endogenours, so stage one becomes W=f(Z), and stage 2 becomes y=f (X, Predicted W). My function is aproduction function with conventional inputs such as fertiliser, seeds, labour and then credit which is the (W). Must the number of RHS variables in stage one be the same number as RHS ones in stage two.

George should heed the Statalist FAQ and use informative subject headings on his postings.

He should read any textbook discussion of instrumental variables / two stage least squares. He might also find the Baum/Schaffer/ Stillman Stata Journal article useful; a working paper version can be accessed from
http://ideas.repec.org/a/tsj/stataj/v3y2003i1p1-31.html

One does not run the first stage and second stage as separate regressions. The number of included endogenous variables (one in his example, W) must be less than or equal to the number of excluded instruments. His mention of Z does not make clear whether that is a variable or a matrix of variables. If Z is a single variable, the equation would be exactly identified via the order condition. It would be preferable if the equation were overidentified---if Z contained more than one column---for then Sargan/Hansen tests for overidentifying restrictions could shed some light on the adequacy of the instruments.

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


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

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

Date: Sun, 19 Nov 2006 17:06:01 +0100
From: "Ingo Brooks" <[email protected]>
Subject: Re: st: drop in a do-file

Joe,

I think the problem should be solved by defining -km`i'- to be a
- -tempname-, see -help tempname-.

Hope this helps,
Ingo


On 11/19/06, Joe Trubisz <[email protected]> wrote:


OK...that's useful, but can you explain the following sequence of
commands (some output supressed):

.infile str15 disease v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11
v12 v13 v14 v15 v16 using "/Users/h/ data/
CollectedBucketsL16.txt",clear

. do clusterk 4
. cap: drop km* <--- added this as you suggest to the do file
. local low = `1' - 2
. local high = `1' + 4
. forvalues i=`low'/`high' {
2. cluster kmeans v1-v`1', k(`i') name(km`i')
3. cluster stop km`i'
4. }

This works...but if I follow it with the same command again as in:

. do clusterk 4
. cap: drop km*
. local low = `1' - 2
. local high = `1' + 4
. forvalues i=`low'/`high' {
2. cluster kmeans v1-v`1', k(`i') name(km`i')
3. cluster stop km`i'
4. }
km2 already defined
r(198);

. display km2
km2 not found
r(111);

If I run it again, it works. However, if I manually drop km* (first
line below) and issue the command again, I get the following:

. drop km* <--- I typed this in
. do clusterk 4
. cap: drop km*
. local low = `1' - 2
. local high = `1' + 4
. forvalues i=`low'/`high' {
2. cluster kmeans v1-v`1', k(`i') name(km`i')
3. cluster stop km`i'
4. }
km2 already defined
r(198);

If I run do clusterk 4 now, it works.

Any suggestions?

TIA,
Joe


On Nov 18, 2006, at 8:56 PM, Kit Baum wrote:



Joseph writes

I am automating a bunch of commands in a do file, so I can rerun
the do file, just changing the argument.

If I have a:

drop km*

in my do file, the first time thru, it fails because it can't drop it.

No problem, since I can run as: do clusterk 4, nostop
and it goes fine.

However, if I rerun the next time thru as: do clusterk 6, nostop,
it fails with error number 198,
saying that variable km2 exists. You can see that the drop works
though, since it disappears
from the variables window.



help capture


Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


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

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


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

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

Date: Sun, 19 Nov 2006 17:28:27 +0100
From: "Svend Juul" <[email protected]>
Subject: Re: st: Join String Variables

Socrates wrote: OK, I know how to split string variables but have not found a way to join string variables. Did a search but could not source something out. Can you direct me to a command? Or if not is there a way round it. I just want to put two or more strings in one even if missing values exist. For example,

obs Var1 Var2 Var3 Var3
1 A B K ABK
2 C C
3 D ED BED

I have Var1 and Var2 and want to create Var3.
- ----------------------------------------

Assuming that you want to create var4 from var1, var2, and var3:

generate var4 = var1+var2+var3

You might also want to study:

help string functions

Hope this helps
Svend

________________________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 DK-8000 Aarhus C, Denmark Phone, work: +45 8942 6090 Phone, home: +45 8693 7796 Fax: +45 8613 1580 E-mail: [email protected] _________________________________________________________
*
* 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/

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

Date: Sun, 19 Nov 2006 16:50:10 -0000
From: "Nick Cox" <[email protected]>
Subject: RE: st: Join String Variables

In addition,
egen Var4 = concat(Var1 Var2 Var3)
In this example, -egen, concat()- gains you nothing, but it has some other features that make it more worthwhile.
Nick [email protected]
Svend Juul



Socrates wrote: OK, I know how to split string variables but have not found a way to join string variables. Did a search but could not source something out. Can you direct me to a command? Or if not is there a way round it. I just want to put two or more strings in one even if missing values exist. For example,

obs Var1 Var2 Var3 Var3
1 A B K ABK
2 C C
3 D ED BED

I have Var1 and Var2 and want to create Var3.
----------------------------------------

Assuming that you want to create var4 from var1, var2, and var3:

generate var4 = var1+var2+var3

You might also want to study:

help string functions

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

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

Date: Sun, 19 Nov 2006 17:23:57 -0000
From: "Nick Cox" <[email protected]>
Subject: RE: st: Data Manipulation Question

This is an FAQ.
replace Parent = Parent[_n-1] if missing(Parent)
would work in this example.
More generally, see How can I replace missing values with previous or following nonmissing values?
How can I replace missing values within sequences?
http://www.stata.com/support/faqs/data/missing.html

Bob Yaffee's approach based on pretending that this is a panel data set can thus be avoided. His further suggestion of
using -destring- wouldn't work, as -Parent- has no numeric interpretation, and is also unnecessary, as the logic of the device above applies to both numeric and string variables.
Nick [email protected]
Socrates Mokkas


I have a question related to data manipulation. My data sample is
like that:

Parent Subsidiary
A B
C
D
F
X J
L
Z T

What I want is to fill the gaps of the ParName.

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

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

Date: Sun, 19 Nov 2006 12:25:39 -0500
From: Robert A Yaffee <[email protected]>
Subject: Re: st: Join String Variables

Socrates,
Try egen Var3=concat(Var1 Var2 Var3)
Regards,
Robert

Robert A. Yaffee, Ph.D.
Research Professor
Shirley M. Ehrenkranz
School of Social Work
New York University

home address:
Apt 19-W
2100 Linwood Ave.
Fort Lee, NJ
07024-3171
Phone: 201-242-3824
Fax: 201-242-3825
[email protected]

- ----- Original Message -----
From: Socrates Mokkas <[email protected]>
Date: Sunday, November 19, 2006 10:39 am
Subject: st: Join String Variables



Hi People,

OK, I know how to split string variables but have not found a way to join string variables. Did a search but could not source something out. Can you direct me to a command? Or if not is there a way round it. I just want to put two or more strings in one even if missing values exist. For example,

obs Var1 Var2 Var3 Var3
1 A B K ABK
2 C C
3 D ED BED

I have Var1 and Var2 and want to create Var3.
Thanks a lot.

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


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

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

Date: Sun, 19 Nov 2006 17:54:41 -0000
From: "Nick Cox" <[email protected]>
Subject: RE: st: Join String Variables

Note that this won't work, as -egen- never -replace-s.
If you did want to overwrite -Var3-,
egen temp = concat(Var1 Var2 Var3) replace Var3 = temp
drop temp
Nick [email protected]
Robert A Yaffee



Try egen Var3=concat(Var1 Var2 Var3)

Socrates Mokkas



I just want to put two or more strings in one even if missing values exist. For example,

obs Var1 Var2 Var3 Var3
1 A B K ABK
2 C C
3 D ED BED

I have Var1 and Var2 and want to create Var3.
Thanks a lot.

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

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

Date: Sun, 19 Nov 2006 13:52:38 -0500
From: "John P. Bigelow" <[email protected]>
Subject: st: Re: st Variable dropped from regression: how to capture event?

- - --- Friedrich Huebler <[email protected]> wrote:


I am running a loop of regressions that should only be completed when all variables are included. In case a variable is dropped I want to skip the rest of the loop and continue with the next regression.
The regression still runs, but with an incomplete set of variables.
How can I check whether a variable was dropped?
As an alternative to some of the suggestions that have been offered already,
you could test the variable list without even running the regression by
using the - _rmcoll - command. or - _rmdcoll - command.

Say you want to regress Y on X1 X2 X3, but only if the X variables are
non-collinear.
Before running the regression set up with

local depvar = "X1 X2 X3"

then run

_rmcoll `depvar'

_rmcoll will return in r(varlist) a list of non-collinear variables found in
`depvar'

If `r(varlist)' and `depvar' are the same go ahead and run

reg Y `depvar'

otherwise skip it.

John Bigelow

- -- No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.431 / Virus Database: 268.14.7/538 - Release Date: 11/18/2006
4:48 PM


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

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

Date: Sun, 19 Nov 2006 22:46:33 +0100
From: "Alessandro Fiaschi" <[email protected]>
Subject: st: frequency distribution (graphic)

Dear all, I would like to do graphic descriptions of all the variables
of my panel (firm data, ten years), to show some appearance of
non-normality. In particular, I'm interested in making an histogram
with frequency distribution for each variable (x = values of variable,
y = fraction). Thanks in advance for any help.

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

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

Date: Sun, 19 Nov 2006 22:33:07 +0000 (GMT)
From: Maarten buis <[email protected]>
Subject: Re: st: frequency distribution (graphic)

- --- Alessandro Fiaschi <[email protected]> wrote:


I would like to do graphic descriptions of all the variables
of my panel (firm data, ten years), to show some appearance of
non-normality. In particular, I'm interested in making an histogram
with frequency distribution for each variable
Alex:
have a look at -help twoway histogram-, in particular look at the -by-
option (I am assuming you actually don't want to compare different
variables, but the distribution of the same variable for different
firms). If you really want to put histograms of different variables in
the same graph, look at -help graph combine-.

HTH,
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 Z434

+31 20 5986715

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

Send instant messages to your online friends http://uk.messenger.yahoo.com *
* 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/

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

End of statalist-digest V4 #2526
********************************

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



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