Skip to content
Prev 393558 / 398503 Next

getting information out of Rao test output

?s 18:04 de 08/01/2023, Nick Wray escreveu:
Hello,

This test returns a non-standard object, meaning, not an object of class 
"htest" and its print method creates and invisibly returns an object 
with the value you want.



library(circular)
#>
#> Attaching package: 'circular'
#> The following objects are masked from 'package:stats':
#>
#>     sd, var

# data
x <- circular(runif(200, 0, 2*pi))
# run the test
test_result <- rao.spacing.test(x, alpha=0.1)
# save the print method result
print_result <- print(test_result)
#>
#>        Rao's Spacing Test of Uniformity
#>
#> Test Statistic = 135.2864
#> Level 0.1 critical value = 140.06
#> Do not reject null hypothesis of uniformity
print_result$accepted
#> [1] TRUE



If you run

getAnywhere("print.rao.spacing.test")

you will see that the printing is made by a series of cat instructions 
so to get the TRUE/FALSE above you will need to print the result like above.