plots                  package:sac                  R Documentation

_V_i_s_u_a_l_i_z_e_d _M_o_d_e_l _D_i_a_g_n_o_s_t_i_c _a_n_d _L_o_g_l_i_k_e_l_i_h_o_o_d _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     Plot and compare the empirical likelihood and semiparametric
     empirical likelihood distribution functions, plot loglikelihood
     function.

_U_s_a_g_e:

     Graf.Diagnostic(x, k, m, Alpha, Beta, Color, LTY, xlab = "x", 
         ylab = "Estimated DF's", main = "Model Diagnostic", 
         OneLegend = TRUE, lgnd1, lgnd2, arw1, arw2, ...)
     Plot.ll(x, ll, col, xaxis.lab = NULL, xlab = "k", ylab = "Loglikelihood", 
         main = "Plot of Loglikelihood",...)

_A_r_g_u_m_e_n_t_s:

       x: a numeric vector or matrix containing the data, one row per
          observation;

      ll: loglikelihood function, output of 'SemiparChangePoint' 

     col: color code or character string for the loglikelihood curve 

xaxis.lab: a vector of character strings or numeric values to be placed
          at the tickpoints as 'labels' of 'axis' 

       k: the estimated change-point, output of 'SemiparChangePoint' 

       m: = 'n', the sample size, for '"one-change"' alternative, or
          the estimated second change-point for '"epidemic"'
          alternative, an output of 'SemiparChangePoint' 

   Alpha: estimated parameter alpha, output of 'SemiparChangePoint'  

    Beta: estimated parameter beta, output of 'SemiparChangePoint'  

   Color: a vector of character strings or color codes for curves of
          estimated distribution functions F-hat, F-tilde, G-hat and
          G-tilde

     LTY: vector of lty's, LTY=c(lty1, lty2, lty3, lty4), corresponds
          to the above color codes 

    xlab: character string for x-axis lable 

    ylab: character string for y-axis lable 

    main: character string for main title 

OneLegend: a logical indicating whether plot one or two legend. 

   lgnd1: a numeric vector of two specify the position of the first
          legend box 

   lgnd2: a numeric vector of two specify the position of the second
          legend box, if 'OneLegend' = FALSE 

    arw1: a numeric vector of four numbers indicating start and end
          positions of the first arrows point to curves 

    arw2: a numeric vector of four numbers indicating start and end
          positions of the second arrows point to curves 

     ...: other arguments of function 'plot'

_A_u_t_h_o_r(_s):

     Zhong Guan zguan@iusb.edu

_R_e_f_e_r_e_n_c_e_s:

     Guan, Z.(2001) Some Results About Empirical Likelihood Method,
     _Ph.D. Thesis, The University of Toledo_;

     Guan, Z.(2004) A semiparametric change-point model, _Biometrika_,
     91, 4, 849-862.

     Guan, Z. Semiparametric Tests for Changepoints with Epidemic
     Alternatives.

_S_e_e _A_l_s_o:

     'schapt'

_E_x_a_m_p_l_e_s:

     require(sac) #load the package
     k<-30
     n<-80
     x<-rnorm(n,0,1)
     x[(k+1):n]<-x[(k+1):n]+1.5
     res<-SemiparChangePoint(x, alternative = "one.change")
     Plot.ll(x, res$ll, col="blue")

     ## Nile data with one change-point: the annual flows drop in 1898 which corresponds 
     ## to k=28. It is believed to be caused by the building of the first Aswan dam.
     if(! "package:sac" %in% search()) library(sac) 
         #if package sac has not been loaded, load it.
     if(! "package:stats" %in% search()) library(stats)
     data(Nile)
     plot(Nile, type="p")
     Nile.res<-SemiparChangePoint(Nile, alternative = "one.change")
     Color<-c(1,2,3,4); LTY<-c(1,2,3,4)

     ## Plots of estimated distribution functions
     Graf.Diagnostic(Nile, Nile.res$k.hat, length(Nile), Nile.res$alpha.hat, 
         Nile.res$beta.hat, Color, LTY, xlab = "x", ylab = "Estimated DF's", 
         main="Model Diagnostic for Nile Data", OneLegend = FALSE, lgnd1 = 
         c(1100, 0.15), lgnd2 = c(600, .99), arw1=c(780, .93, 1010, .9),
         arw2 = c(1165, .15, 1015, .24))

     ## Plot of loglikelihood function
     Plot.ll(Nile, Nile.res$ll, col = "blue")
     Plot.ll(Nile, Nile.res$ll, col = "blue", xaxis.lab = seq(1871,1970, length = 100), 
         xlab = "Year")

