[R] ranking the results of a questionnaire
Wolfgang Lindner
LindnerW at t-online.de
Fri Nov 28 20:16:48 CET 2008
dear experts,
I reproduced an experiment (questionnaire) some times.
The result of the experiment is a vector of 5 factors, say (A,B,C,D,E).
In the original article the result is given in 5 pairs of mean and stDev for
A .. E, e.g. mean_A=37.4 and sd_A=8.1.
The interval for A,B,C,D,E values is 0..50. The original data frame is not
available.
For a comparison of my results L=(A',B',C',D',E') with the original
G=(A,B,C,D,E) we can interpret that smaller sd-values are 'better'.
But for the means the interpretation is a little bit complicated:
a smaller mean value of A or B or E is 'better', but a bigger mean value for
C or D is 'better'.
To construct a quantified value of being 'better' and to rank my data L vs.
the data G, I wrote a kind of an signed distance-function.
Here is my simple code and an small example run:
R version 2.7.1 (2008-06-23)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
> L<-c(32.8,5.3, 26.3,9.0, 35.1,6.2, 33.4,6.3, 22.9,12.9)
> G<-c(37.4,8.1, 30.6,9.7, 32.0,7.9, 29.7, 9.0, 17.1,10.8)
> sigdist<- function (L,G)
sqrt(
sign( G[1]-L[1] )*(G[1]-L[1])^2
+ sign( G[2]-L[2] )*(G[2]-L[2])^2
+ sign( G[3]-L[3] )*(G[3]-L[3])^2
+ sign( G[4]-L[4] )*(G[4]-L[4])^2
- sign( G[5]-L[5] )*(G[5]-L[5])^2
+ sign( G[6]-L[6])*(G[6]-L[6])^2
- sign( G[7]-L[7] )*(G[7]-L[7])^2
+ sign( G[8]-L[8] )*(G[8]-L[8])^2
+ sign( G[9]-L[9] )*(G[9]-L[9])^2
+ sign( G[10]-L[10] )*(G[10]-L[10])^2
)
> sigdist(L,G)
[1] 6.588627
I like to interpret the positive value 6.588 that 'the L vector is better
then G vector w.r.t. sigdist'.
My questions are:
1. are there build-in functions in R calculating some (distance?)value with
the possibility of a similar interpretation?
2. are there other ideas for a ranking of the experimental results L and G?
Any comments, critique or hints are very welcome.
Sincerely
Wolfgang
More information about the R-help
mailing list