The function allows to compute changes in search scores, voi, and doi and shows percentile of changes to identify abnormal changes. In combination with various write functions in R, the functions allow exports from the database to local files.
get_abnorm_hist(data, ...)# S3 method for exp_score
get_abnorm_hist(
data,
train_win = 12,
train_break = 0,
type = c("obs", "sad", "trd"),
...
)
# S3 method for exp_voi
get_abnorm_hist(
data,
train_win = 12,
train_break = 0,
type = c("obs", "sad", "trd"),
...
)
# S3 method for exp_doi
get_abnorm_hist(
data,
train_win = 12,
train_break = 0,
measure = c("gini", "hhi", "entropy"),
...
)
The functions export and filter the respective database tables and return
objects of class "tbl_df", "tbl", "data.frame"
.
Input class exp_score
computes abnormal changes in search
scores with columns keyword, location, date, control, object, score,
score_abnorm, quantile. Object of class
c("abnorm_score", "data.frame")
.
Input class exp_voi
computes abnormal changes in VOI with
columns keyword, date, control, object, voi, voi_abnorm, quantile. Object
of class c("abnorm_voi", "data.frame")
.
Input class exp_doi
computes abnormal changes in DOI with
columns keyword, locations, date, control, object, doi, doi_abnorm,
quantile. Object of class c("abnorm_doi", "data.frame")
.
Object of class exp_score
, exp_voi
or
exp_doi
generated through export_...
functions.
Further arguments passed to or from other methods.
Object of type numeric
. Length of rolling average
training window in months. Defaults to 12.
Object of type numeric
. Length of break between
rolling average training window and date in months. Defaults to 1.
Object of type character
indicating the type of time
series-column from data_score, takes either obs, sad, or
trd. Defaults to "obs".
Object of type character
indicating the measure used
for DOI computation for which abnormal changes should be analyzed. Takes
either gini, hhi, or entropy. Defaults to "gini".
The function computes abnormal changes in search scores, VOI, or DOI for each
date. We define "abnormal" in terms of deviation from a historic baseline
value. To compute the historic baseline value, the function computes a moving
average. Users can specify the window for moving average training
train_win
and a break between training and the given date
train_break
. Abnormal changes are the difference between the moving
average and the respective search score, VOI, or DOI. To highlight abnormal
changes, the function computes a historic percentile rank for each abnormal
change within the distribution of abnormal changes. Low percentile ranks
signify abnormally high negative changes. High percentile ranks signify
abnormally high positive changes.
The function uses the output from export_...
functions as input. As
get_abnorm_hist
offers no additional filters, users are advised to use
filters in the export_...
functions or to pre-process data before
using get_abnorm_hist
.
export_score()
export_voi()
export_doi()
if (FALSE) {
data <- export_score(keyword = "amazon")
get_abnorm_hist(data, train_win = 12, train_break = 0, type = "obs")
data <- export_voi(keyword = "amazon")
get_abnorm_hist(data, train_win = 12, train_break = 0, type = "obs")
data <- export_score(keyword = "amazon")
get_abnorm_hist(data, train_win = 12, train_break = 0, measure = "gini")
}
Run the code above in your browser using DataLab