[R] (newbie) Weighted qqplot?
Vivek Satsangi
vivek.satsangi at gmail.com
Wed Mar 15 14:31:11 CET 2006
Folks,
Normally, in a data frame, one observation counts as one observation
of the distribution. Thus one can easily produce a CDF and (in Splus
atleast) use cdf.compare to compare the CDF (BTW: what is the R
equivalent of the SPlus cdf.compare() function, if any?)
However, if each point should not count equally, how can I weight the
points before comparing the distributions? I was thinking of somehow
creating multiple observations for each actual observation based on
weights and creating a new dataframe etc. -- but that seem excessive.
Surely there is a simpler way?
> x <- rnorm(100)
> y <- rnorm(10)
> xw <- rnorm(100) * 1.73 # The weights. These won't add up to 1 or N or anything because of missing values.
> yw <- rnorm(10) * 6.23 # The weights. These won't add up to 1 or to the same number as xw.
> # The question to answer is, how can I create a qq plot or cdf compare of x vs. y, weighted by their weights, xw and yw (to eventually figure out if y comes from the population x, similar to Kolmogorov-Smirnov GOF)?
> qqplot(x,y) # What now?
Thanks for any help,
--
-- Vivek Satsangi
Student, Rochester, NY USA
Life is short, the art long, opportunity fleeting, experiment
treacherous, judgement difficult.
More information about the R-help
mailing list