# NOT RUN {
data(correlatormatrix)
## bootstrap the correlator matrix
correlatormatrix <- bootstrap.cf(correlatormatrix, boot.R=99, boot.l=1, seed=132435)
## solve the GEVP
t0 <- 4
correlatormatrix.gevp <- bootstrap.gevp(cf=correlatormatrix, t0=t0, element.order=c(1,2,3,4))
## extract the ground state and plot
pc1 <- gevp2cf(gevp=correlatormatrix.gevp, id=1)
plot(pc1, log="y")
## determine the corresponding effective masses
pc1.effectivemass <- bootstrap.effectivemass(cf=pc1)
pc1.effectivemass <- fit.effectivemass(cf=pc1.effectivemass, t1=5, t2=20)
## summary and plot
summary(pc1.effectivemass)
plot(pc1.effectivemass)
## we can also use matrixfit with a special model for a principal
## correlators
pc1.matrixfit <- matrixfit(pc1, t1=2, t2=24, fit.method="lm", model="pc", useCov=FALSE,
parlist=array(c(1,1), dim=c(2,1)), sym.vec=c("cosh"), neg.vec=c(1))
summary(pc1.matrixfit)
plot(pc1.matrixfit)
## the same can be achieved using bootstrap.nlsfit
model <- function(par, x, t0, ...) {
return(exp(-par[1]*(x-t0))*(par[3]+(1-par[3])*exp(-par[2]*(x-t0))))
}
ii <- c(2:4, 6:25)
fitres <- parametric.nlsfit(fn=model, par.guess=c(0.5, 1, .9),
y=pc1$cf0[ii], dy=pc1$tsboot.se[ii],
x=ii-1, boot.R=pc1$boot.R, t0=t0)
summary(fitres)
plot(fitres, log="y")
# }
Run the code above in your browser using DataLab