net_promoter: Calculate a 'Net Promoter Score' from rating scale data

Description Usage Arguments Details Value Examples

Description

net_promoter() is a summary function which takes a vector of 0 to 10 rating scale data and returns a 'Net Promoter Score'. There are options to and calculate confidence intervals and treat missing values as 'Neutral' ratings.

Usage

1
2
net_promoter(x, scale = 100, include_na = FALSE, interval = FALSE,
  method = "wald", level = 0.95, boot_r = 2000, boot_type = "bca")

Arguments

x

A numeric vector of integers between 0 and 10.

scale

A numeric scaling factor to apply to the score once it has been calculated.

include_na

Should missing values be treated as 'Neutral' responses?

interval

Should a confidence interval, as well as the score, be returned?

method

A string specifying the type of method used in calculating the confidence interval, see details. Must be either "wald" or "boot".

level

Desired confidence level.

boot_r

An integer specifying the number of bootstrap replications used when method = "boot".

boot_type

A string specifying the type of calculation used to find the confidence limits when method = "boot". These are the same as in boot::boot.ci but only c("norm", "basic", "perc", "bca") are implemented.

Details

The 'Net Promoter Score' is commonly used to summarise responses to 'likelihood to recommend' questions obtained in customer surveys. The rating scale ranges from 0 to 10 but this is collapsed into 3 bins. 0 to 6 are considered 'Detractors', 7 to 8 are 'Neutral' and 9 to 10 are 'Promoters'. The score is then the difference between the proportion of 'Promoter' responses and the proportion of 'Detractor' responses.

As this score is a difference between two proportions in the same sample it takes discrete values between -1 and 1. However, when reported the score is often multiplied by 100 and treated much like a percentage. Of course, this scaling is completely arbitrary so the function provides an argument to change the scale but the default is set to 100.

Confidence Intervals:

By default, the function will return the score alone but when interval = TRUE a confidence interval will also be calculated. Either a Wald-type or bootstrapping approach will be used depending on the value of method.

For method = #' "wald" the score is assumed to be normally distributed with the variance and derived from the properties of a multinomial random variable.

For method = "boot", bootstrapping will be employed using functions from the boot package. The default approach for calculating the interval the adjusted bootstrap percentile method but other boot::boot.ci interval types can be specified.

The Wald-type intervals should be a good approximation in large samples but when the sample size is small or the score is near -1 or +1 bootstrapping is recommended.

Value

If interval = FALSE then only the score is returned as a numeric value. Otherwise both the score and limits of the confidence interval will be returned in a length 3 numeric vector of the form c(score, lower, upper).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Generate rating scale data
p <- 0.5 # probability of 'Promoter'
d <- 0.3 # probability of 'Detractor
prob <- c(rep(d, 7) / 7, rep(1 - p - d, 2) / 2, rep(p, 2) / 2)
ratings <- sample(0:10, 30, TRUE, prob)

# Calculate NPS
net_promoter(ratings)                   # default action
net_promoter(ratings, scale = 1)        # unadulterated score
net_promoter(ratings, interval = TRUE)  # get a confidence interval

# Wald-type confidence interval can lead to impossible limits when the score is near the
# extremes. Its better to use a percentile bootsrapping method in this case.
p <- 0.05
d <- 0.9
prob <- c(rep(d, 7) / 7, rep(1 - p - d, 2) / 2, rep(p, 2) / 2)
set.seed(1234)
ratings <- sample(0:10, 30, TRUE, prob)

net_promoter(ratings, interval = TRUE, method = "wald")
net_promoter(ratings, interval = TRUE, method = "boot")

liam-c-smith/secretsauce documentation built on May 16, 2019, 7:16 p.m.