R/print.nonlintest.R

Defines functions print.nonlintest

Documented in print.nonlintest

## print.nonlintest.R
## Prints basic results from nonlintest


#' Print the Results of the Non-linear Test
#' 
#' The default print method for a \code{nonlintest} object produced by
#' \code{nonlintest}.
#' 
#' 
#' @param x a \code{nonlintest} object produced by \code{nonlintest}.
#' @param \dots additional arguments to \code{plot}
#' @author Adrian Barnett \email{a.barnett@qut.edu.au}
#' @seealso \code{nonlintest}, \code{plot.nonlintest}
#' @export
print.nonlintest<-function(x, ...){
  ## Check
  if (class(x) != "nonlintest"){
    stop("Object must be of class 'nonlintest'")
  } 

# 1) Stats on third order moment
diff_l=x$region*0
diff_u=x$region*0
index=which(x$region>0,arr.ind=T)
if(length(index)>0){diff_u[index]=x$region[index]}
index=which(x$region<0,arr.ind=T)
if(length(index)>0){diff_l[index]=x$region[index]}

  cat('Largest and smallest co-ordinates of the third-order moment outside the test limits\n');
# Upper limit
if(max(diff_u)>0){
   index=which(diff_u==max(diff_u),arr.ind=T);
   cat('Largest positive difference at lags:\n');
   cat(index-1,'\n');
   cat('Size of largest largest difference:\n');
   cat(max(diff_u),'\n');
}
if(max(diff_u)==0){
   cat('Largest difference is zero\n');
}
# Lower limit
if(min(diff_l)<0){
   index=which(diff_l==min(diff_l),arr.ind=T);
   cat('Largest negative difference at lags:\n');
   cat(index-1,'\n');
   cat('Size of largest negative difference:\n');
   cat(min(diff_l),'\n');
}
if(min(diff_l)==0){
   cat('Smallest difference is zero\n');
}


# 2) Bootstrap stats
  cat('\nBootstrap test of non-linearity using the third-order moment\n');
  cat('Statistics for areas outside test limits:\n');
  cat('observed     obs/SD     median-null    95%-null    p-value\n');
  cat(x$stats$outside,x$stats$stan,x$stats$median,x$stats$upper,x$stats$pvalue,'\n');
} # end of function

Try the season package in your browser

Any scripts or data that you put into this service are public.

season documentation built on March 21, 2022, 9:10 a.m.