Skip to content

R suitability for development project

7 messages · Rolf Turner, Eric Langley, Jim Lemon

#
Hello All,

Eric Langley here with my first post to this list. I am looking to
determine if R is suitable for a development project I am working on
and if so possibly finding someone proficient in R that would be
interested in doing the coding.

I would like to preface my inquiry that while I am not a programmer I
can communicate in a dialog my objectives.

An array of rank ordered data looks like this:
Item-Rank  First  Second  Third  Fourth  Totals
Item1         6       8           0       0          14
Item2         7       5           2       0          14
Item3         1       1          11      1          14
Item4         0       0           1       13        14
Totals        14      14        14      14

The required output of R will be two fold;

1, a numerical score for each of the Items (1-4) from highest to
lowest and lowest to highest on a scale of 0-99 that is statistically
accurate. For this example the scores would be Item1 highest number
down to Item4 with the lowest number. In reverse Item4 would be the
highest number down to Item1 the lowest number. For the Highest like
this; Item1=94, Item2=88, Item3=48, Item4=2 (just guessing here on the
scores...:)

2, a graphical output of the data based on the scores in three special
graphs with a middle line at '0' and increasing numbers to the left
AND right. The graphs plot the Highest ranked Items, the Lowest Ranked
items and a combination of the two.
Sample graphs are here: http://community.abeo.us/sample-graphs/

Looking forward to hearing if R will be able to accomplish this.

TYIA,

~eric

--
Eric Langley
Founder
abeo

eric at abeo.us
404-326-5382
#
On 03/09/12 14:15, Eric Langley wrote:
Is there monetary reward involved?  Or are you just counting
     on people's good nature?
This reminds me of

         fortune("driveway")

     from the "fortunes" package.


         cheers,

             Rolf Turner
#
Eric Langley wrote:
Hi Eric,
I would use mean ranks for something like this. You would have to 
calculate these from your summary array unless you have the raw ranks.

ranksumm2meanranks<-function(x,nobs) {
  nitems<-dim(x)[1] - 1
  meanrankvec<-rep(0,nitems)
  for(rankrow in 1:nitems) {
   for(rankcol in 1:nitems)
    meanrankvec[rankrow]<-
     meanrankvec[rankrow]+x[rankrow,rankcol]*rankcol
   meanrankvec[rankrow]<-
    meanrankvec[rankrow]/x[rankrow,nitems+1]
  }
  names(meanrankvec)<-rownames(x)[-1]
  return(meanrankvec)
}

 > ranksumm2meanranks(x)
    Item2    Item3    Item4   Totals
1.571429 1.642857 2.857143 3.928571

You can obtain the "reversed" ranks by subtracting the above from the 
maximum rank score (4), but I don't see why you would want to do this.

Your explanation of the plot is not entirely clear. The ranges of the 
ranks for the items are:

Item1 c(1,2)
Item2 c(1,3)
Item3 c(1,4)
Item4 c(3,4)

You could plot these as horizontal bars spanning the range of the ranks 
for each item with a vertical line across each bar showing the value of 
the mean rank for that item. This would illustrate both the relative 
position and variability of ranks, something like a boxplot.

In case you have incomplete ranks, check the crank package for 
completion of incomplete ranks.

Jim
#
Rolf wrote:
I note:
Absolutely, I should have noted that...
Rolf wrote:
I note:
You mean this one?
"I think this is kind of like asking ?will your Land Rover make it up
my driveway?", but I?ll assume
the question was asked in all seriousness.
?Ista Zahn (in response to a request for replication of some data preprocessing
done in SAS)
R-help (April 2011)"
On Mon, Sep 3, 2012 at 2:08 AM, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
--
Eric Langley
Founder


eric at abeo.us
404-326-5382
#
Jim wrote:

            
I note:
Thank you for the detailed answer.
I have the raw ranks. For a question they look like this; 1=Item2,
2=Item1, 3=Item3, 4=Item4
Jim wrote:
I note:
Is it possible to have the output as an integer where 99 is the highest score?
Jim wrote:

            
I note:
The look I am aiming to achieve (as shown here:
http://community.abeo.us/sample-graphs/ ) is a relative position
within the middle zero based horizontal axis. The mean is not
required. Since all bars are 14 units long the upper and lower values
note where the end of each bar should align, either to the right for
Highest or to the left for Lowest. The third graph shows both.

~eric
On Mon, Sep 3, 2012 at 7:41 AM, Jim Lemon <jim at bitwrit.com.au> wrote:

  
    
#
On 09/03/2012 11:18 PM, Eric Langley wrote:
<chomp>
It certainly is. The mean ranks are:

Item2    Item3    Item4   Totals
  1.571429 1.642857 2.857143 3.928571

To make the highest score 99 (meaning the score for the highest ranked 
item) and the lowest score -99 as on your examples:

# first convert high ranks to high numeric scores
revmeanranks<-4-meanranks
revmeanranks
    Item1    Item2    Item3    Item4
2.428571 2.357143 1.142857 0.071429
# scale the score to the desired range
library(plotrix)
rescale(revmeanranks,c(-99,99))
      Item1      Item2      Item3      Item4
  99.000000  93.000046  -9.000015 -99.000000
# then just round or truncate your values to get integers

<chomp>
I think you may be doing something here that you don't intend. The point 
of plots like this is to transform numeric values into lengths or areas. 
If you don't maintain the same metric throughout the plot, the 
relationship between the two is lost. If you were using vertical lines 
to indicate the transformed mean ranks of the items, they could be 
placed at the appropriate positions. As you use different edges of the 
bars to place them, let's see, your bars are about 90 units wide so 
there would be about a 180 unit offset between positive and negative 
transformed mean ranks. Are you sure that you want to do this?

Jim
#
Jim,

Thank you again for your response. The integer conversion looks good.
You wrote:
I note:
Yes, the bars are half the width of the axis. In this model there are
14 questions to determine the ranking. My concept is the all of the
Items are ranked. Even though some Items may not be ranked in some
positions, 1,2,4 or 4, they still receive a rank. Therefore with 14
ranks all of the bars are the same width. There position along the
horizontal axis is determined by the right edge of the bar for highest
rank.

~eric
On Tue, Sep 4, 2012 at 5:31 AM, Jim Lemon <jim at bitwrit.com.au> wrote: