st: new package -byhist- on SSC

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

st: new package -byhist- on SSC

Austin Nichols
Thanks to Kit Baum, a new package -byhist- is available from SSC by typing
 ssc install byhist
-byhist- makes "interlaced" histograms, with frequencies (optionally
fraction/density) of one variable optionally shown by categories of
another variable.  Weights are allowed.

Comments and bug reports welcomed.
*
*   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: is there a -regress- command equivalent to the pair matched ttest?

José Maria Pacheco de Souza
Dear Statalisters:
I am not sure whether it makes sense or not, but is there a sort
of -regress- command that allows to conduct a pair-matched -ttest-, but with
other independent variables?
I tried using -xtmixed-, but the result is not the same.
A contrived data set could be:
matching_identification  outcome ocasion variable_not_matched
                        1            1                1                0
                        1            2                2                0
                        2            3                1                0
                        2            5                2                1
                        3            2                1                0
                        3            4                2                1
                        4            6                1                1
                        4            5                2                1
To perform the pair-matched ttest  it is necessary to -reshape- and to
use -ttest outcome1==outcome2-, losing the independent variable_not_matched.
Thank for any orientation.
Regards,
José Maria

Jose Maria Pacheco de Souza, Professor Titular (aposentado)
Departamento de Epidemiologia/Faculdade de Saude Publica, USP
Av. Dr. Arnaldo, 715
01246-904  -  S. Paulo/SP - Brasil
fones (11)3061-7747; (11)3768-8612
fax (11)3714-2403
www.fsp.usp.br/~jmpsouza

*
*   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: is there a -regress- command equivalent to the pair matched ttest?

Richard Goldstein
While your question is not completely clear, try this; after reshaping
to wide form, form a new variable that is the difference between the
matched pairs on your variable of interest; if you then regress with
only the constant on the right you will have exactly the paired t-test
results (try it); you can then add other predictors to the regress command.

Rich

josemaria wrote:

> Dear Statalisters:
> I am not sure whether it makes sense or not, but is there a sort of
> -regress- command that allows to conduct a pair-matched -ttest-, but
> with other independent variables?
> I tried using -xtmixed-, but the result is not the same.
> A contrived data set could be:
> matching_identification  outcome ocasion variable_not_matched
>                        1            1                1                0
>                        1            2                2                0
>                        2            3                1                0
>                        2            5                2                1
>                        3            2                1                0
>                        3            4                2                1
>                        4            6                1                1
>                        4            5                2                1
> To perform the pair-matched ttest  it is necessary to -reshape- and to
> use -ttest outcome1==outcome2-, losing the independent
> variable_not_matched.
> Thank for any orientation.
> Regards,
> José Maria
>
> Jose Maria Pacheco de Souza, Professor Titular (aposentado)
> Departamento de Epidemiologia/Faculdade de Saude Publica, USP
> Av. Dr. Arnaldo, 715
> 01246-904  -  S. Paulo/SP - Brasil
> fones (11)3061-7747; (11)3768-8612
> fax (11)3714-2403
> www.fsp.usp.br/~jmpsouza
*
*   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: is there a -regress- command equivalent to the pair matched ttest?

Airey, David C
In reply to this post by José Maria Pacheco de Souza
A paired ttest is equivalent to a repeated measures ANOVA with two  
levels to the repeated factor. You can see the regression equivalent  
below.

webuse fuel, clear
list, clean
ttest mpg1 == mpg2
local t = r(t)
generate subject = _n
list, clean
reshape long mpg, i(subject) j(repeat)
list, clean
anova mpg repeat subject
anova, regress
test repeat
local F = r(F)
display `F' "=" `t'^2
xi: regress mpg i.repeat i.subject



On Dec 8, 2008, at 7:05 PM, josemaria wrote:

