[R] Asymmetrical Confidence Interval

David Winsemius dwinsemius at comcast.net
Mon Jun 20 15:02:06 CEST 2011


Learn to search the Archives (or at least one of the forms of the  
Archives)

http://search.r-project.org/cgi-bin/namazu.cgi?query=confidence+interval+logit+proportion&max=100&result=normal&sort=score&idxname=functions&idxname=Rhelp08&idxname=Rhelp10&idxname=Rhelp02

(That is constructed with an URL I use for the purpose that brings up  
the RSiteSearch page with different parameters than are currently in  
the default implementation. This is an R function that does the same:

 > rhelpSearch
function(string,
                   restrict = c("Rhelp10", "Rhelp08", "Rhelp02",  
"functions" ),
                   matchesPerPage = 100, ...)
          RSiteSearch(string=string,  restrict = restrict,   
matchesPerPage = matchesPerPage, ...)

-- 
David
On Jun 20, 2011, at 8:50 AM, Muhuri, Pradip (SAMHSA/CBHSQ) wrote:

> Dear Patrick,
>
>
> I do agree with you that it is a very simple problem.  Actually, I  
> do have the following SAS program written to compute the  
> asymmetrical confidence interval.
>
> As a new user of R, I just wanted to see the corresponding codes in  
> R if they already exist.
>
> Thanks,
>
> Pradip
>
>
>
> *SAS program begins here;
>
> /********************************************************
> MEAN = prevalence rate
> PLOWER = lower 95% confidence limit for the rate
> PPER = upper 95% confidence limit for the rate
> TLOWER = lower 95% confidence limit for the total
> TUPPER = upper 95% confidence limit for the total
>
> Calculate the 95% CI FOR PREVALENCE RATES AND TOTALS
> ********************************************************/
>
> IF MEAN=0 OR MEAN=1 THEN DO;
>      L=.;
>      NUMBER=.;
>      A=.;  B=.;
>      PLOWER=.; PUPPER=.; TLOWER=.; TUPPER=.;
> END;
>
>
> ELSE DO;
>
>      L=LOG(MEAN/(1-MEAN));
>      NUMBER=SEMEAN/(MEAN*(1-MEAN));
>      A=L-1.96*NUMBER;
>      B=L+1.96*NUMBER;
>      PLOWER=1/(1+EXP(-A));  PUPPER=1/(1+EXP(-B));
>      TLOWER=WSUM*PLOWER;    TUPPER=WSUM*PUPPER;
>
> END;
>
> RUN;
>
> *SAS program ends here:
>
>
> Pradip K. Muhuri, PhD
> Statistician
> Substance Abuse & Mental Health Services Administration
> The Center for Behavioral Health Statistics and Quality
> Division of Population Surveys
> 1 Choke Cherry Road, Room 7-1023
> Rockville, MD 20857
>
> Tel: 240-276-1070
> Fax: 240-276-1260
> e-mail: Pradip.Muhuri at samhsa.hhs.gov
>
>
> The Center for Behavioral Health Statistics and Quality your  
> feedback.  Please click on the following link to complete a brief  
> customer survey:   http://cbhsqsurvey.samhsa.gov
>
> -----Original Message-----
> From: Patrick Connolly [mailto:p_connolly at slingshot.co.nz]
> Sent: Sunday, June 19, 2011 1:57 AM
> To: Muhuri, Pradip (SAMHSA/CBHSQ)
> Cc: r-help at r-project.org; 'tlumley at u.washington.edu'
> Subject: Re: [R] Asymetrical Confidence Interval
>
> On Thu, 16-Jun-2011 at 04:43PM -0400, Muhuri, Pradip (SAMHSA/CBHSQ)  
> wrote:
>
> |>
> |> Dear List,
> |>
>
> |> I wanted to calculate the asymmetrical confidence interval based on
> |> the sample statistic and standard error that available from the
> |> published report (complex survey-based).
>
> |> The calculation details can be seen from pages 17-18 of the
> |> document at the following link:
> |> http://www.oas.samhsa.gov/nsduh/2k5MRB/2k5statInference.pdf.
>
> |>
> |> Could someone tell me whether R has any function included in it
> |> "survey" or other contributed package of R.
>
> There might be one in a package somewhere, but it's so trivial to make
> your own function by using the information you already have.
>
> This is sounding suspiciously like a homework question.
>
>
> -- 
> ~ 
> .~ 
> .~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>   ___    Patrick Connolly
> {~._.~}                   Great minds discuss ideas
> _( Y )_  	         Average minds discuss events
> (:_~*~_:)                  Small minds discuss people
> (_)-(_)  	                      ..... Eleanor Roosevelt
> 	
> ~ 
> .~ 
> .~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list