do.fit: Estimate background

Description Usage Arguments Details Value References

View source: R/fits.R

Description

do.fit estimates the background using the Bayesian approach and Differential Evolution algorithm.

Usage

1
2
3
do.fit(data, bounds.lower, bounds.upper, scale=c(1,1), knots.x=NA,
       knots.n=NA, analytical=FALSE, stdev=TRUE, control=list(), p.bkg=.5,
	   save.to="")

Arguments

data

an object of type data. See set.data for details.

bounds.lower, bounds.upper

numerics specifying the lower and upper bounds for the fitted spline values.

scale

numeric vector which, if applicable, determines the bounds for the fitted scale parameter. The default value of c(1,1) means a no-scale fit. See details.

knots.x

numeric vector which, if not NA, specifies the knot positions.

knots.n

numeric, the number of knots. If knots.x is NA then knots.n equidistant knots will be created.

analytical

logical. If TRUE background is approximated by an analytical function f(x)=P_1\exp(-P_2x)x^{P_3} + P_4/[(x-P_5)^2+P_6^2].

stdev

logical, whether to calculate the uncertainty for the estimated background. Should be set to FALSE if analytical=TRUE.

control

list, the return value of set.control. Specifies various parameters of the Differential Evolution optimization algorithm implemented in DEoptim.

p.bkg

numeric, the probability that a single pixel contains "only" a background.

save.to

character, a filename for saving the results.

Details

If information on the low-r behavior of G(r) is provided, the global intensity scale and atomic displacement parameters can be fitted along with the positions of the knots, (set.Gr). To fit normalization parameter set bounds in scale for the desired values. To fit Atomic Displacement Parameters see set.SB.

In most cases p.bkg should be set to its default value 0.5.

For further details see BBEST-package.

Value

A list with elements:

x

numeric vector of grid points

curves

list, see below.

uncrt

list, see below.

knots

list with elements x and y that specify the positions of the knots and the corresponding fitted intensity values, respectively.

pars

numeric vector. If the background is approximated using the analytical function, contains all the relevant parameters P.

scale

fitted value of the scale parameter, if used.

ADP

fitted values of the atomic displacement parameters, if applicable.

fit.details

list, see below.

Element curves is a list with sub-elements:

y

numeric vector of the (normalized) function values.

bkg

numeric vector, the estimated background.

SB

numeric vector, the (fitted) coherent baseline.

Element uncrt is a list with sub-elements:

stdev

numeric vector, indicates estimated standard deviations for the reconstructed signal.

stdev.r

numeric vector, indicates estimated standard deviations for a reconstructed signal in r-space.

hess

Hessian matrix for a ψ(c) function.

cov.matrix

covariance matrix, i.e. the inverse of the Hessian.

cov.matrix.r

covariance matrix in r-space.

Element fit.details is a list with sub-elements:

lambda

numeric vector, the estimated mean magnitude of the signal.

sigma

numeric vector, the estimated Gaussian noise.

knots.n

the number of knots used in the fit.

knots.x

knot positions used in the fit.

control

see the control argument.

Gr

list contacting information on the low-r behaviour of G(r) . See set.Gr for details.

n.atoms

numeric vector, number of different atoms per unit cell.

scatter.length

numeric vector, atomic scattering factors.

References

Ardia, D., Mullen, K., Peterson, B. & Ulrich, J. (2011): DEoptim. R Package Version 2.2-2. https://CRAN.R-project.org/package=DEoptim.

Mullen, K.M., Ardia, D., Gil, D., Windover, D., Cline, J. (2011): DEoptim: An R Package for Global Optimization by Differential Evolution. J. Stat. Softw., 40(6), 1-26. https://www.jstatsoft.org/article/view/v040i06.


BBEST documentation built on Jan. 8, 2021, 2:22 a.m.