st: outreg2 and xtmixed?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

st: outreg2 and xtmixed?

Christian Weiss-2
Dear Statalist,

I just tried to use outreg2 in combination with xtmixed. However,
outreg2 just opens the databrowser showing all variables in my sample
and that's it.

Is there any way to use outreg2 in combination with xtmixed?

Best,
Chris
*
*   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/
Reply | Threaded
Open this post in threaded view
|

RE: st: outreg2 and xtmixed?

Roy Wada
> Is there any way to use outreg2 in combination with xtmixed?
>
> Chris

The following example works for me. It's more helpful if you can
post your do-file or what exactly you typed into Stata.

webuse nlswork, clear
generate age2 = age^2
generate tenure2 = tenure^2
xtmixed ln_w grade age* ttl_exp tenure* || id:
outreg2 using myfile, replace see
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/171222985/direct/01/
*
*   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/
Reply | Threaded
Open this post in threaded view
|

Re: st: outreg2 and xtmixed?

Christian Weiss-2
Hi Roy,

thx a lot, you were right, there was a mistake in my code.
I am wondering though if there is anyway to illustrate the random
intercepts in a different way. In your example the random intercept as
well as the residuals can be found in column 2 and column3, whereas
I'd prefer to have them in the same column as all other variables
(column 1)

best
Chris






On Fri, Sep 18, 2009 at 8:06 PM, Roy Wada <[hidden email]> wrote:

>> Is there any way to use outreg2 in combination with xtmixed?
>>
>> Chris
>
> The following example works for me. It's more helpful if you can
> post your do-file or what exactly you typed into Stata.
>
> webuse nlswork, clear
> generate age2 = age^2
> generate tenure2 = tenure^2
> xtmixed ln_w grade age* ttl_exp tenure* || id:
> outreg2 using myfile, replace see
> _________________________________________________________________
> Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
> http://clk.atdmt.com/GBL/go/171222985/direct/01/
> *
> *   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/
Reply | Threaded
Open this post in threaded view
|

RE: st: outreg2 and xtmixed?

Roy Wada
> I'd prefer to have them in the same column as all other variables
> (column 1)
>
 
Try using -long- option

xtmixed ln_w grade age* ttl_exp tenure* || id:
outreg2 using myfile, replace long excel
 
 
Incidently, there was a recent thread on having an output
similar to -table- but with more than 5 contents.
 
Some of this can be achieved by using -sum(detail)-, which is
an undocumented option. You can use -eqdrop( )- to get rid of
what you do not need.
 
outreg2 using myfile, replace sum(detail) eqdrop(min max)
 
Note that it is reporting raw summary stats without restricting
itself to e(sample) observations but you must have ran a regression
(any regression) prior to it.
 
This sounds all complicated but that's why it's undocumented.
 
Roy
 
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/171222985/direct/01/
*
*   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/
Reply | Threaded
Open this post in threaded view
|

RE: st: outreg2 and xtmixed?

Martin Weiss-5
In reply to this post by Christian Weiss-2

<>

