qqrank: Load-Deviance Ranking

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/qqrank.R

Description

Rank by size and deviance from the hypothesized mean.

Usage

1
2
3
qqrank(X, INDEX, alternative = c("two.sided", "less", "greater"), 
       absrank = TRUE, N = NA, b = NA, plotpenalty = TRUE, 
       allowed.error = 0.005)

Arguments

X

A numeric vector.

INDEX

A factor of length X.

alternative

The alternative hypothesis. Accepts "two.sided", "less", or "greater".

absrank

If TRUE, INDEX means greater than or less than the population mean will produce a positive qqscore. If FALSE, INDEX means greater than the population mean will have a positive qqscore and INDEX means less than the population mean will have a negative qqscore. The default is TRUE.

N

The number of observations below which a growth penalty is applied. N is passed to x1 argument of glpenalty.

b

A positive numeric value representing the growth rate of the glpenalty.

plotpenalty

If TRUE, the glpenalty is plotted. The default is TRUE.

allowed.error

The allowed difference between glpenalty and 1 at N. The default is 0.005.

Details

qqrank ranks by size and deviance from the hypothesized mean using either the Binomial Test or Welch's t-Test. Restated, qqrank is a function of a size penalty, test statistic or variant thereof, and p-value.

Value

qqrankmatrix

A data frame containing the size, mean, standard deviation, and qqrank of each INDEX.

test.used

The statistical test used to measure deviance from the mean.

pop.mean

The mean of X.

pop.sd

The standard deviation of X.

Author(s)

Robert P. Bronaugh

See Also

glpenalty t.test binom.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  # which hospital has the "worst" readmissions? (note: the average
  # readmission rate is 17.13%
  data(ipadmits)
  attach(ipadmits)
  ip.ag = data.frame('sum' = tapply(ipadmits$isReadmission,ipadmits$HospID,sum),
                     'avg' = tapply(ipadmits$isReadmission,ipadmits$HospID,mean))
  
  # hospital 9 has the most readmissions (1,094), but the percent of readmissions
  # is low at 14%, less than the population average. 
  ip.ag[order(-ip.ag$sum),][1,]
  
  # hostpital 80 has the highest percentage of readmissions 87.5%, but only
  # 7 readmissions over all. 
  ip.ag[order(-ip.ag$avg),][1,]
  
  # using qqrank and penalizing samples less than N = 250 at a growth
  # rate of b = 0.05, Hospital 39 has 1606 readmissions with a readmission
  # percent of 38%. 
  qqr = qqrank(ipadmits$isReadmission,ipadmits$HospID
               ,alternative = "greater",N = 250, b = 0.05)
  round(qqr$rankmatrix,2)
  
  # relax sample penalty and rank on both sides of the mean
  # Hospital 21 has the "best" readmission track record.
  qqr = qqrank(ipadmits$isReadmission,ipadmits$HospID
               ,alternative = "two.sided",absrank = FALSE,N = 30, b = 0.1)
  round(qqr$rankmatrix,2)
  detach(ipadmits)
  

phalen documentation built on May 29, 2017, 4:22 p.m.