Topic: Utilities
Topic Description:
Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.
File: utilities/statistics.r
| View File Source | Download File | No help file available |
Function: graph.modeldiag
Function Description: graph.modeldiag
Graph diagnostics of model.xyFunction Arguments:
| Argument | Default Value |
|---|---|
| fit | |
| burn | 500 |
| llikelim | 50 |
| graphpar | 1:3 |
Function Source:
graph.modeldiag=function(fit,burn=500,llikelim=50,graphpar=1:3)
{
dev=dev.set(2)
if(dev==1)
{
graphics.off()
x11(height=9,width=9,xpos=200)
}
full=data.frame(fit$full[-(1:burn),])
plot(full[,graphpar])
dev=dev.set(3)
if(dev!=3) x11(height=7,width=9,xpos=600)
llikerange=c(max(fit$llike)-llikelim,max(fit$llike))
plot(fit$llike,ylim=llikerange)
dev=dev.set(4)
if(dev!=4) x11(height=9,width=7,xpos=800)
par(mfcol=c(length(graphpar),1),mai=c(.4,.4,0,0))
for(p in graphpar) plot(fit$full[,p])
dev=dev.set(5)
if(dev!=5) x11(height=9,width=7,xpos=400)
par(mfcol=c(length(graphpar),1),mai=c(.4,.4,0,0))
for(p in graphpar) plot(fit$full[-(1:burn),p],fit$llike[-(1:burn)],ylim=llikerange)
}
{
dev=dev.set(2)
if(dev==1)
{
graphics.off()
x11(height=9,width=9,xpos=200)
}
full=data.frame(fit$full[-(1:burn),])
plot(full[,graphpar])
dev=dev.set(3)
if(dev!=3) x11(height=7,width=9,xpos=600)
llikerange=c(max(fit$llike)-llikelim,max(fit$llike))
plot(fit$llike,ylim=llikerange)
dev=dev.set(4)
if(dev!=4) x11(height=9,width=7,xpos=800)
par(mfcol=c(length(graphpar),1),mai=c(.4,.4,0,0))
for(p in graphpar) plot(fit$full[,p])
dev=dev.set(5)
if(dev!=5) x11(height=9,width=7,xpos=400)
par(mfcol=c(length(graphpar),1),mai=c(.4,.4,0,0))
for(p in graphpar) plot(fit$full[-(1:burn),p],fit$llike[-(1:burn)],ylim=llikerange)
}