Christian has not told us what the mistake was that he found, but when I run
Roy`s code in Stata 11, I get the data editor showing all variables as well.
It is only when I click on the -seeout- link that the correct file opens.
This behavior is invariant to the command used, but not to the -version-: In
Stata 10, everything works as expected.

Christian should try this RE model and see whether this changes anything for
him. If not, I think it is a more fundamental problem with the use of the
data editor in Stata 11.

**************
webuse nlswork, clear
generate age2 = age^2
generate tenure2 = tenure^2
xtreg ln_w grade age* ttl_exp tenure*, i(id)
outreg2 using myfile, replace see
**************


HTH
Martin


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Christian Weiß
Sent: Samstag, 19. September 2009 02:48
To: [hidden email]
Subject: Re: st: outreg2 and xtmixed?

Hi Roy,

thx a lot, you were right, there was a mistake in my code.
I am wondering though if there is anyway to illustrate the random
intercepts in a different way. In your example the random intercept as
well as the residuals can be found in column 2 and column3, whereas
I'd prefer to have them in the same column as all other variables
(column 1)

best
Chris






On Fri, Sep 18, 2009 at 8:06 PM, Roy Wada <[hidden email]> wrote:

>> Is there any way to use outreg2 in combination with xtmixed?
>>
>> Chris
>
> The following example works for me. It's more helpful if you can
> post your do-file or what exactly you typed into Stata.
>
> webuse nlswork, clear
> generate age2 = age^2
> generate tenure2 = tenure^2
> xtmixed ln_w grade age* ttl_exp tenure* || id:
> outreg2 using myfile, replace see
> _________________________________________________________________
> Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
> http://clk.atdmt.com/GBL/go/171222985/direct/01/
> *
> *   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/



*
*   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/
Reply | Threaded
Open this post in threaded view
|

st: How to generate a variable equalling an earliest date of action b y individual?

Ekaterina Hertog
Dear all,
I have a dataset of individuals each of whom approaches a number of others and after approaching each person is either accepted or rejected. I would like to do an event history analysis of how the duration of time it takes for an individual to secure an acceptance depends on his or hers individual characteristics.
The variables I am interested in have the following structure (missing dateacceppted means a rejection):

id dateapproached dateaccepted
1 20.04.2007 .
1 20.04.2007 .
1 18.05.2007 20.05.2007
1 18.05.2007 .
2 19.01.2006 .
2 20.03.2007 24.03.2007
2 20.03.2007 .
3 11.09.2007 18.09.2007
3 11.09.2007 15.09.2007
3 01.10.2007 .
3 07.11.2007 .
4 06.06.2007 .
4 08.07.2007 .

Out of this dataset I want to keep for each individual the date he or she made his first approach and the date he or she was first accepted.
To do so I tried to create a new variable date1accept which for each individual has the same value => the date he or she was first accepted. After that I dropped all the observations, but the 1st one for each individual.
To do so I used the following code:
sort id dateaccept
   foreach X of new date1accept {
   by id : gen `X' = dateaccept[1]
    }

sort id
by id: gen y=_n
keep if y==1

I then ran two tests and Stata confirmed that thes assertions below were true:
/*To check that all the values of date1accept are the same*/
bysort id (date1accept) : assert date1accept[1] == date1accept[_N]
/*To check that dat1accept = the lowest value of dateaccept*/
bysort id (dateaccept) : assert dat1accept[1] == dateaccept[1]

yet something seems to be wrong with my commands, each time I re-run the code it comes up with slightly different set of date1accept values. I cannot understand where can my code be wrong so my tests do not pick it up.
Could anyone suggest what might be wrong or offer an alternative solution for my problem?
I will be most grateful for any advice,
Warm regards,
Ekaterina

*
*   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/
Reply | Threaded
Open this post in threaded view
|

st: AW: How to generate a variable equalling an earliest date of action b y individual?

Martin Weiss-5

<>

Have you tried to -sort, stable-? Quite frequently, that is the source of
user confusion. Also note
http://www.stata-journal.com/sjpdf.html?articlenum=dm0019




HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [hidden email]
[mailto:[hidden email]] Im Auftrag von Ekaterina
Hertog
Gesendet: Samstag, 19. September 2009 18:23
An: [hidden email]
Betreff: st: How to generate a variable equalling an earliest date of action
b y individual?

Dear all,
I have a dataset of individuals each of whom approaches a number of others
and after approaching each person is either accepted or rejected. I would
like to do an event history analysis of how the duration of time it takes
for an individual to secure an acceptance depends on his or hers individual
characteristics.
The variables I am interested in have the following structure (missing
dateacceppted means a rejection):

id dateapproached dateaccepted
1 20.04.2007 .
1 20.04.2007 .
1 18.05.2007 20.05.2007
1 18.05.2007 .
2 19.01.2006 .
2 20.03.2007 24.03.2007
2 20.03.2007 .
3 11.09.2007 18.09.2007
3 11.09.2007 15.09.2007
3 01.10.2007 .
3 07.11.2007 .
4 06.06.2007 .
4 08.07.2007 .

