[18625] in s-news-athena

home help back first fref pref prev next nref lref last post

Re: [S] QQplot for two two unequal samples

daemon@ATHENA.MIT.EDU (ziv shkedy)
Wed Jul 14 02:49:53 1999

Date: Wed, 14 Jul 1999 08:44:39 +0200 (MET DST)
Message-Id: <199907140644.IAA05973@alpha.luc.ac.be>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: s-news@wubios.wustl.edu
From: ziv shkedy <ziv.shkedy@luc.ac.be>


Dear all,
I got the following answer from Christian about QQplot for unequal samples.



>Dear fellow S+ users,
>
>>> I'm using S+ 4.5 for windows and my question is about QQplot
>>> for two samples with unequal size.
>>> I'm using the S+ fuel.frame dataset and I want to plot the
>>> QQplot for the "Sporty" and the "Compact" car.
>>> I used the following code and QQplot that I got contains 9
>>> points. There are 9 observations in the "Sporty" group and
>>> 15 in the "Compact" group.
>>> Does anybody know how the qq() work in this case? Which
>>> observation were deleted for the "Compact" group" ?
>


>There are no observations being deleted. The computation
>of the quantiles uses interpolation.
>
>An explanation is given for example in the book
>"Visualizing Data" by W. S. Cleveland (p.21):
>
>> "Suppose there are just two sets of univariate measurements
>> to be compared. Let x(1),...,x(n) be the first data set,
>> ordered from smallest to largest. Let y(1),...,y(m) be the
>> second, also ordered. Suppose m <= n.
>> [case m = n omitted]
>> If m < n, then y(i) is the (i-0.5)/m quantile of the y data,
>> and we graph y(i) against the (i-0.5)/m quantile of the x
>> data, which typically must be computed by interpolation.
>> With this method there are always m points on the graph, the
>> number of values in the smaller of the two data sets.
>> ..."
>
>S-Plus uses other quantiles than the (i-0.5)/m quantiles if
>m is <= 10. (--> see help(ppoints))
>
>The quantiles are calculated with the function quantile()
>(--> see help(quantile) and for the formula of the linear
> interpolation in "Venables & Ripley", 2nd edit. on p.168).
>
>What the function qq() does is roughly:
>
>attach(fuel.frame)
>x <- Weight[Type == "Compact"]
>y <- Weight[Type == "Sporty"]
>m <- min(length(x), length(y))
>plot(quantile(x, ppoints(m)), quantile(y, ppoints(m)))
>  
>
>I hope that help.
>Greetings.
>
>-- Christian
>-- 
>---------------------------------------------------------
>Christian Keller		Tel:     +41 61 686 98 81
>AICOS Technologies AG		Fax:     +41 61 686 98 88
>Efringerstrasse 32	        E-mail: ckeller@aicos.com
>CH-4057 Basel, Switzerland      Web: http://www.aicos.com
>---------------------------------------------------------
>
>
=========================================================
Ziv Shkedy
Biostatistics                   
Center for Statistics           
Limburgs Universitair Centrum
Universitaire Campus, department WNI
B-3590 Diepenbeek, Belgium
Tel: +32-(0)11-26.82.57
e-mail: ziv.shkedy@luc.ac.be 
=========================================================

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

home help back first fref pref prev next nref lref last post