Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
回复: st: plotting median and its confidence interval
From
XU XIAO <[email protected]>
To
[email protected]
Subject
回复: st: plotting median and its confidence interval
Date
Tue, 21 Jan 2014 23:16:51 +0200
Well, I update my Stata12, and it�working now.
Thanks very very much!
Best,
Xu
在 2014年1月21日 星期二,下午10:45,XU XIAO 写道:
> Thanks Roger!
> Before your latest reply to Alfonso, I met the same problem as his. I searched a little bit and installed the packages.
>
> However, this problem showed up:
>
> . rcentile weight, tdist
> tidotforsomersd(): 3499 tidottree() not found
> <istmt>: - function returned error
> r(3499);
>
>
>
> . mata: mata query
> -------------------------------------------------------------------------------------
> Mata settings
> set matastrict off
> set matalnum off
> set mataoptimize on
> set matafavor space may be space or speed
> set matacache 400 kilobytes
> set matalibs lmatabase;lmataado;lmataopt;lmatasem;livreg2;lsomersd
> set matamofirst off
>
> I searched the statalist and reinstalled packages, relaunched state and reboot my mac, but still it did not work…..
>
> My stata version is Stata/SE 12.0 for Mac (64-bit Intel), Revision 24 Aug 2011
>
> As I said, before you sent the latest reply, I did some search on my own. I think I made a mistake and installed snp16 and force stata to cover some ado files. I don’t know if it gave rise to the problem. I uninstalled the snp16 package and reinstalled the necessary packages for rcentile. Still, I have the same problem….
>
> I am looking forward to your reply.
> Respectfully yours,
>
> Xu
>
>
> 在 2014年1月21日 星期二,下午8:49,Roger B. Newson 写道:
>
> > Hi Alfonso
> >
> > For -rcentile- to work, you also need to download the packages
> > -somersd-, -expgen- and -scsomersd-, which are also on SSC. The
> > -sccendif- command is part of the -scsomersd- package.
> >
> > I hope this helps. Let me know if you have any further queries.
> >
> > Best wishes
> >
> > Roger
> >
> > Roger B Newson BSc MSc DPhil
> > Lecturer in Medical Statistics
> > Respiratory Epidemiology, Occupational Medicine
> > and Public Health Group
> > National Heart and Lung Institute
> > Imperial College London
> > Royal Brompton Campus
> > Room 33, Emmanuel Kaye Building
> > 1B Manresa Road
> > London SW3 6LR
> > UNITED KINGDOM
> > Tel: +44 (0)20 7352 8121 ext 3381
> > Fax: +44 (0)20 7351 8322
> > Email: [email protected] (mailto:[email protected])
> > Web page: http://www.imperial.ac.uk/nhli/r.newson/
> > Departmental Web page:
> > http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/
> >
> > Opinions expressed are those of the author, not of the institution.
> >
> > On 21/01/2014 15:13, Alfonso Sánchez-Peñalver wrote:
> > > Hi Roger,
> > >
> > > I just followed your suggestion, and when using -rcentile- in the way you described on the auto data, I get the following message:
> > >
> > > unrecognized command: sccendif
> > >
> > > I am using Stata 13.1 January 15 2014 revision for Mac.
> > >
> > > Best,
> > >
> > > Alfonso
> > >
> > > On Jan 21, 2014, at 8:10 AM, Roger B. Newson <[email protected] (mailto:[email protected])> wrote:
> > >
> > > > A possible alternative might be to use -rcentile- followed by -xsvmat-, instead of -bpmedian- followed by -parmest-. The -rcentile- and -xsvmat- packages can be downloaded from SSC. -rcentile- has the advantage that the confidence intervals are asymmetric, unlike the ones from -bpmedian- and -parmest-, which are symmetric. I would expect the asymmetric confidence intervals from -rcentile- to have a coverage probability closer to the advertized level than the symmetric confidence intervals produced by -bpmedian-. And the -rcentile- package can have -cluster()- options and weights, which are not implemented for -bpmedian-.
> > > >
> > > > An example in the -auto- data might be:
> > > >
> > > > rcentile weight, tdist
> > > > xsvmat, from(r(cimat)) name(col) norestore
> > > >
> > > > which will create a dataset with 1 observation and variables Percent, Centile, Minimum and Maximum, containing a percent (defaulting to 50), a median, and its lower and upper confidence limits. You can append several datasets like this and then use -eclplot- (also downloadable from SSC) to plot the confidence intervals against any variable you like.
> > > >
> > > > I hope this helps.
> > > >
> > > > Best wishes
> > > >
> > > > Roger
> > > >
> > > > Roger B Newson BSc MSc DPhil
> > > > Lecturer in Medical Statistics
> > > > Respiratory Epidemiology, Occupational Medicine
> > > > and Public Health Group
> > > > National Heart and Lung Institute
> > > > Imperial College London
> > > > Royal Brompton Campus
> > > > Room 33, Emmanuel Kaye Building
> > > > 1B Manresa Road
> > > > London SW3 6LR
> > > > UNITED KINGDOM
> > > > Tel: +44 (0)20 7352 8121 ext 3381
> > > > Fax: +44 (0)20 7351 8322
> > > > Email: [email protected] (mailto:[email protected])
> > > > Web page: http://www.imperial.ac.uk/nhli/r.newson/
> > > > Departmental Web page:
> > > > http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/
> > > >
> > > > Opinions expressed are those of the author, not of the institution.
> > > >
> > > > On 21/01/2014 12:33, XU XIAO wrote:
> > > > > Hi,
> > > > >
> > > > > I am treating the data which have 3 time points, say 1965, 1985, 1995. Also, I have a bunch of vars on each time point.
> > > > >
> > > > >
> > > > > var1 | var2 | var3———var8 | characteristic_vars | year
> > > > > 1
> > > > > 2
> > > > > 3
> > > > > 4
> > > > > .
> > > > > .
> > > > > .
> > > > >
> > > > > Now, since there is some skewness in the data, I want to plot the medians and their confidence intervals for different groups(based on the characteristic) in each year, and connect the median with a line. Basically, I want to see how the medians of these vars of different groups changed as time went by (going through the 3 time points).
> > > > >
> > > > > What I have tried was:
> > > > > 1. use .bpmedian to find median and ci for one var of one group
> > > > > 2. use .parmest to save it into a dataset
> > > > > 3. do it for each year
> > > > > 4. append the 3 datasets i got from the previous steps
> > > > > 5. use serrbar to plot it
> > > > > After 5 steps, I got the plot for 1 var of 1 group, but I have 30 groups.
> > > > >
> > > > > Is there any easier way to do it? I mean, is there something like ciplot but plotting median and ci of the median instead? Also, how can I show several vars in one plot like what we can do in ciplot?
> > > > >
> > > > > I am looking forward to your reply,
> > > > > Respectfully yours,
> > > > >
> > > > > Xu
> > > > >
> > > > > *
> > > > > * For searches and help try:
> > > > > * http://www.stata.com/help.cgi?search
> > > > > * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/