Out of this dataset I want to keep for each individual the date he or she
made his first approach and the date he or she was first accepted.
To do so I tried to create a new variable date1accept which for each
individual has the same value => the date he or she was first accepted.
After that I dropped all the observations, but the 1st one for each
individual.
To do so I used the following code:
sort id dateaccept
   foreach X of new date1accept {
   by id : gen `X' = dateaccept[1]
    }

sort id
by id: gen y=_n
keep if y==1

I then ran two tests and Stata confirmed that thes assertions below were
true:
/*To check that all the values of date1accept are the same*/
bysort id (date1accept) : assert date1accept[1] == date1accept[_N]
/*To check that dat1accept = the lowest value of dateaccept*/
bysort id (dateaccept) : assert dat1accept[1] == dateaccept[1]

yet something seems to be wrong with my commands, each time I re-run the
code it comes up with slightly different set of date1accept values. I cannot
understand where can my code be wrong so my tests do not pick it up.
Could anyone suggest what might be wrong or offer an alternative solution
for my problem?
I will be most grateful for any advice,
Warm regards,
Ekaterina

*
*   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/
Reply | Threaded
Open this post in threaded view
|

st: AW: How to generate a variable equalling an earliest date of action b y individual?

Martin Weiss-5
In reply to this post by Ekaterina Hertog

<>

Also note http://www.stata.com/support/faqs/lang/sort.html




HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [hidden email]
[mailto:[hidden email]] Im Auftrag von Ekaterina
Hertog
Gesendet: Samstag, 19. September 2009 18:23
An: [hidden email]
Betreff: st: How to generate a variable equalling an earliest date of action
b y individual?

Dear all,
I have a dataset of individuals each of whom approaches a number of others
and after approaching each person is either accepted or rejected. I would
like to do an event history analysis of how the duration of time it takes
for an individual to secure an acceptance depends on his or hers individual
characteristics.
The variables I am interested in have the following structure (missing
dateacceppted means a rejection):

id dateapproached dateaccepted
1 20.04.2007 .
1 20.04.2007 .
1 18.05.2007 20.05.2007
1 18.05.2007 .
2 19.01.2006 .
2 20.03.2007 24.03.2007
2 20.03.2007 .
3 11.09.2007 18.09.2007
3 11.09.2007 15.09.2007
3 01.10.2007 .
3 07.11.2007 .
4 06.06.2007 .
4 08.07.2007 .

Out of this dataset I want to keep for each individual the date he or she
made his first approach and the date he or she was first accepted.
To do so I tried to create a new variable date1accept which for each
individual has the same value => the date he or she was first accepted.
After that I dropped all the observations, but the 1st one for each
individual.
To do so I used the following code:
sort id dateaccept
   foreach X of new date1accept {
   by id : gen `X' = dateaccept[1]
    }

sort id
by id: gen y=_n
keep if y==1

I then ran two tests and Stata confirmed that thes assertions below were
true:
/*To check that all the values of date1accept are the same*/
bysort id (date1accept) : assert date1accept[1] == date1accept[_N]
/*To check that dat1accept = the lowest value of dateaccept*/
bysort id (dateaccept) : assert dat1accept[1] == dateaccept[1]

yet something seems to be wrong with my commands, each time I re-run the
code it comes up with slightly different set of date1accept values. I cannot
understand where can my code be wrong so my tests do not pick it up.
Could anyone suggest what might be wrong or offer an alternative solution
for my problem?
I will be most grateful for any advice,
Warm regards,
Ekaterina

*
*   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/
Reply | Threaded
Open this post in threaded view
|

st: AW: How to generate a variable equalling an earliest date of action b y individual?

Martin Weiss-5
In reply to this post by Ekaterina Hertog

<>

" Out of this dataset I want to keep for each individual the date he or she
made his first approach and the date he or she was first accepted."


