rwp: Calculate the Rwp value for a fitted pattern

Description Usage Arguments Value References Examples

View source: R/objective_functions.R

Description

rwp computes the difference between a measured and fitted pattern. See equation for Rwp in section 2.1 of Butler and Hillier (2021).

Usage

1
rwp(measured, fitted, weighting)

Arguments

measured

a vector of count intensities for a measured pattern

fitted

a vector of count intensities for a fitted pattern

weighting

an optional weighting vector of the same length as those specified in measured and fitted, which specifies areas of the pattern to either emphasise (values > 1) or omit (values = 0) from the calculation. Use with caution. Default is simply a weighting vector where all values are 1, which hence has no effect on the computed value.

Value

a single numeric value

References

Butler, B.M., Hillier, S., 2021. powdR: An R package for quantitative mineralogy using full pattern summation of X-ray powder diffraction data. Computers and Geosciences. 147, 104662. doi:10.1016/j.cageo.2020.104662

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Load soils xrd data
data(soils)

#Load minerals library
data(minerals)

## Not run: 
#Produce a fit
fps_sand <-  fps(lib = minerals,
                 smpl = soils$sandstone,
                 refs = minerals$phases$phase_id,
                 std = "QUA.1",
                 align = 0.2)

rwp(measured = fps_sand$measured,
    fitted = fps_sand$fitted)


## End(Not run)

powdR documentation built on Aug. 13, 2021, 5:08 p.m.