plot1Dprof  R Documentation 
These functions plot 1D and 2D profiles from a summarylikelihood object.
High quality 2D plots may be slow to compute, and there may be many of them in highdimensional parameter spaces, so parallelization of the computation of each profile point has been implemented for them. Usual caveats apply: there is an time cost of launching processes on a cluster, particularly on socket clusters, possibly offsetting the benefits of parallelization when each profile point is fast to evaluate. Further, summarylikelihood objects are typically big (memorywise), which may constrain the number of concurrent processes.
plot1Dprof(object, pars=object$colTypes$fittedPars, type="logLR",
gridSteps=21, xlabs=list(), ylab, scales=NULL,
plotpar=list(pch=20),
control=list(min=7.568353, shadow_col="grey70"),
decorations = function(par) NULL, ...)
plot2Dprof(object, pars=object$colTypes$fittedPars, type="logLR",
gridSteps=17, xylabs=list(), main, scales=NULL,
plotpar=list(pch=20), margefrac = 0,
decorations = function(par1,par2) NULL,
filled.contour.fn = "spaMM.filled.contour",
cluster_args=NULL, ... )
object 
An 
pars 
Control of parameters for which profiles will be computed. If 
type 
Character: 
gridSteps 
The number of values (in each dimension for 2D plots) which likelihood should be computed. For 1D plots,

xlabs 
A list of alternative axis labels. The names of the list elements should be elements of 
xylabs 
Same as 
ylab 
Same as 
main 
Same as 
scales 
A named character vector, which controls ticks and tick labels on axes, so that these can be expressed as (say) the exponential of the parameter inferred in the SLik object.
For example if the likelihood of 
plotpar 
Arguments for 
control 
Control of 
decorations 
A function with formals parameters as shown by the default (being parameters names represented as character strings), implementing graphic directives added to the plot. 
margefrac 
For development purposes, not documented. 
filled.contour.fn 
Name of a possible alternative to 
cluster_args 
NULL, or a list in which case a cluster may be created and used. The list elements must match the arguments 
... 
Further arguments passed by another function. Currently these arguments are ignored. 
In the 2D case, the pars
may be specified as a twocolumn natrix, in which case profiles are generated for all pairs of distinct parameters specified by rows of the matrix. It may also be specified as a twoelement list, where each element is a vector of parameter names. In that case, profiles are generated for all pairs of distinct parameters combining one element of each vector.
A "zoom"
plot shows only the top part of the profile, defined as points whose yvalues are above a threshold minusloglikelihood ratio control$min
, whose default is 7.568353, the 0.9999 pvalue threshold.
A "dual"
plot displays both the zoom, and a shadow graph showing the full profile. The dual plot is shown only when requested and if there are values above and below control$min
. The shadow curve color is given by control$shadow_col
.
Both functions return a list, which currently has a single element MSL_updated
which is a boolean indicating whether the summarylikelihood maximum (but not the intervals) has been recomputed.
if (Infusion.getOption("example_maxtime")>20) {
#### Toy bivariate gaussian model, three parameters, no projections
#
myrnorm2 < function(mu1,mu2,s2,sample.size) {
sam1 < rnorm(n=sample.size,mean=mu1,sd=sqrt(s2))
sam2 < rnorm(n=sample.size,mean=mu2,sd=sqrt(s2))
s < c(sam1,sam2)
e_mu < mean(s)
e_s2 < var(s)
c(mean=e_mu,var=e_s2,kurt=sum((se_mu)^4)/e_s2^2)
}
#
## pseudosample, standing for the actual data to be analyzed:
set.seed(123)
Sobs < myrnorm2(mu1=4,mu2=2,s2=1,sample.size=40) ##
#
## build reference table
parsp < init_reftable(lower=c(mu1=2.8,mu2=1,s2=0.2),
upper=c(mu1=5.2,mu2=3,s2=3),
nUnique=600)
parsp < cbind(parsp,sample.size=40)
simuls < add_reftable(Simulate="myrnorm2",par.grid=parsp)
## Inferring the summarylikelihood surface...
densv < infer_SLik_joint(simuls,stat.obs=Sobs)
slik_j < MSL(densv) ## find the maximum of the loglikelihood surface
## plots
plot2Dprof(slik_j,gridSteps=21,
## alternative syntaxes for nondefault 'pars':
# pars = c("mu1","mu2"), # => all combinations of given elements
# pars = list("s2",c("mu1","mu2")), # => combinations via expand.grid()
# pars = matrix(c("mu1","mu2","s2","mu1"), ncol=2), # => each row of matrix
xylabs=list(
mu1=expression(paste(mu[1])),
mu2=expression(paste(mu[2])),
s2=expression(paste(sigma^2))
))
# One could also add (e.g.)
# cluster_args=list(spec=4, type="FORK"),
# when longer computations are requested.
}
if (Infusion.getOption("example_maxtime")>40) {
#### Older example with primitive workflow
data(densv)
slik < infer_surface(densv) ## infer a loglikelihood surface
slik < MSL(slik) ## find the maximum of the loglikelihood surface
plot1Dprof(slik,pars="s2",gridSteps=40,xlabs=list(s2=expression(paste(sigma^2))))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.