Ekaterina might also want to try -collapse- for this problem setup:


*************
clear*

inp byte id /*
*/ str20(dateapproached dateaccepted )
1 "20.04.2007" "        "
1 "20.04.2007" "        "
1 "18.05.2007" "20.05.2007"
1 "18.05.2007" "        "
2 "19.01.2006" "        "
2 "20.03.2007" "24.03.2007"
2 "20.03.2007" " .        "
3 "11.09.2007" "18.09.2007"
3 "11.09.2007" "15.09.2007"
3 "01.10.2007" "        "
3 "07.11.2007" "        "
4 "06.06.2007" "        "
4 "08.07.2007" "        "
end

replace dateaccepted= /*
*/ trim(dateaccepted)

gen dateapproached2= /*
*/ date(dateapproached, "DMY")
format dateapproached2 /*
*/ %tdMonth_DD,_CCYY

gen dateaccepted2= /*
*/ date(dateaccepted, "DMY")
format dateaccepted2 /*
*/ %tdMonth_DD,_CCYY

drop dateapproached  /*
*/ dateaccepted

compress
list, noobs sepby(id)

collapse (first) dateapproached2  /*
*/ (firstnm) dateaccepted2,  /*
*/ by(id)

list, noobs
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [hidden email]
[mailto:[hidden email]] Im Auftrag von Ekaterina
Hertog
Gesendet: Samstag, 19. September 2009 18:23
An: [hidden email]
Betreff: st: How to generate a variable equalling an earliest date of action
b y individual?

Dear all,
I have a dataset of individuals each of whom approaches a number of others
and after approaching each person is either accepted or rejected. I would
like to do an event history analysis of how the duration of time it takes
for an individual to secure an acceptance depends on his or hers individual
characteristics.
The variables I am interested in have the following structure (missing
dateacceppted means a rejection):

id dateapproached dateaccepted
1 20.04.2007 .
1 20.04.2007 .
1 18.05.2007 20.05.2007
1 18.05.2007 .
2 19.01.2006 .
2 20.03.2007 24.03.2007
2 20.03.2007 .
3 11.09.2007 18.09.2007
3 11.09.2007 15.09.2007
3 01.10.2007 .
3 07.11.2007 .
4 06.06.2007 .
4 08.07.2007 .

