# Working with PARAFAC results

#### Philippe Massicotte

#### 2016-08-25

## Plotting PARAFAC model with

The MATLAB toolbox (Murphy et al. 2013) offers a convenient way to create PARAFAC model. However, creating publication reading figures from the generated model can be challenging. The package offers two different methods to plot results from a PARAFAC model created with the MATLAB toolbox. To have access to the different plotting function, one should first open a PARAFAC model contained in a mat file using the `eem_read_parafac()` function as follows:

    library(ggplot2)
    library(eemR)

    # Mat file containing the PARAFAC model
    f <- system.file("extdata/parafac_model.mat", package = "eemR")

    # Read the PARAFAC model that contains "mymodel". We also specify that we want the model with 4 components
    m <- eem_read_parafac(f, object = "mymodel", ncomp = 4)

## Plotting component loadings

    p <- plot(m, ncol = 2, nrow = 2)
    p

## Extracting FMax

It can be usefull to extract FMax values from the PARAFAC model to do further stastistical analysis in R.

## References

Murphy, Kathleen R., Colin a. Stedmon, Daniel Graeber, and Rasmus Bro. 2013. “Fluorescence spectroscopy and multi-way techniques. PARAFAC.” Analytical Methods 5 (23): 6557. doi:10.1039/c3ay41160e.