> Dear Statalisters:
> I am not sure whether it makes sense or not, but is there a sort of -
> regress- command that allows to conduct a pair-matched -ttest-, but  
> with other independent variables?
> I tried using -xtmixed-, but the result is not the same.
> A contrived data set could be:
> matching_identification  outcome ocasion variable_not_matched
>                       1            1                1                0
>                       1            2                2                0
>                       2            3                1                0
>                       2            5                2                1
>                       3            2                1                0
>                       3            4                2                1
>                       4            6                1                1
>                       4            5                2                1
> To perform the pair-matched ttest  it is necessary to -reshape- and  
> to use -ttest outcome1==outcome2-, losing the independent  
> variable_not_matched.
> Thank for any orientation.
> Regards,
> José Maria
>
> Jose Maria Pacheco de Souza, Professor Titular (aposentado)
> Departamento de Epidemiologia/Faculdade de Saude Publica, USP
> Av. Dr. Arnaldo, 715
> 01246-904  -  S. Paulo/SP - Brasil
> fones (11)3061-7747; (11)3768-8612
> fax (11)3714-2403
> www.fsp.usp.br/~jmpsouza
> *
> *   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: is there a -regress- command equivalent to the pair matched ttest?

Sam Norton
Jose Maria

You can, if you really want to, use -xtmixed-.  Phil Enders
presentation at the West Coast Stata Users Group meeting in 2007 gives
an example of how to use -xtmixed- to estimate a RM-ANOVA.  Since
ANOVA is based on deviations from the grand mean -xi3- (available from
SSC) is needed to create effect coded variables.
http://www.stata.com/meeting/wcsug07/repeated_anova.pdf


--
Sam Norton
[hidden email]
Research Student
Centre for Lifespan & Chronic Illness Research
University of Hertfordshire

2008/12/9 David Airey <[hidden email]>

>
> A paired ttest is equivalent to a repeated measures ANOVA with two levels to the repeated factor. You can see the regression equivalent below.
>
> webuse fuel, clear
> list, clean
> ttest mpg1 == mpg2
> local t = r(t)
> generate subject = _n
> list, clean
> reshape long mpg, i(subject) j(repeat)
> list, clean
> anova mpg repeat subject
> anova, regress
> test repeat
> local F = r(F)
> display `F' "=" `t'^2
> xi: regress mpg i.repeat i.subject
>
>
>
> On Dec 8, 2008, at 7:05 PM, josemaria wrote:
>
>> Dear Statalisters:
>> I am not sure whether it makes sense or not, but is there a sort of -regress- command that allows to conduct a pair-matched -ttest-, but with other independent variables?
>> I tried using -xtmixed-, but the result is not the same.
>> A contrived data set could be:
>> matching_identification  outcome ocasion variable_not_matched
>>                      1            1                1                0
>>                      1            2                2                0
>>                      2            3                1                0
>>                      2            5                2                1
>>                      3            2                1                0
>>                      3            4                2                1
>>                      4            6                1                1
>>                      4            5                2                1
>> To perform the pair-matched ttest  it is necessary to -reshape- and to use -ttest outcome1==outcome2-, losing the independent variable_not_matched.
>> Thank for any orientation.
>> Regards,
>> José Maria
>>
>> Jose Maria Pacheco de Souza, Professor Titular (aposentado)
>> Departamento de Epidemiologia/Faculdade de Saude Publica, USP
>> Av. Dr. Arnaldo, 715
>> 01246-904  -  S. Paulo/SP - Brasil
>> fones (11)3061-7747; (11)3768-8612
>> fax (11)3714-2403
>> www.fsp.usp.br/~jmpsouza
>> *
>> *   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
|

Re: st: is there a -regress- command equivalent to the pair matched ttest?

Airey, David C
For the use of xtmixed for classical experimental designs, see this  
page:

http://www.ats.ucla.edu/stat/stata/faq/xtmixed.htm

-Dave

On Dec 9, 2008, at 9:12 AM, Sam Norton wrote:

> Jose Maria
>
> You can, if you really want to, use -xtmixed-.  Phil Enders
> presentation at the West Coast Stata Users Group meeting in 2007 gives
> an example of how to use -xtmixed- to estimate a RM-ANOVA.  Since
> ANOVA is based on deviations from the grand mean -xi3- (available from
> SSC) is needed to create effect coded variables.
> http://www.stata.com/meeting/wcsug07/repeated_anova.pdf
>
>
> --
> Sam Norton
> [hidden email]
> Research Student
> Centre for Lifespan & Chronic Illness Research
> University of Hertfordshire
>
> 2008/12/9 David Airey <[hidden email]>
>>
>> A paired ttest is equivalent to a repeated measures ANOVA with two  
>> levels to the repeated factor. You can see the regression  
>> equivalent below.
>>
>> webuse fuel, clear
>> list, clean
>> ttest mpg1 == mpg2
>> local t = r(t)
>> generate subject = _n
>> list, clean
>> reshape long mpg, i(subject) j(repeat)
>> list, clean
>> anova mpg repeat subject
>> anova, regress
>> test repeat
>> local F = r(F)
>> display `F' "=" `t'^2
>> xi: regress mpg i.repeat i.subject
>>
>>
>>
>> On Dec 8, 2008, at 7:05 PM, josemaria wrote:
>>
>>> Dear Statalisters:
>>> I am not sure whether it makes sense or not, but is there a sort  
>>> of -regress- command that allows to conduct a pair-matched -
>>> ttest-, but with other independent variables?
>>> I tried using -xtmixed-, but the result is not the same.
>>> A contrived data set could be:
>>> matching_identification  outcome ocasion variable_not_matched
>>>                     1            1                1                0
>>>                     1            2                2                0
>>>                     2            3                1                0
>>>                     2            5                2                1
>>>                     3            2                1                0
>>>                     3            4                2                1
>>>                     4            6                1                1
>>>                     4            5                2                1
>>> To perform the pair-matched ttest  it is necessary to -reshape-  
>>> and to use -ttest outcome1==outcome2-, losing the independent  
>>> variable_not_matched.
>>> Thank for any orientation.
>>> Regards,
>>> José Maria
>>>
>>> Jose Maria Pacheco de Souza, Professor Titular (aposentado)
>>> Departamento de Epidemiologia/Faculdade de Saude Publica, USP
>>> Av. Dr. Arnaldo, 715
>>> 01246-904  -  S. Paulo/SP - Brasil
>>> fones (11)3061-7747; (11)3768-8612
>>> fax (11)3714-2403
>>> www.fsp.usp.br/~jmpsouza
>>> *
>>> *   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/


*
*   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: is there a -regress- command equivalent to the pair matched ttest?

José Maria Pacheco de Souza
In reply to this post by Airey, David C
Dears Dave, Sam and Rich:

thank you very very much.
Thanks also for the orientation to go for
http://www.ats.ucla.edu/stat/stata/faq/xtmixed.htm.

For the basics, may I understand that the trick is to use both the
repetition_ocasions and the subject_identification as categorical variables?
Greetings,
José Maria

Jose Maria Pacheco de Souza, Professor Titular (aposentado)
Departamento de Epidemiologia/Faculdade de Saude Publica, USP
Av. Dr. Arnaldo, 715
01246-904  -  S. Paulo/SP - Brasil
fones (11)3061-7747; (11)3768-8612
fax (11)3714-2403
www.fsp.usp.br/~jmpsouza
----- Original Message -----
From: "David Airey" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, December 09, 2008 12:50 AM
Subject: Re: st: is there a -regress- command equivalent to the pair matched
ttest?


>A paired ttest is equivalent to a repeated measures ANOVA with two  levels
>to the repeated factor. You can see the regression equivalent  below.
>
> webuse fuel, clear
>.....
> xi: regress mpg i.repeat i.subject
>

> On Dec 8, 2008, at 7:05 PM, josemaria wrote:
>
is there a sort of -
>> regress- command that allows to conduct a pair-matched -ttest-, but

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