Out of this dataset I want to keep for each individual the date he or she
made his first approach and the date he or she was first accepted.
To do so I tried to create a new variable date1accept which for each
individual has the same value => the date he or she was first accepted.
After that I dropped all the observations, but the 1st one for each
individual.
To do so I used the following code:
sort id dateaccept
   foreach X of new date1accept {
   by id : gen `X' = dateaccept[1]
    }

sort id
by id: gen y=_n
keep if y==1

I then ran two tests and Stata confirmed that thes assertions below were
true:
/*To check that all the values of date1accept are the same*/
bysort id (date1accept) : assert date1accept[1] == date1accept[_N]
/*To check that dat1accept = the lowest value of dateaccept*/
bysort id (dateaccept) : assert dat1accept[1] == dateaccept[1]

yet something seems to be wrong with my commands, each time I re-run the
code it comes up with slightly different set of date1accept values. I cannot
understand where can my code be wrong so my tests do not pick it up.
Could anyone suggest what might be wrong or offer an alternative solution
for my problem?
I will be most grateful for any advice,
Warm regards,
Ekaterina

*
*   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/
Reply | Threaded
Open this post in threaded view
|

Re: st: AW: How to generate a variable equalling an earliest date of action b y individual?

Ekaterina Hertog
Dear Martin,
Thank you very much for the advice! This last solution definitely produces stable results so solves the problem of outcome variation. I am still designing a way to ensure the code deals correctly with my numerous instances of tied data but so far it seems to work.
Thanks a lot again!
warm regards,
Ekaterina


In message <000b01ca3947$39d063a0$ad712ae0$@[hidden email]> [hidden email] writes:

>
> <>
>
> " Out of this dataset I want to keep for each individual the date he or she
> made his first approach and the date he or she was first accepted."
>
>
> Ekaterina might also want to try -collapse- for this problem setup:
>
>
> *************
> clear*
>
> inp byte id /*
> */ str20(dateapproached dateaccepted )
> 1 "20.04.2007" "        "
> 1 "20.04.2007" "        "
> 1 "18.05.2007" "20.05.2007"
> 1 "18.05.2007" "        "
> 2 "19.01.2006" "        "
> 2 "20.03.2007" "24.03.2007"
> 2 "20.03.2007" " .        "
> 3 "11.09.2007" "18.09.2007"
> 3 "11.09.2007" "15.09.2007"
> 3 "01.10.2007" "        "
> 3 "07.11.2007" "        "
> 4 "06.06.2007" "        "
> 4 "08.07.2007" "        "
> end
>
> replace dateaccepted= /*
> */ trim(dateaccepted)
>
> gen dateapproached2= /*
> */ date(dateapproached, "DMY")
> format dateapproached2 /*
> */ %tdMonth_DD,_CCYY
>
> gen dateaccepted2= /*
> */ date(dateaccepted, "DMY")
> format dateaccepted2 /*
> */ %tdMonth_DD,_CCYY
>
> drop dateapproached  /*
> */ dateaccepted
>
> compress
> list, noobs sepby(id)
>
> collapse (first) dateapproached2  /*
> */ (firstnm) dateaccepted2,  /*
> */ by(id)
>
> list, noobs
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [hidden email]
> [mailto:[hidden email]] Im Auftrag von Ekaterina
> Hertog
> Gesendet: Samstag, 19. September 2009 18:23
> An: [hidden email]
> Betreff: st: How to generate a variable equalling an earliest date of action
> b y individual?
>
> Dear all,
> I have a dataset of individuals each of whom approaches a number of others
> and after approaching each person is either accepted or rejected. I would
> like to do an event history analysis of how the duration of time it takes
> for an individual to secure an acceptance depends on his or hers individual
> characteristics.
> The variables I am interested in have the following structure (missing
> dateacceppted means a rejection):
>
> id dateapproached dateaccepted
> 1 20.04.2007 .
> 1 20.04.2007 .
> 1 18.05.2007 20.05.2007
> 1 18.05.2007 .
> 2 19.01.2006 .
> 2 20.03.2007 24.03.2007
> 2 20.03.2007 .
> 3 11.09.2007 18.09.2007
> 3 11.09.2007 15.09.2007
> 3 01.10.2007 .
> 3 07.11.2007 .
> 4 06.06.2007 .
> 4 08.07.2007 .
>
> Out of this dataset I want to keep for each individual the date he or she
> made his first approach and the date he or she was first accepted.
> To do so I tried to create a new variable date1accept which for each
> individual has the same value => the date he or she was first accepted.
> After that I dropped all the observations, but the 1st one for each
> individual.
> To do so I used the following code:
> sort id dateaccept
>    foreach X of new date1accept {
>    by id : gen `X' = dateaccept[1]
>     }
>
> sort id
> by id: gen y=_n
> keep if y==1
>
> I then ran two tests and Stata confirmed that thes assertions below were
> true:
> /*To check that all the values of date1accept are the same*/
> bysort id (date1accept) : assert date1accept[1] == date1accept[_N]
> /*To check that dat1accept = the lowest value of dateaccept*/
> bysort id (dateaccept) : assert dat1accept[1] == dateaccept[1]
>
> yet something seems to be wrong with my commands, each time I re-run the
> code it comes up with slightly different set of date1accept values. I cannot
> understand where can my code be wrong so my tests do not pick it up.
> Could anyone suggest what might be wrong or offer an alternative solution
> for my problem?
> I will be most grateful for any advice,
> Warm regards,
> Ekaterina
>
> *
> *   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/

--
Ekaterina Hertog (nee Korobtseva)
Nissan Institute of Japanese Studies
27 Winchester Road, Oxford
OX2 6NA


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