Multiple Linear Least Squares
You can use the multiple linear least-squares (MLLS) method to fit a number of reference spectra and/or models to a spectrum. The reference spectra can be fitted as a linear combination.
where
- = Reference models
- = Scaling coefficients

Common uses for MLLS
MLLS fitting is commonly used for the following applications:
- Separation of overlapping EELS edges – Extracts edge signals when conventional background removal is insufficient.
- Spectral phase mapping – Maps out the spatial distribution of a specific spectral shape, such as energy dispersive x-ray spectroscopy (EDS) or EELS low-loss distribution.
- Energy-loss near-edge structure (ELNES) fingerprinting – Uses reference spectra to determine the spatial distribution of chemical states associated with an ionization edge.
- Anisotropic studies – Enables orientation‑ and coordination‑dependent mapping.
Tool overview
The Least‑Squares Fitting palette in the DigitalMicrograph® 3 software provides tools for setting up and performing both:
- Multiple linear least‑squares fitting, and
- Non‑linear least‑squares (NLLS) fitting.

The palette includes controls to:
- Select the fitting type (MLLS or NLLS)
- Open the least‑squares fitting preferences dialog
- Add references from the front‑most spectrum or from any open dataset
- Add NLLS fit models
- Overlay references in a new DigitalMicrograph line plot
- Rename, reorder, or remove references
- Show or hide the 1D live fit overlay
- Generate least‑squares fit maps using current parameters
- Load or save reference lists
- Clear the reference list
Select MLLS or NLLS using the corresponding buttons in the palette to enable the desired fitting mode.
MLLS Fitting Preferences
The MLLS Fitting Preferences dialog contains parameters specific to configuring and executing MLLS fitting.
Fit Settings
- Use fit weights computed from data – Specifies the weighting scheme used to determine the least‑squares fit parameters.
- No negative coefficients – Constrains all fit coefficients to be non‑negative.
(This option is available only when Use fit weights is disabled.) - Live display – Controls the output shown for the 1D live fit, including:
- Total fit
- Residual (misfit) signal
- Individual fits
- Cumulative model display
- Limit display to fit range
- Output fit as – Determines whether results are reported as fit coefficients or signal integrals.

Additional output options
- Fit uncertainties – Outputs uncertainty maps for the fit coefficients.
(Available only when Use fit weights is enabled.) - Reduced chi‑squared – Outputs the reduced chi‑squared value as a measure of goodness of fit.
Performing an MLLS fit
To perform an MLLS fit on spectra or models over a specific energy range (for example, overlapping edges or superimposed fine structure):
- Select the dataset to be analyzed.
- Use the rectangular ROI tool to define the energy range for fitting.
- If fitting background and ionization edges separately, define an appropriate background fit region before proceeding.

MLLS internal references
Internal references are extracted directly from the dataset being analyzed.
- Ensure MLLS is selected in the Least‑Squares Fitting palette.
- Select the internal reference option (C from Figure 2, above).

- Select both the background and edge regions as references and click OK.
- The background reference is automatically named Bkgd.
- Assign a descriptive name to the edge reference.

- The references appear in an ordered list in the fitting palette.
- Enable 1D Fit to overlay the live fit and assess fit quality.

Assess fit quality
- A good fit is indicated by:
- Close agreement between the total fit and raw data
- Low residuals with no strong features

- A poor fit is indicated by:
- Mismatch between fit and data
- Large residuals with pronounced features
Add additional references as needed, using the live fit as a guide.

Generating MLLS fit maps

When you are satisfied with the reference list:
- Click Map to open the MLLS output options dialog.
- Configure output options:
- Display maps as fit coefficient or signal integral
- Hide background maps (optional)
- Generate additional outputs such as:
- Reduced chi‑squared maps
- Residual signal
- Fit uncertainties
- Click OK to start the computation.

MLLS fitting is performed pixel‑by‑pixel, using the specified fit regions and parameters derived from the exploration spectrum.

MLLS external references
External references are spectra or models loaded from other datasets.
Workflow
- Ensure MLLS is selected in the Least‑Squares Fitting palette.
- Select the external reference option (D from Figure 2, at top).
- Choose the reference spectra and click OK.

- Rename references as needed and arrange them in the desired order.
- Assess fit quality using the 1D live fit.

- If the total fit closely matches the raw data and the residual is low with no pronounced features, the fit quality is good and no additional references are required.

- If the total fit does not match the data and the residual is large or contains strong features, the fit quality is poor and additional references are needed.

- Add or refine references as necessary, using the live fit overlay as a guide.
- When you are satisfied with the reference list, select Map to open the MLLS fit options dialog.
- Configure the desired output options (see the previous section), then click OK to generate optimized fitting maps in a new workspace.

