| llPlot {dbd} | R Documentation |
Plot the log likelihood surface for the data.
Description
Plot, as a perspective plot or a contour plot, the log likelihood surface for the data set from which parameters are being estimated.
Usage
llPlot(x, distr=c("db","betabinom"),ntop, zeta, size, alim = NULL, blim = NULL,
ngrid = c(100, 100), plotType = c("persp", "contour", "none"),
theta = -30, phi = 40, ...)
Arguments
x |
A vector of numeric data purportedly arising from a db or beta binomial distribution. |
distr |
Character string specifying which of the two relevant distributions (db, or beta binomial) is to be considered. |
ntop |
|
zeta |
|
size |
Integer scalar specifying the upper limit of the “support”
of the beta binomial distribution under consideration. The support
is the set of integers |
alim |
Numeric vector of length 2; the range of |
blim |
Numeric vector of length 2; the range of |
ngrid |
The dimensions of the grid of paramter values at
which the log likelihood is to be evaluated in order to plot
the surface. Note that |
plotType |
Character string specifying the nature of the plot to be
produced. If it is |
theta |
An argument to be passed to |
phi |
An argument to be passed to |
... |
Other arguments that may be passed to |
Details
This function could conceivably be useful in diagnosing problems with parameter estimation should these arise.
Value
A list with entries
x |
The vector of values of the first parameter ( |
y |
The vector of values of the second parameter ( |
z |
An |
dxy |
A data frame with columns named |
fxy |
A numeric vector of length |
There is obviously considerable redundancy in the returned value.
The names x and y that are used for the first two
entries of this list conform to the names of the
arguments of persp() and contour.
If plotType is "persp" or "contour" the
value is returned invisibly.
Author(s)
Rolf Turner r.turner@auckland.ac.nz
See Also
link{mleDb}()
link{mleBb}()
link{persp}()
link{contour}()
Examples
X <- hmm.discnp::SydColDisc
X$y <- as.numeric(X$y)
X <- split(X,f=with(X,interaction(locn,depth)))
x <- X[[19]]$y
srf <- llPlot(x,ntop=5,zeta=FALSE,alim=c(0.5,0.7),blim=c(0.2,0.4),plotType="c")
## Not run:
if(require(rgl)) {
with(srf,plot3d(ab$alpha,ab$beta,fab)
# Allows dynamic rotation of the surface.
}
## End(Not run)
# Negative (!) parameters for the db distribution.
set.seed(42)
xs <- rdb(100,-1,-1,5)
fit <- mleDb(xs,5)
llPlot(xs,ntop=5,zeta=FALSE,alim=c(-4,2),blim=c(-4,2),plotType="c",
main="log likelihood contours")
points(fit[1],fit[2],pch=20,col="red")
points(-1,-1,pch=20,col="blue")
legend("topright",pch=20,col=c("red","blue"),
legend=c("estimate","true value"),bty="n")