| sign_test | R Documentation |
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 class 'sign_test_SPSS'
to_SPSS(
object,
statistics = c("test", "frequencies"),
version = r2spss_options$get("version"),
...
)
## S3 method for class 'sign_test_SPSS'
print(
x,
statistics = c("frequencies", "test"),
version = r2spss_options$get("version"),
...
)
signTest(data, variables, exact = FALSE)
data |
a data frame containing the variables. |
variables |
a character vector specifying two numeric variables containing the paired observations. |
exact |
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. |
object, x |
an object of class |
statistics |
a character string or vector specifying which SPSS tables
to produce. Available options are |
version |
a character string specifying whether the table should
mimic the content and look of recent SPSS versions ( |
... |
additional arguments to be passed down to
|
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.
An object of class "sign_test_SPSS" with the following
components:
statisticsa data frame containing information on the number of observations with negative and positive differences.
asymptotica list containing the results of the test using the normal approximation.
exactif requested, a numeric vector containing the exact two-sided p-value, one-sided p-value, and point probability using the binomial distribution.
variablesa character vector containing the names of the two numeric variables with the paired observations.
nan 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.
LaTeX tables that mimic recent versions of SPSS (version = "modern")
may require several LaTeX compilations to be displayed correctly.
Andreas Alfons
# load data
data("Exams")
# test whether grades differ between the
# regular exam and the resit
sign_test(Exams, c("Regular", "Resit"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.