[R] printing all htest class members

Rui Barradas ruipbarradas at sapo.pt
Thu Dec 15 18:26:05 CET 2011


I've posted a question about this subject yesterday, but since there was no
R code to comment,
no one did.

I'm trying to have the print method for class 'htest' print some extra
information common in some test, like the time series linearity related
tests. Many of them have an 'order' parameter, representing a lag or
embedding dimension, and it would be a nice feature to pass a vector of
orders and have all corresponding tests run.

It's easy to do this, but the print method doesn't print those extra values.
Here the code  goes:

#Some values from the McLeod-Li test, with x <- rnorm(100)
res <- data.frame(ord=2:4, df=ord, Q=c(0.0129, 0.049, 0.0684),
                    p=c(0.9936, 0.9972, 0.9994))
nr <- nrow(res)

# print.htest prints everything but 'all.orders'
# but when it's named 'null.value' it works and it's easier to make
# it work, all what's needed is 'null.value=res', whithout the need
# for a second 'structure()'
		alternative="It doesn't print 'all.orders' and I find 'null.value'
		method="Test the 'print.htest' method using McLeod-Li test values.",
			list(order=ord, df=df, Q=Q, p.value=p),
			.Names=c("order", "df", "Q", "p.value"),

Is there a way to have 'all.orders' printed by 'print.htest' ? 
The problem is NOT the return values, at least the time wasn't wasted,
I can use them for whatever I'll do next.

If not, anyone has any suggestions?

Thank you in advance,

Rui Barradas

View this message in context: http://r.789695.n4.nabble.com/printing-all-htest-class-members-tp4200872p4200872.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list