opi_impact {opitools} | R Documentation |
Statistical assessment of impacts of a specified theme from a DTD.
Description
This function assesses the impacts of a theme
(or subject) on the overall opinion computed for a DTD
Different themes in a DTD can be identified by the keywords
used in the DTD. These keywords (or words) can be extracted by
any analytical means available to the users, e.g.
word_imp
function. The keywords must be collated and
supplied this function through the theme_keys
argument
(see below).
Usage
opi_impact(textdoc, theme_keys=NULL, metric = 1,
fun = NULL, nsim = 99, alternative="two.sided",
quiet=TRUE)
Arguments
textdoc |
An |
theme_keys |
(a list) A one-column dataframe (of any number of length) containing a list of keywords relating to the theme or secondary subject to be investigated. The keywords can also be defined as a vector of characters. |
metric |
(an integer) Specify the metric to utilize
for the calculation of opinion score. Default: |
fun |
A user-defined function given that parameter
|
nsim |
(an integer) Number of replicas (ESD) to generate.
See detailed documentation in the |
alternative |
(a character) Default: |
quiet |
(TRUE or FALSE) To suppress processing
messages. Default: |
Details
This function calculates the statistical
significance value (p-value
) of an opinion score
by comparing the observed score (from the opi_score
function) with the expected scores (distribution) (from the
opi_sim
function). The formula is given as
p = (S.beat+1)/(S.total+1)
, where S_total
is the total
number of replicas (nsim
) specified, S.beat
is number of replicas
in which their expected scores are than the observed score (See
further details in Adepeju and Jimoh, 2021).
Value
Details of statistical significance of impacts
of a secondary subject B
on the opinion concerning the
primary subject A
.
References
(1) Adepeju, M. and Jimoh, F. (2021). An Analytical Framework for Measuring Inequality in the Public Opinions on Policing – Assessing the impacts of COVID-19 Pandemic using Twitter Data. https://doi.org/10.31235/osf.io/c32qh
Examples
# Application in marketing:
#`data` -> 'reviews_dtd'
#`theme_keys` -> 'refreshment_theme'
#RQ2a: "Do the refreshment outlets impact customers'
#opinion of the services at the Piccadilly train station?"
##execute function
output <- opi_impact(textdoc = reviews_dtd,
theme_keys=refreshment_theme, metric = 1,
fun = NULL, nsim = 99, alternative="two.sided",
quiet=TRUE)
#To print results
print(output)
#extracting the pvalue in order to answer RQ2a
output$pvalue