get_abnorm_hist {globaltrends} | R Documentation |
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 class 'exp_score'
get_abnorm_hist(
data,
train_win = 12,
train_break = 0,
type = c("obs", "sad", "trd"),
...
)
## S3 method for class 'exp_voi'
get_abnorm_hist(
data,
train_win = 12,
train_break = 0,
type = c("obs", "sad", "trd"),
...
)
## S3 method for class 'exp_doi'
get_abnorm_hist(
data,
train_win = 12,
train_break = 0,
measure = c("gini", "hhi", "entropy"),
...
)
data |
Object of class |
... |
Further arguments passed to or from other methods. |
train_win |
Object of type |
train_break |
Object of type |
type |
Object of type |
measure |
Object of type |
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
.
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")
.
## Not run:
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")
## End(Not run)