| fps_lm.powdRlib {powdR} | R Documentation | 
Full pattern summation using linear regression
Description
fps_lm.powdRlib returns a simple fit of a given pattern using linear regression,
where coefficients may be either positive or negative. Does not return quantitative
data. For quantitative results use fps or afps.
Usage
## S3 method for class 'powdRlib'
fps_lm(
  lib,
  smpl,
  harmonise,
  refs,
  std,
  tth_align,
  align,
  manual_align,
  tth_fps,
  shift,
  p,
  ...
)
Arguments
| lib | A  | 
| smpl | A data frame. First column is 2theta, second column is counts | 
| harmonise | logical parameter defining whether to harmonise the  | 
| refs | A character string of reference pattern IDs or names from the specified library.
The IDs or names supplied must be present within the  | 
| std | The phase ID (e.g. "QUA.1") to be used as internal
standard. Must match an ID provided in the  | 
| tth_align | A vector defining the minimum and maximum 2theta values to be used during
alignment (e.g.  | 
| align | The maximum shift that is allowed during initial 2theta alignment (degrees). Default = 0.1. | 
| manual_align | A logical operator denoting whether to optimise the alignment within the
negative/position 2theta range defined in the  | 
| tth_fps | A vector defining the minimum and maximum 2theta values to be used during
full pattern summation (e.g.  | 
| shift | A single numeric value denoting the maximum (positive or negative) shift, in degrees 2theta, that is allowed during the shifting of selected phases. Default = 0. | 
| p | a numeric parameter between 0 and 1 specifying the p-value limit for coefficients. Any reference patterns with a p-value greater than this value will be omitted from the linear regression and results recomputed. Must be greater than 0.000001 but no greater than 1. | 
| ... | Other arguments | 
Details
Requires a powdRlib library of reference patterns. Mineral concentrations
are not quantified and therefore reference intensity ratios are not required.
Value
a powdRlm object with components:
| tth | a vector of the 2theta scale of the fitted data | 
| fitted | a vector of the count intensities of the fitted XRPD pattern | 
| measured | a vector of the original count intensities of the XRPD measurement (aligned) | 
| residuals | a vector of the residuals (fitted vs measured) | 
| phases | a dataframe of the phases used to produce the fitted pattern and their concentrations | 
| phases_grouped | the phases dataframe grouped by phase_name and concentrations summed | 
| weighted_pure_patterns | a dataframe of reference patterns used to produce the fitted pattern. All patterns have been weighted according to the coefficients used in the fit | 
| coefficients | a named vector of coefficients used to produce the fitted pattern | 
| inputs | a list of input arguments used in the function call | 
Examples
data(rockjock)
data(rockjock_mixtures)
#Compute the PCA and loadings
x1 <- xrpd_pca(rockjock_mixtures,
               mean_center = TRUE,
               bin_size = 1,
               root_transform = 1)
## Not run: 
fps_lm_out <- fps_lm(rockjock,
                     smpl = data.frame("x" = x1$loadings$tth,
                                       "y" = x1$loadings$Dim.1),
                     refs = rockjock$phases$phase_id,
                     std = "QUARTZ",
                     align = 0.3,
                     p = 0.01)
plot(fps_lm_out,
     wavelength = "Cu",
     interactive = TRUE,
     group = TRUE)
## End(Not run)