[R] producing a QQ plot.

Philip Wong tomb_fighter at hotmail.com
Sat Mar 27 10:45:14 CET 2010


Hello everyone I'm a beginner in Stats and R, I'm using R 2.10.1.  I need to
create a multivariate qq plot, there is 8 variable group with each has 55
number of input.  An example of what I did so far, just to get my point out:
> data=read.csv(file.choose(),header=T)
> data
             country     village group    av_expen  P2ary_ed  no_fisher
1       Cook Islands    Aitutaki     D  5239.12747 0.6666667  666.99986
2       Cook Islands     Mangaia     C  4587.36188 0.6021505  207.69228
3       Cook Islands  Palmerston     B  7784.31874 0.1666667   24.00000
...
53 Wallis And Futuna  All Futuna     D 11023.30674 0.2789855 1056.63143
54 Wallis And Futuna      Halalo     B  8783.54979 0.2794118  153.51715
55 Wallis And Futuna     Vailala     A 12231.95400 0.2395833  100.00000

The problem I'm having starts now.  I use the following command trying to
work out the mahalanobis before plotting the QQ plot, but the following
error is prompt:
> mah=mahalanobis(data,apply(data,2,mean),var(data))
Error in FUN(x, aperm(array(STATS, dims[perm]), order(perm)), ...) : 
  non-numeric argument to binary operator
In addition: Warning messages:
1: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
2: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
3: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
4: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
5: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
6: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
7: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
8: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
9: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
10: In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA

Then I thought to myself, maybe the error I got the wrong input for
variable.  So I adjust the variable to see is my assumption was correct to
the command below, but I still got the same error:
> mah=mahalanobis(data,apply(data,2,mean),var(no_fisher))

I absolutely got no clue where I got wrong and don't know how to fix it. 
Anyways I thought to myself, no worries I don't use mahalanobis then I'll
still try the QQ plot and see what happen.  This is the command and the
error I got from it:
qqplot(qchisq(ppoints(data),ncol(data),data)
Error in qchisq(p, df, lower.tail, log.p) : 
  Non-numeric argument to mathematical function

-- 
View this message in context: http://n4.nabble.com/producing-a-QQ-plot-tp1693228p1693228.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list