Perform a sign test for a paired sample on variables of a data set. The output is printed as a LaTeX table that mimics the look of SPSS output.
sign_test(data, variables, exact = FALSE)# S3 method for sign_test_SPSS
to_SPSS(
object,
statistics = c("test", "frequencies"),
version = r2spss_options$get("version"),
...
)
# S3 method for sign_test_SPSS
print(
x,
statistics = c("frequencies", "test"),
version = r2spss_options$get("version"),
...
)
signTest(data, variables, exact = FALSE)
a data frame containing the variables.
a character vector specifying two numeric variables containing the paired observations.
a logical indicating whether or not to include the exact p-value using the binomial distribution. Note that the p-value using the normal approximation is always reported.
an object of class "sign_test_SPSS"
as returned by
function sign_test
.
a character string or vector specifying which SPSS tables
to produce. Available options are "frequencies"
for a summary of
the frequencies and "test"
for test results. For the to_SPSS
method, only one option is allowed (the default is the table of test
results), but the print
method allows several options (the default
is to print all tables).
a character string specifying whether the table should
mimic the content and look of recent SPSS versions ("modern"
) or
older versions (<24; "legacy"
). The main difference in terms of
content is that small p-values are displayed differently.
additional arguments to be passed down to
format_SPSS
.
An object of class "sign_test_SPSS"
with the following
components:
statistics
a data frame containing information on the number of observations with negative and positive differences.
asymptotic
a list containing the results of the test using the normal approximation.
exact
if requested, a numeric vector containing the exact two-sided p-value, one-sided p-value, and point probability using the binomial distribution.
variables
a character vector containing the names of the two numeric variables with the paired observations.
n
an integer giving the number of observations.
The to_SPSS
method returns an object of class "SPSS_table"
which contains all relevant information in the required format to produce
the LaTeX table. See to_latex
for possible components and
how to further customize the LaTeX table based on the returned object.
The print
method produces a LaTeX table that mimics the look of SPSS
output.
The print
method first calls the to_SPSS
method followed
by to_latex
. Further customization can be done by calling
those two functions separately, and modifying the object returned by
to_SPSS
.
# NOT RUN {
# load data
data("Exams")
# test whether grades differ between the
# regular exam and the resit
sign_test(Exams, c("Regular", "Resit"))
# }
Run the code above in your browser using DataLab