if (Infusion.getOption("example_maxtime")>2) {
myrnorm <- function(mu,s2,sample.size=40L) {
s <- rnorm(n=sample.size,mean=mu,sd=sqrt(s2))
return(c(mean=mean(s),var=var(s)))
} # simulate means and variances of normal samples of size 'sample.size'
set.seed(123)
# simulated data with stands for the actual data to be analyzed:
Sobs <- myrnorm(mu=4,s2=1)
# Uniform sampling in parameter space:
parsp <- init_reftable(lower=c(mu=2.8,s2=0.4),
upper=c(mu=5.2,s2=2.4))
# Build simulation table:
simuls <- add_reftable(Simulate="myrnorm", parsTable=parsp)
# Infer surface:
densv <- infer_SLik_joint(simuls,stat.obs=Sobs)
# Usual workflow using inferred surface:
slik_j <- MSL(densv, eval_RMSEs=FALSE) ## find the maximum of the log-likelihood surface
slik_j <- refine(slik_j, eval_RMSEs=FALSE)
plot(slik_j)
# etc:
profile(slik_j,c(mu=4)) ## profile summary logL for given parameter value
confint(slik_j,"mu") ## compute 1D confidence interval for given parameter
plot1Dprof(slik_j,pars="s2",gridSteps=40) ## 1D profile
# See also help for 'constr_crits'
}
Run the code above in your browser using DataLab