plots {sac} | R Documentation |
Plot and compare the empirical likelihood and semiparametric empirical likelihood distribution functions, plot loglikelihood function.
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",...)
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 |
Zhong Guan zguan@iusb.edu
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.
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")