bayesian analysis user guide

113
Bayesian Analysis User Guide Bayes Analysis Software Package, Version 1.0 Pub. No. 01-999017-00, Rev. B0498

Upload: others

Post on 25-Oct-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Bayesian Analysis User Guide

BayesianAnalysis

User GuideBayes Analysis Software Package,

Version 1.0Pub. No. 01-999017-00, Rev. B0498

ds
Temporary Errata
Page 2: Bayesian Analysis User Guide

Bayesian Analysis User GuideBayes Analysis Software Package, Version 1.0Pub. No. 01-999017-00, Rev. B0498

Author: G. Larry Bretthorst Ph.D.

Technical writers: Michael Carlisle, Dan SteeleTechnical editor: James Welch

Revision history:Rev. A0197 – Initial release as part number 87-190172-00Rev. A0498 – Initial release as part number 01-999017-00Rev. B0498 – Reformatted, index added

Applicability of manual:Bayes Analysis Software Package, Version 1.0with Varian VNMR software

Copyright1997–1998 by Varian, Inc.3120 Hansen Way, Palo Alto, California 94304http://www.varianinc.comAll rights reserved. Printed in the United States.

The information in this document has been carefully checked and is believed to beentirely reliable. However, no responsibility is assumed for inaccuracies. Statements inthis document are not intended to create any warranty, expressed or implied.Specifications and performance characteristics of the software described in this manualmay be changed at any time without notice. Varian reserves the right to make changes inany products herein to improve reliability, function, or design. Varian does not assumeany liability arising out of the application or use of any product or circuit describedherein; neither does it convey any license under its patent rights nor the rights of others.Inclusion in this document does not imply that any particular feature is standard on theinstrument.

UNITYINOVA, MERCURY, Gemini,GEMINI 2000, UNITYplus, UNITY, VXR, XL, VNMR,VnmrS, VnmrX, VnmrI, VnmrV, VnmrSGI, MAGICAL II, AutoLock, AutoShim,AutoPhase, limNET, ASM, and SMS are registered trademarks or trademarks of Varian,Inc. Sun, Solaris, CDE, Suninstall, Ultra, SPARC, SPARCstation, SunCD, and NFS areregistered trademarks or trademarks of Sun Microsystems, Inc. and SPARCInternational. Oxford is a registered trademark of Oxford Instruments LTD. Ethernet isa registered trademark of Xerox Corporation. VxWORKS and VxWORKS POWEREDare registered trademarks of WindRiver Inc. Other product names in this document areregistered trademarks or trademarks of their respective holders.

Page 3: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 3

Overview of Contents

About This Manual .......................................................................................... 11

Chapter 1. Introduction .................................................................................. 13

Chapter 2. Interface to VNMR: Menus .......................................................... 31

Chapter 3. Bayesian Analysis Programs ...................................................... 63

Chapter 4. Output Files .................................................................................. 69

Chapter 5. Common Problems ...................................................................... 97

Appendix A. Error Messages ........................................................................ 101

Appendix B. Software Installation ................................................................ 105

Bibliography .................................................................................................. 107

Index ............................................................................................................... 109

Page 4: Bayesian Analysis User Guide

4 Bayesian Analysis Software Package 01-999017-00 B0498

Page 5: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 5

Table of Contents

About This Manual .......................................................................................... 11

Chapter 1. Introduction .................................................................................. 131.1 Bayes_Analyze Program ............................................................................................ 13

1.2 Getting Started ........................................................................................................... 14Beginning an Analysis ..................................................................................... 15Performing an Analysis ................................................................................... 16

1.3 A General Overview .................................................................................................. 22Probability Theory as Logic ............................................................................ 22Parameter Files ................................................................................................ 22Running an Analysis ........................................................................................ 23Modeling the Results ....................................................................................... 23Changing the Model ........................................................................................ 24Probabilities File .............................................................................................. 24Default Settings ............................................................................................... 25

1.4 Model Equation .......................................................................................................... 25

Chapter 2. Interface to VNMR: Menus .......................................................... 312.1 Bayes Menu ............................................................................................................... 31

2.2 Bayes_Analysis Menu ............................................................................................... 32Bayes_Setup_Ana Menu ................................................................................. 33

Bayes_Initial_Model Menu ........................................................................... 34Bayes_Mark Menu ............................................................................. 35Mark Menu ......................................................................................... 36Bayes_Primary_Pattern Menu ............................................................ 37Bayes_Secondary_Pattern Menu ........................................................ 40Bayes_Find Menu ............................................................................... 40Find-Interactive Menu ........................................................................ 41

Bayes_Data_Params Menu ........................................................................... 43Data_Setup_Signal Menu ................................................................... 44Data_Setup_Filter Menu .................................................................... 45Bayes_Noise Menu ............................................................................. 47

Bayes_Model_Params Menu ......................................................................... 47Bayes_Constants Menu ...................................................................... 49Bayes_Phase Menu ............................................................................. 50Bayes_Lineshape Menu ...................................................................... 51

Bayes_Execution Menu ................................................................................... 52Bayes_Batch_Mode Menu ............................................................................ 54

2.3 Bayes_Results Menu .................................................................................................. 54Bayes_Reports Menu ....................................................................................... 55Bayes_Setup_Mod Menu ................................................................................ 56

2.4 File-Transfers Menu ................................................................................................... 56

2.5 Bayes_Display Menu ................................................................................................. 57

Page 6: Bayesian Analysis User Guide

Table of Contents

6 Bayesian Analysis Software Package 01-999017-00 B0498

Chapter 3. Bayesian Analysis Programs ...................................................... 633.1 Bayes_Analyze Program ............................................................................................ 63

3.2 Bayes_Model Program ............................................................................................... 66

3.3 Bayes_Noise Program ................................................................................................ 67

3.4 Bayes_Probs Program ................................................................................................ 68

3.5 Bayes_Summary Programs ........................................................................................ 68

Chapter 4. Output Files .................................................................................. 694.1 Status Display ............................................................................................................ 70

4.2 bayes.status.nnnn File ................................................................................... 73

4.3 bayes.params.nnnn andbayes.model.nnnn Files .................................... 74Bayes_Analyze File Header ............................................................................ 74Global Parameters ............................................................................................ 81Model Components ......................................................................................... 82bayes.model.nnnn File ........................................................................... 83

4.4 bayes.log.nnnn File ........................................................................................... 84

4.5 bayes.output.nnnn File ................................................................................... 87

4.6 bayes.summaryl.nnnn File ............................................................................... 92

4.7 bayes.summary2.nnnn File ............................................................................... 93

4.8 bayes.probabilities.nnnn File ................................................................... 93

Chapter 5. Common Problems ...................................................................... 97

Appendix A. Error Messages ....................................................................... 101

Appendix B. Software Installation ............................................................... 105

Bibliography .................................................................................................. 107

Index ............................................................................................................... 109

Page 7: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 7

List of Figures

Figure 1. Ethyl Ether Spectrum ...................................................................................................... 15

Figure 2. Full Ethyl Ether Spectrum............................................................................................... 19

Figure 3. Over Display ................................................................................................................... 20

Figure 4. Over Display Using a Triplet and Quartet Model ........................................................... 21

Figure 5. Step 1: Marking the Center of a Multiplet ...................................................................... 38

Figure 6. Step 2: Marking the PrimaryJ Coupling ........................................................................ 38

Figure 7. Step 3: Marking the SecondaryJ Coupling .................................................................... 39

Figure 8. Step 4: Display after Marking the Multiplet Correctly ................................................... 39

Figure 9. Finding Singlets: Setting the Region and Threshold....................................................... 42

Figure 10. Finding Singlets: Using thefind Button ....................................................................... 42

Figure 11. Selecting a Signal Region ............................................................................................. 45

Figure 12. Setting the Signal Region.............................................................................................. 46

Figure 13. Setting thelb Parameter............................................................................................... 46

Figure 14. Setting a Noise Region.................................................................................................. 48

Figure 15. Expanding the Noise Region......................................................................................... 48

Figure 16. Seventh-Order Shimming Example............................................................................... 53

Figure 17. Over Display for31P FID.............................................................................................. 58

Figure 18. Vertical Display for31P FID ......................................................................................... 59

Figure 19. Over2 Display of31P FID ............................................................................................. 60

Figure 20. Stacked Vertical Display of Modeled FID .................................................................... 60

Figure 21. FIDs Display ................................................................................................................. 61

Figure 22. FIDs3 Display ............................................................................................................... 61

Figure 23. Status Display................................................................................................................ 70

Figure 24.bayes.status.nnnn File....................................................................................... 73

Figure 25.bayes.params.nnnn File....................................................................................... 75

Figure 26. ASCII Input FID Files................................................................................................... 76

Figure 27. ASCII Input Parameter Files ......................................................................................... 77

Figure 28.bayes.noise File ..................................................................................................... 78

Figure 29. Global Parameters ......................................................................................................... 81

Figure 30. Model Components ....................................................................................................... 83

Figure 31.bayes.model.nnnn File ......................................................................................... 83

Figure 32. Uncorrelated Phase Amplitudes .................................................................................... 84

Figure 33.bayes.log.nnnn File .............................................................................................. 85

Figure 34. Initial Model.................................................................................................................. 88

Figure 35. Signal Detection ............................................................................................................ 88

Figure 36. Output Report................................................................................................................ 89

Figure 37. Output Global Parameters ............................................................................................. 90

Figure 38. Uncorrelated Output...................................................................................................... 90

Figure 39. Summary Report Header............................................................................................... 92

Figure 40. Summary2 Report ......................................................................................................... 94

Page 8: Bayesian Analysis User Guide

List of Figures

8 Bayesian Analysis Software Package 01-999017-00 B0498

Figure 41.bayes.probabilities.nnnn File ...................................................................... 94

List of Tables

Table 1. Pascal’s Triangle ............................................................................................................... 40

Table 2. Model Names. ................................................................................................................... 79

Table 3. Short Description .............................................................................................................. 86

Page 9: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 9

List of Menus

Menu 1. Bayes Menu ..................................................................................................................... 15

Menu 2. Bayes_Analysis Menu ..................................................................................................... 16

Menu 3. Bayes_Setup_Ana Menu ................................................................................................. 16

Menu 4. Bayes_Model_Params Menu ........................................................................................... 17

Menu 5. Bayes_Execution Menu ................................................................................................... 17

Menu 6. Bayes_Results Menu ....................................................................................................... 18

Menu 7. Bayes_Display Menu ...................................................................................................... 19

Menu 8. Bayes Menu ..................................................................................................................... 31

Menu 9. Bayes_Analysis Menu ..................................................................................................... 32

Menu 10. Bayes_Setup_Ana Menu ............................................................................................... 33

Menu 11. Bayes_Initial_Model Menu ........................................................................................... 34

Menu 12. Bayes_Mark Menu ........................................................................................................ 35

Menu 13. Mark Menu .................................................................................................................... 36

Menu 14. Bayes_Primary_Pattern Menu ....................................................................................... 37

Menu 15. Bayes_Secondary_Pattern Menu ................................................................................... 40

Menu 16. Bayes_Find Menu .......................................................................................................... 41

Menu 17. Bayes_Data_Params Menu ............................................................................................ 43

Menu 18. Bayes_Noise Menu ........................................................................................................ 47

Menu 19. Bayes_Model_Params Menu ......................................................................................... 47

Menu 20. Bayes_Constants Menu ................................................................................................. 49

Menu 21. Bayes_Phase Menu ........................................................................................................ 50

Menu 22. Bayes_Lineshape Menu ................................................................................................ 52

Menu 23. Bayes_Execution Menu ................................................................................................. 52

Menu 24. Bayes_Batch_Mode Menu ............................................................................................ 54

Menu 25. Bayes_Results Menu ..................................................................................................... 54

Menu 26. Bayes_Reports Menu .................................................................................................... 55

Menu 27. Bayes_Setup_Mod Menu .............................................................................................. 56

Menu 28. Bayes_Display Menu .................................................................................................... 57

Menu 29. Bayes_Display2 Menu .................................................................................................. 57

Page 10: Bayesian Analysis User Guide

10 Bayesian Analysis Software Package 01-999017-00 B0498

Page 11: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 11

About This Manual

This Bayesian Analysis software manual contains the following chapters and appendices:

• Chapter 1, “Getting Started,” gives a point-and-click example of how to run ananalysis, provides a general overview of the package, and defines exactly what is meantby a resonance.

• Chapter 2, “Interface to VNMR, The Menus,” describes the menus that make up theinterface to VNMR. Here, you are shown how to use the menus to implement variousfeatures of the package, including analyzing multiple FIDs, allowing for an estimateof the noise level, and estimating the coupling constants for multiplets.

• Chapter 3, “Bayesian Analysis Programs,” looks at the programs that make up thepackage. In addition to describing how the programs work, this chapter also explainshow to run them manually.

• Chapter 4, “Output Files,” describes the contents of each file, report, and display usedby the system.

• Chapter 5, “Common Problems,” itemizes a number of common problems and explainshow to fix them.

• Appendix A, “Error Messages,” lists the messages issued by the system and describeswhat actions are necessary to fix them.

• Appendix B, “Software Installation Guide,” gives instructions on installing theBayesian Analysis software package on Sun, SGI, and IBM systems.

• The bibliography for the entire manual appears after Appendix B.

Notational ConventionsThe following notational conventions are used throughout all VNMR manuals:

• Typewriter-like character s identify VNMR and UNIX commands,parameters, directories, and file names in the text of the manual, e.g.:

Theshutdown command is in the/etc directory.

• Typewriter-like character s also show text displayed on the screen,including the text echoed on the screen as you enter commands, e.g.:

Self test completed successfully.

• Names of buttons are shown in bold type, e.g., thestatus button.

• Lines of text containing command syntax, examples of statements, source code, andsimilar material are often too long to fit the width of the page. To show that a line oftext had to be broken to fit into the manual, the line is cut at a convenient point (suchas at a comma near the right edge of the column), a backslash (\ ) is inserted at the cut,and the line is continued as the next line of text. This notation will be familiar to Cprogrammers. Note that the backslash is not part of the line and, except for C sourcecode, should not be typed when entering the line.

• Because pressing the Return key is required at the end of almost every command orline of text you type on the keyboard, use of the Return key will be mentioned only incases where it isnotused. This convention avoids repeating the instruction “press theReturn key” throughout most of this manual.

Page 12: Bayesian Analysis User Guide

12 Bayesian Analysis Software Package 01-999017-00 B0498

Page 13: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 13

Chapter 1. Introduction

The Bayesian Analysis package that has been incorporated into VNMR analyzes one-dimensional and one-dimensional arrayed FIDs (free inductions decays) using Bayesianprobability theory [1]. The package is an implementation of the procedures described in [2,3, 4, 5, 6]. These articles and books describe in detail the types of calculations that must bedone using probability theory to detect the presence of resonances, estimate the associatedparameters, and determine the number of resonances in the FIDs. For a tutorial onparameter estimation see [7], and for a tutorial on model selection see [8]. For a fullexposition of the theory see [9, 10]. Finally, for a comparison of Bayesian and Fouriertechniques see [11, 12].

The Bayesian Analysis package contains two main programs: the modeling program,Bayes_Model, and the analysis program, Bayes_Analysis. In this document, we capitalizethe first letter in the names of all Bayesian Analysis programs. We refer to these programsby their UNIX command names, which are the same names as the program names but notcapitalized. Therefore, the UNIX command name for the Bayes_Analyze program isbayes_analyze and Bayes_Model is bayes_model. A typewriter-like font is used for thenames of UNIX commands and files as well as VNMR commands and parameters. Thenames of buttons are shown in bold type.

This chapter is organized as follows:

• 1.1 “Bayes_Analyze Program,” this page

• 1.2 “Getting Started,” page 14

• 1.3 “A General Overview,” page 22

• 1.4 “Model Equation,” page 25

1.1 Bayes_Analyze ProgramThe analysis program, Bayes_Analyze, can run in “automatic” mode, “slave” mode, or acombination of these. It is fully capable of analyzing FIDs that have constant offsets,baseline artifacts, resonances having the same or independent phase, spin one-halfmultiplets, multiplets of multiplets and, last, non-Lorentzian lineshapes. In its automaticmode, the programs can detect the presence of resonances using a signal detectioncalculation [4, 13], estimate the resonance frequencies, decay rate constants, all of the otherparameters that appear in the model in a nonlinear fashion [3], determine the number ofresonances [3, 5], as well as, estimate amplitudes of the resonances [6]. (The time-domainamplitude of a resonances is proportional to the peak area of the discrete Fourier transformof the resonance.) All of this can be done on single FIDs or on arrayed FIDs.

The FIDs in an array can be processed individually or jointly. If jointly, they may beprocessed in user-defined groups. When the analysis program is jointly processing a groupof FIDs, it looks for resonances that are common to those FIDs. When it processes eachFID separately, it looks for resonances in that FID without reference to others in the array.

Page 14: Bayesian Analysis User Guide

Chapter 1. Introduction

14 Bayesian Analysis Software Package 01-999017-00 B0498

The automatic mode is fully capable of finding resonances that have either the same(correlated) or independent (uncorrelated) phase. Which type of resonances the analysisprogram looks for is under user control.

The slave mode of Bayes_Analyze is used whenever an initial model is present. Theprogram is a slave in the sense that it must process the initial model. The program processesthe initial model by optimizing the parameters associated with the model; it cannot modifythe model by adding or deleting resonances. The rationale for this behavior is two-fold:

• We wanted the ability to restart the program from the previous run and this presupposesthat the program picks up where it left off.

• The user knows more about the physics and chemistry that characterizes the samplethan could reasonably be programmed into the analysis program. We wanted the abilityto input this information. This again presupposes that the program not try to secondguess the user by adding or deleting resonances.

The initial model may be defined simply by “marking peaks.” Marked peaks, or resonances,may be any combination of singlets, multiples, or multiplets of multiplets. These markedresonances may be either correlated or uncorrelated phase. Additionally, the model mayinclude constants, models of baseline artifacts, and the resonance lineshapes may be non-Lorentzian.

After processing the initial model in the slave mode, the user can allow Bayes_Analyze toproceed to its automatic mode. In its automatic mode, Bayes_Analyze performs a signaldetection calculation. If this calculation indicates the presence of additional resonances, itbuilds a model having one more resonance and then optimizes the parameters associatedwith this model. After optimization, it computes the probability for the new model, and ifthis probability increases, it goes back to the signal detection calculation. This loop isrepeated until the signal detection algorithm fails to find additional evidence forresonances, the probability for the model decreases, or a user-specified maximum isreached.

Chapter 2, “Interface to VNMR: Menus,” describes how to build an initial model and howto set the default model to use in automatic mode. The analysis program, Bayes_Analyze,is discussed further in Chapter 3, “Bayesian Analysis Programs,” and throughout thismanual. The output from Bayes_Analyze consists of a series of output files that are eitherwritten to disk or to standard output. Some of these files are reports and can be printed,some are input to the modeling program and can be viewed graphically, and some serve asinput to VNMR. Chapter 4, “Output Files,” describes all of the files, including the reports.The section “Bayes_Display Menu,” page 57, describes how the output fromBayes_Analyze is viewed graphically, while the section “Bayes_Model Program,” page 66,describes the modeling program itself, Bayes_Model. Chapter 5, “Common Problems,”describes some common problems and what to do about them. Lastly, Appendix A, “ErrorMessages,” lists the messages that the system can issue.

1.2 Getting StartedIn this section, we demonstrate using a point-and-click tutorial how to run a simpleanalysis. We will show you just enough to get started, without all of the details that you willfind in the remaining part of this document.

We assume that you have already loaded a FID and that you are ready to process it usingthe Bayesian Analysis package. The example FID that we are going to use is of ethyl ether.The ethyl ether spectrum has a total of nine resonances: two singlets, a triplet, and a quartet.Figure 1 shows the region of the spectra around the triplet and quartet.

Page 15: Bayesian Analysis User Guide

1.2 Getting Started

01-999017-00 B0498 Bayesian Analysis Software Package 15

This particular example was chosen for several reasons:

• The FID is truncated and so care must be used in analyzing this data using the discreteFourier transform.

• The number of resonances is small enough to make a good example.

• The presence of the multiplets makes this an ideal candidate to illustrate how to use theadvanced features in this package to perform model selection.

Beginning an Analysis

To begin an analysis, enter the commandbayes to bring up the Bayesian Analysispackage. The first time thebayes macro is run, it defines the variables used by theBayesian Analysis package and then displays the Bayes menu:

This is the main Bayesian Analysis menu, with buttons that serve as a dispatching menu,taking you to various submenus that, in turn, perform the appropriate functions:

status Displays current setting of all Bayesian Analysis parameters.

analysis Changes to the Bayes_Analysis menu to perform an analysis.

results Views and prints the results of an analysis.

file transfers Loads and saves the results of an analysis, and loads and saves FIDs.

mDisplay Changes to the Bayes_Display menu to display a previously modeledFID in a graphical form.

Return Return to previous menu.

Figure 1. Ethyl Ether Spectrum

A small region of an ethyl ether spectrum in the region of the triplet andthe quartet. Beside these two resonances, the spectrum contains two othersmall resonances outside the regions shown.

Menu 1. Bayes Menu

Page 16: Bayesian Analysis User Guide

Chapter 1. Introduction

16 Bayesian Analysis Software Package 01-999017-00 B0498

Performing an Analysis

To perform an analysis, click on theanalysisbutton to change to the Bayes_Analysis menu.Like the Bayes menu, the Bayes_Analysis menu is a dispatching menu:

These buttons have the following actions:

We will have more to say about these buttons as we go through this tutorial. For now, wewant to describe the use of these buttons more or less in the order they are used in runningan analysis.

Assuming this is the first time you are processing this FID using the Bayesian Analysispackage, when you enter thebayes command, the parameters that describe the analysisare set to their default values. These defaults specify that all of the data are to be analyzed,that the exponentially decaying sinusoidal resonances should all have the same phase, andthat on each run of the program no more than 10 resonances may be added to the model.

If these default parameter settings need to be modified, this is done by clicking thesetupbutton to change to the Bayes_Setup_Ana menu:

These buttons have the following actions:

status Displays current setting of all Bayesian Analysis parameters.

setup Change to the Bayes_Setup_Ana menu to set and modify theparameters that describe an analysis.

execution Change to the Bayes_Execution menu to specify what machine youwish to run an analysis on, whether the analysis is to run interactivelyor in batch, and to actually run the analysis.

results Change to the Bayes_Results menu.

Return Return to previous menu.

status Displays current setting of all Bayesian Analysis parameters.

clear Resets all of the parameters to their default values and removes all filesprefixed with the wordbayes from the experiment.

initial model Describe an initial model to the program Bayes_Analyze. The initialmodel is the one that is processed by Bayes Analyze in its slave mode.

data params Sets up parameters associated with the data. For example, you canspecify which FIDs are to be processed, how many are to processed ata time, what portion of them are to be used as signal, what portion areto be used as noise, and what value to set thelb parameter.

model params Set parameters associated with the model.

Return Return to previous menu.

Menu 2. Bayes_Analysis Menu

Menu 3. Bayes_Setup_Ana Menu

Page 17: Bayesian Analysis User Guide

1.2 Getting Started

01-999017-00 B0498 Bayesian Analysis Software Package 17

Click themodel params button to change to the Bayes_Model_Params menu:

These buttons have the following actions:

In this tutorial, we have used the default settings on all of the parameters, so we did not needto do the setup. Your tour of the various setup menus is intended to show you where thevarious parameter are for controlling the program and to give you a feeling for what canand cannot be changed.

You are now ready to run the analysis. First, go back to the Bayes_Analysis menu. Becausethis menu is up two levels, click theReturn button on two successive menus to display theBayes_Analysis menu.

Next, click theexecution button to change to the Bayes_Execution menu:

From this menu you can set the machine that is to run the analysis, and you can start theanalysis interactively or in batch. The interactive analysis may only be used on your localmachine.

For the purposes of this tutorial, click theinteractive button to run the analysisinteractively. When an analysis starts, the macros that process the buttons write out a filenamebayes.params and then run thebayes_analyze program using the file nameas a command line argument. In the process of running the analysis, Bayes_Analyzeperforms a signal detection calculation, builds a one-resonance model, optimizes theparameters in this model, and then runs the signal detection calculation on the residuals,

status Displays current setting of all Bayesian Analysis parameters.

constants Sets the parameters that indicate that the data contain dc offsets orconstants. For example, you can indicate that the real and imaginarychannels contain a constant offset. This can be done for each channelseparately or jointly. Additionally, you can indicate that the first pointin the FID may be bad. This is the default.

phase Indicates the phase of the sinusoids. For example, whether thesinusoids are to have the same or different phase, and if they have thesame phase, whether first-order phase correction is to be used. Thedefault settings for these parameters is correlated (same phase) withphase correction.

lineshape Indicate whether the lineshape is non-Lorentzian. The model used bythe Bayesian Analysis package has the ability to Taylor expand thelineshape in a superposition of Lorentzian. The parameters in thismodel are then optimized to maximally account for shimming artifactsthat might be in the data.

max newresonance

Sets how many resonances it may add to the model. You are promptedto type in the number of new resonances that may be added to themodel. The default setting of this parameter is 10.

Return Return to previous menu.

Menu 4. Bayes_Model_Params Menu

Menu 5. Bayes_Execution Menu

Page 18: Bayesian Analysis User Guide

Chapter 1. Introduction

18 Bayesian Analysis Software Package 01-999017-00 B0498

builds a two resonance model, optimizes the parameters in this two resonance model, etc.This loop continues until one of three different conditions occurs:

• The signal detection routine fails to find any evidence for additional resonances.

• The probability for the model decreases.

• The maximum new resonances that may be added to the model is reached.

In the current example, the signal detection routine fails to find evidence for a tenthresonances. In other words, Bayes_Analyze builds a model of this data that contains nineresonances, which is how it should.

Before leaving the Bayes_Execution menu, note themodel button. This button creates amodel of what Bayes_Analyze did and places it in exp5 (experiment 5). This is actuallywhat we wish to do; however, don’t click themodelbutton yet. In this tutorial you need tosee what reports and models are available, and to do this you need to be able to go back upto the Bayes_Analysis menu.

Click theReturn button to go back to the Bayes_Analysis menu. From this menu, click ontheresults button to change to the Bayes_Results menu:

The Bayes_Results menu is another dispatching menu. The buttons have the followingactions:

Because the sample we are dealing with has only one FID, we must model the first FID.

Click themodel button. The macros that implement this button first make any necessarymodifications to the model files and then run the program. This program reads the modelfile and then builds an arrayed FID in exp5 with the following elements:

• First element in the array is the original data.

• Second is a model of the data.

• Third is the residuals.

• Remaining elements are the individual resonances in the model.

In this ethyl ether data, the model contained nine resonances so there are nine additionalarray elements following the residuals. Therefore, the arrayed FID built in exp5 contains atotal of 3 + 9 = 12 elements. After the modeling program finishes building this arrayedmodel, the menus and scripts join exp5, and then perform the discrete Fourier transform on

status Displays current setting of all Bayesian Analysis parameters.

reports Changes to Bayes_Reports menu (described in “Bayes_ReportsMenu,” page 55) to print or view the various reports that come out ofthe Bayesian Analysis package. Chapter 4, “Output Files,” describesthe reports.

setup Sets the number of the FID to be modeled. It also sets the number ofoutput points in the model FID. When Bayes_Analyze runs, it cananalyze multiple FIDs individually or jointly for common resonances.

model Activates the modeling program

Return Return to previous menu.

Menu 6. Bayes_Results Menu

Page 19: Bayesian Analysis User Guide

1.2 Getting Started

01-999017-00 B0498 Bayesian Analysis Software Package 19

the arrayed model. The spectrum of original FID is then displayed in the graphics window,and the Bayes_Display menu appears:

This menu is used to display the various components of the model array. Because thediscrete Fourier transform has been done, the displays are of spectra.

Click theover button. This button displays the components of the array one above or overanother.Figure 2 shows the over display of the entire spectra. The over display containsthree sets of plots:

• The lower plot is an overlay of the spectrum of the data and the model. The red in thisplot is the area of exact overlap between the data and the model.

• The middle plot is the residual spectrum. Note the the residual spectrum shows noevidence for additional resonances. The small artifact in the center of the spectrum isnot a resonance, it is an artifact that is introduced into the spectrum by VNMR's dccorrection. The presence of this artifact is fairly common in truncated FIDs. If thecommandwft('nodc') is issued, this artifact disappears.

• The upper plot is a display of the 9 individual resonances that make up the model.

Finally, at the top of the display, in yellow, the contents of the text file are displayed. Notethat the text file has been modified to indicate that this is a modeled FID.

When we began this tutorial, we started withFigure 1, a display of the region around thelocation of both the triplet and the quartet. Here we would like to show the over displayaround the location of these two multiplets. To do this, we make use of theinteractivebutton on the Bayes_Display menu to expand the region of interest.

Menu 7. Bayes_Display Menu

Figure 2. Full Ethyl Ether Spectrum

Page 20: Bayesian Analysis User Guide

Chapter 1. Introduction

20 Bayesian Analysis Software Package 01-999017-00 B0498

Click theReturn button to change to the Bayes_Display menu. From this menu, you canmake the appropriate over displays.

Figure 3 shows the expansion of the two regions. The spectrum of the data and the modeloverlap almost exactly, lower plot. The red on this plot indicates the region of exact overlapbetween the signal and the model. The residuals are zero on the scale of the plot. Finally,the upper plot show the position of the resonances for the triplet and the quartet.

On the Bayes_Display menu, several other buttons can be used to display various plots. Forexample, thevertical button can display the data, model, and residual, vertically, and theinteractive button can expand regions for display.

Themore button takes you to the second half of the Bayes_Display menu. On the extendedmenu are several buttons that display FIDs, as well as several buttons for displaying spectra,in different ways. All of these buttons are explained further in 2.5 “Bayes_Display Menu,”page 57.

The last button,mAnalyze, needs to be mentioned. When exp5 was created by themodeling menus, exp5 was also joined. ThemAnalyzebutton returns to the experiment inwhich the analysis was performed and shows the Bayesian_Analysis menus.

In this analysis, Bayes_Analyze was run in its automatic mode. In that mode, it fitsresonances with singlets. However, the Bayes Analysis package knows about multipletsand multiplets of multiples, but you must use the setup menus to identify a multiplet. InFigure 4, we have modeled the region of the triplet and quartet using a triplet and quartetresonance model. Notice that the region of overlap, shown in red on the lower plots, isalmost identical to that given inFigure 3.

If we compute the probability for a model that contains a triplet plus a quartet and twosinglets and compare this to a model containing only singlets, we find that probabilitytheory prefers this model by a factor of 1016: 1, which are overwhelming odds in favor ofa triplet and a quartet. For an explanation of what is meant by a resonance, see 1.4 “ModelEquation,” page 25; for an explanation of how to mark multiplets, see “Bayes_MarkMenu,” page 35.

Figure 3. Over Display

A small region of an ethyl ether spectrum in which the triplet and quartet areshown. Here, the ethyl ether data were analyzed in the automatic mode using acorrelated singlet model. Nine total resonances were found. The lower plot in eachpanel is an overlay of the data and the model. The exact overlap is in red. Themiddle plot is the residual or what Bayes_Analyze considers noise. On this scale,noise is essentially zero. The upper plot is the individual resonance singlets found.

Page 21: Bayesian Analysis User Guide

1.2 Getting Started

01-999017-00 B0498 Bayesian Analysis Software Package 21

In the tutorial, we have given two different models of the ethyl ether data: a singlet model,Figure 3, and a full triplet and quartet model,Figure 4. Which of these two models is thebest? This question is answered using probability theory by computing the probability forthese two models and then comparing them.

The Bayesian Analysis package implements a model selection calculation. The results ofthis calculation are written to the probabilities file, which is automatically printed at the endof the summary1 report. The summary1 report is accessed on the Bayes_Reports menu.

The output for the the two models is the following:Model Desc Model Prob Search/I Search/F Date-Time

9 Resonances 576.265 770.8 790.1 Mon May 20 08:54:52

4 Resonances 592.327 762.4 767.0 Mon May 20 08:56:08

The first line after the header is the output for the nine singlet model. The number of interestis in the “Model Prob” column. This is the base 10 logarithm of the posterior probabilityfor this model. The model associated with the second line after the header has one triplet,one quartet, and two singlets in it, for a total of 9 lines. The base 10 logarithm of theprobability for this model is roughly 16 orders of magnitude greater than that for the singletmodel. This indicates that the triplet and the quartet model is a better model for this datathan the simple 9 singlet model. For a full explanation of the probabilities file and how touse it, see 4.8 “bayes.probabilities.nnnn File,” page 93.

In addition to the summaryl report, the Bayesian Analysis package also produces an outputreport and a summary2 report. The output report contains a section on each model testedby Bayes_Analyze, while the summary report contains only the section for the mostprobable model. The output report and the summary1 report contain a detailed listing of allof the parameters that define the model (the frequency, the decay rate constant, and theamplitude) and they contain an estimate of how uncertain the values are compared to thetrue parameter values. The summary2 report is particularly condensed and can only be usedwhen there is a single amplitude associated with a resonance. Consequently, it can not beused when multiple FIDs are analyzed jointly. See Chapter 4, “Output Files,” for a completedescription of these reports.

Figure 4. Over Display Using a Triplet and Quartet Model

The triplet and quartet are modeled using a model of a spin one-halftriplet and quartet. Note that the overlap, shown in red on the lower plots,is essentially identical to that shown inFigure 3.

Page 22: Bayesian Analysis User Guide

Chapter 1. Introduction

22 Bayesian Analysis Software Package 01-999017-00 B0498

1.3 A General OverviewThe Bayesian Analysis package is a software implementation of several calculations usingBayesian probability theory. The types of calculations are identical in their details to thosepresented in [2, 3, 4, 5, 6]. These articles and books show how to take a model and useprobability theory to compute the probability for various hypotheses.

Probability Theory as Logic

For example, given a model of a “signal” we can compute the probability that a signal ispresent in the data. Similarly, if we define what is meant by “no signal,” we can computethe probability that no signal is present. These two calculations can then be combined todetermine the amount of evidence for the signal hypothesis. This type of calculation is asignal detection calculation.

As a second example, suppose that we have a model of the signal and we want to estimatethe parameter values—the frequencies and decay rate constants. Again, we use Bayesianprobability theory to compute the probability for a hypotheses. In parameter estimationproblems, the hypotheses are of the form “the resonance frequency had valueω and thedecay rate constant had valueα.” The indexesω andα stand for the values of the frequencyand decay rate constant that we are testing. This type of calculation is a parameterestimation calculation because it seeks to answer a question about the parameters given thatthe model is known.

As a last example, the hypotheses might be that the number of resonances in the data ism.For any given value ofm, saym = 5, we compute the probability that there were 5resonances in the data. Calculations using this type of hypotheses are model selectioncalculations because they seek to answer a question about which model is best.

The only real difference between a model selection, a parameter estimation, and a signaldetection calculation is what hypothesis is being considered, not the nature of thecalculation. All of these calculations are done using probability theory as logic. TheBayesian Analysis package implements all three types of calculations to find resonances,estimate their parameters, and determine when the the model is complete.

Parameter Files

All of the calculations using probability theory are implemented in the Bayes_Analyzeprogram. Bayes_Analyze reads a parameter file with a format as given in 4.3“bayes.params.nnnn and bayes.model.nnnn Files,” page 74. The parameter file indicates,among other things, what FIDs are to be processed, the default model used in the automaticmode, and the model used in the slave mode.

One of the primary functions of the menus is to gather the information needed to create theparameter file. Using the information in the parameter file, Bayes_Analyze performs theappropriate analysis and writes several output files. These files are referred to as the outputfiles, the model files, the log files, and updated parameter files. One or more of each thesefiles is written, depending on the analysis being performed. For example, if Bayes_Analyzeis instructed to process an arrayed FID one array element at a time, it writes one set of filesfor each element in the array. The number of the array element is appended to the file nameto make it unique. Chapter 4, “Output Files,” discusses further the naming conventionsused in the Bayesian Analysis package.

Page 23: Bayesian Analysis User Guide

1.3 A General Overview

01-999017-00 B0498 Bayesian Analysis Software Package 23

Running an Analysis

Performing an analysis consists of setting up and running the analysis. In setting up theanalysis, you indicate the data to be processed and the models to be used in the automaticand the slave modes. When the analysis is run, all of the setup information is written to thebayes.params file.

The analysis may be run under VNMR control or in batch. When the analysis is run underVNMR control, VNMR is dedicated to running the analysis. When the analysis is in batch,it can be run on a local or remote host. The host computermusthave yourvnmrsysdirectory mounted and it must have access to the programs and scripts in the BayesianAnalysis package. These programs and scripts run on Sun, SGI, Dec Alpha and IBM R8000architectures. When the analysis is running in batch, VNMR is free and may be used forother purposes, including setting up and running other Bayesian Analysisprovided you donotchange anything in the experiment in which the batch analysis is running. The status ofan analysis may be determined by using thestatusbutton in the experiment of interest onthe Bayesian Analysis menus.

The Bayesian Analysis package is highly interactive. To make the package interactive, theoutput from the analysis is brought into VNMR by reading the updated parameter file.There are several ways the menus and macros determine when to read the updatedparameter file:

• When an analysis is run interactively, the menus and macros read the updatedparameter file when the analysis terminates.

• When an analysis is run in batch, you can instruct VNMR to wait for the analysis tofinish. The macros then read the updated parameter file when the analysis completes.

• When the user does not instruct VNMR to wait, either you must join anotherexperiment and come back to the analysis later or you must click thestatusbutton toget the macros to read the updated parameter file.

If you leave the VNMR experiment and come back later, the menus read the updatedparameter file when you enter thebayes command to bring up the Bayesian Analysissystem. If you do not leave the experiment and do not wait for the run to complete, however,there is a danger that the updated parameter files are not read. The Bayesian Analysispackage is idle and, under these conditions, we expected you to join another experiment.For you to do this, we had to return control to VNMR. Consequently, if you do not click thestatus button, the updated parameter files are not read.

After the macros have read the updated parameter file, you may decide to update theparameters and rerun the analysis, you may decide to model the results, or you may view,print or save the information generated during the analysis.

Modeling the Results

When you decide to model the results, the Bayes_Model program is run. The Bayes_Modelprogram reads a model file and the original FID and creates a model of that FID. The menusand macros instruct the modeling program to build this model in exp5. The section“bayes.model.nnnn File,” page 83 gives the format of the model file. After the model isbuilt, the menus and macros join exp5, discrete Fourier transform the arrayed model FID,and display the Bayes_Display menu. If a model already exists in exp5, you can join exp5and enter the commandbayes .

As noted earlier, thebayes macro displays the Bayes_Display menu if you are in exp5;otherwise, it displays the Bayes menu. If you join exp5 and enterbayes , the menus and

Page 24: Bayesian Analysis User Guide

Chapter 1. Introduction

24 Bayesian Analysis Software Package 01-999017-00 B0498

macros assume that the discrete Fourier transform of the modeled FID exists. If not, youmust perform the Fourier transform for this menu to work correctly.

The modeling program builds an arrayed FID in the appropriate experiment or datadirectory. The arrayed FID may be Fourier transformed and processed using any VNMRcommands or it may be processed in exp5 using the Bayes_Display menu. The arrayed FIDconsists of at least four array elements:

• Element 1 is the raw unprocessed FID that was modeled.

• Element 2 is the model of that FID. The model FID is generated from the mostprobable value of the resonance parameters.

• Element 3 is the difference between the data and the model. If the modeled FIDaccounts for everything in the signal, this difference is the noise in the data.

• Elements 4 through 3 +m are the individual resonances that were modeled, wheremis the number of resonances in the model. These may be highly non-Lorentziansinglets, multiplets, and multiplets of multiplets. Constant models are not placed in thissection of the array; only resonances are. However, constant models are incorporatedinto the modeled FID that is placed in element 2. If this last action were not done, theresidual would not be correct.

The modeling program models one FID at a time; however, Bayes_Analyze can processmore than one FID at a time. If you wish to view the model of more than one FID, you mustmodel each FID separately.

Changing the Model

After modeling the results of an analysis, you may decide for some reason to change themodel. For example, when you look at the model, you may see a peak that was not fit aswell as you think it should have been. Because there might be a second small resonancehiding under the line, you decide to change the model and to reanalyze the data.

If you click themAnalyze button on the Bayes_Display menu, you are taken back to theexperiment in which the analysis was performed, the updated parameter file is read, andthen the Bayes menu is displayed. Now, if you rerun the analysis without changinganything, thebayes.params file is written using the updated parameter values. Theeffect of this is that the updated parameters from Bayes_Analyze have been transfered tothe file used as input to Bayes_Analyze; thus, Bayes_Analyze picks up where it left off.

Probabilities File

As noted earlier, the updated parameter file is read and the appropriate VNMR parametersare set. If you then make modifications to the model, you are modifying the updated model.Consequently, when you rerun Bayes_Analyze, it begins from either where it left off orfrom your modifications to where it left off. Each time the the analysis is run, the outputfile, the model file and the log files are rewritten. However, the probabilities file is not.

The probabilities file accumulates over multiple runs of the program. When Bayes_Analyzeruns, it computes the probability for each model it tests. These probabilities are written intothe probabilities file. When the summary and output reports are written, the probabilitiesfile is written into these reports as a table of normalized probabilities. The model withhighest probability is generally the model that should be used. See 4.8“bayes.probabilities.nnnn File,” page 93, for examples of how this is done and the layoutof this file.

Page 25: Bayesian Analysis User Guide

1.4 Model Equation

01-999017-00 B0498 Bayesian Analysis Software Package 25

Default Settings

When you run the analysis program, the menus and macros write thebayes.params file.If you run the analysis without using the setup menus, the default VNMR parameters areused. These instruct the analysis program as follows:

• Process all of the data.

• Look for no more than 10 common correlated resonances in the automatic mode, oneat a time.

• Assume the first time-domain point is “bad.”

• Use the units currently in use by VNMR.

• Use the current value of the line-broadening parameterlb in the signal detectioncalculations.

These default settings work well for most FIDs, but there are always exceptions.

Before we proceed to a detailed explanation of the menus, we must first pause to describeexactly what is meant by a resonance in the Bayesian Analysis package.

1.4 Model EquationTo apply probability theory as logic, we always compute the probability for somehypothesis given what we know. In NMR, we know much about the types of signals thatcan appear in the detector. For FIDs, the signals are sinusoids that decay in time. Formagnetic fields and samples typically employed in high-resolution NMR spectroscopy, thedecay of the signal is generally exponential, that is, the lineshape is Lorentzian.

Equation 1 relates an exponentially decaying sinusoidal signal to the data for the realchannel:

[Eq. 1]

wheredRi is theith data value sampled at timeti, ωj is the resonance frequency for thejthresonance,αj is its associated exponential decay rate constants,Bj is the resonanceamplitude,θj is the phase of the resonance,m is the number of resonances, andnR(ti) is theerror or noise in the data. The imaginary channel is 90° phase shifted, and so the sinusoidsare given byEquation 2:

[Eq. 2]

wherenI(ti) are the errors or noise in the imaginary channel.

In collecting the data, the signal could have been projected onto either a sine or cosine, andsines and cosines can have either positive or negative frequencies. These four possibleacquisition schemes results in four different sets of model equations, corresponding todiffering sign conventions. These model equations can be derived from Equations 1 and 2by simultaneously shifting the sine and cosine forward or backward by 90° and byswapping the sine and cosine and then shifting them. These different sign conventionseffectively aliases either the positive or negative frequencies in the spectrum, depending onwhich convention is used.

Some NMR spectrometers use only a single digitizer and collect the real and imaginarychannels at different times. This time difference is not accounted for in Equations 1 and 2.Varian uses a cosine and minus sine combination, as shown in Equations 1 and 2. Bruker

dRiBj ω j ti θ j+( )e

α j ti–cos nR ti( )+

j 1=

m

∑=

dI iBj ω j ti θ j+( )sin e

α j ti–nI ti( )+

j 1=

m

∑=

Page 26: Bayesian Analysis User Guide

Chapter 1. Introduction

26 Bayesian Analysis Software Package 01-999017-00 B0498

uses a different convention and, because of this, Bruker data cannot be correctly processedby the Bayesian Analysis package.

These model equations leave out a great deal of what is often known about yourNMRsignal. For example, the equations ignore constant offsets, baseline artifacts, multiplets,multiplets of multiplets, linear phase errors in the frequency domain, and non-Lorentzianlineshapes. In spite of this, a program that implemented this model would still be useful,because this model would allow for the estimation of frequencies, amplitudes, phases,decay rate constants, and the number of resonances in most NMR FIDs.

The actual model signal used in the Bayesian Analysis package is more sophisticated thanEquations 1 and 2. For example, the way the equations were written implies that the phaseof the sinusoids is different for each resonance, This is not necessarily true. Indeed, themodel used by the Bayesian Analysis package allows the user to specify whether the phasesof the resonances are the same (correlated) or different (uncorrelated). If the resonances arecorrelated, the model includes a common zero-order phase and, optionally, a linearfrequency-dependent first-order phase shift. These two parameters are in exact analogue ofthe left and right phase parameters that VNMR uses. Additionally, the model includes spin1/2-AX multiplets and multiplets of multiplets.

If these modifications were the only additional prior information built into the model, themodel would be considerably more sophisticated than Equations 1 and 2 would indicate.However, the actual model in use also takes into account two other types of information.

The first type of additional information is that there may be a constant offset in the data. Noamplifier is perfect and, as a result, NMR FIDs often have constant offsets. This isparticularly true if phase cycling is not used. If these offsets are not accounted for in themodel, they would introduce artifacts into the analysis. Four different types of constantmodels are allowed:

• First-point model – A model of the first time-domain point in the data. In essence, thismodel assumes that the first time-domain data value is not correct. The types of thingsthat could cause the first point to be off are the presence of probe or filter ringing or anextremely rapidly decaying sinusoid in the data. The first-point model is the default,and in the menus you must take a specific action to turn this model off.

• A constant in the real channel or a constant in the imaginary channel. These constantmodels are different from the first point. The first-point model is a constant that extendsonly one point in time, while the constant in the real or imaginary channel extends allthe way through the acquisition. They are the dc biases of the two channels.

• The same constant in both channels. Asingle constant that appears in both the real andimaginary channel.

The user selectes the use of these constant models. They may be used either separately orin any combination.

The second type of additional information that was incorporated into the model equationwas that the lineshapes are not pure Lorentzian. One of the problems that had to be facedearly in the development of this software was what decay model to use. In the developmentof the Bayesian Analysis package, various models of the decay were postulated andprobability theory was used to test these models against the Lorentzian model. It was foundthat no simple models of the physics were better than the Lorentzian model. To give just afew examples of the models tested, we tested Gaussian, Lorentzian plus Gaussian, lineardrifts in theH0 field (which imply aJ0 Bessel function corrections to the decay), Taylorexpansions of the lineshape, multiexponential decay, and a host of others. (Approximately,fifty different models of the decay were tested in total.) With one exception, none of thesemodels worked better than Lorentzian.

Page 27: Bayesian Analysis User Guide

1.4 Model Equation

01-999017-00 B0498 Bayesian Analysis Software Package 27

The model finally implemented in the Bayes_Analyze program takes into account onesimple observation: badly shimmed resonances in the frequency domain look like asuperposition of several frequencies. Indeed, this is precisely what a shimming artifact is.If the magnetic field is not homogeneous, different parts of the sample have differentresonance frequencies. The model implemented in Bayes_Analyze treats each resonance inthe frequency domain as superposition of Lorentzians. The Lorentzians are equally spacedand, for reasons that will become apparent, the order of the expansion is always odd. Theamplitude of each Lorentzian is chosen so that the lineshape of the modeled resonancesmatch the common lineshape of the spectrum. The total relative amplitude of theLorentzians sums to 1, so that the amplitude of the modeled resonance retains its normalmeaning.

We are now in a position to state the model that describes a resonance in the BayesianAnalysis package. Note that this is just the resonance portion of the model, it does notinclude the constants. In the Bayesian Analysis package, a resonance is any group of relatedfrequencies that are treated as a unit by the programs. Thus, a single isolated resonance, amultiplet, and a multiplet of multiplets are all examples of resonances, even though theFourier transform of these resonances could have multiple peaks.

With this terminology out of the way, the model for a resonance in the Bayesian Analysispackage is given by

[Eq. 3]

for the real channel, and

[Eq. 4]

for the imaginary channel, whereB is the time-domain amplitude of the resonance. Thistime-domain amplitude is proportional to the integral over the resonance peak in thefrequency domain. Consequently, when we use the word amplitude, it is, for all practicalpurposes, synonymous with integral. For multiplets, the amplitudeB is the total amplitudeof the multiplet. In the frequency domain, this is the total integral over all peaks in themultiplet. The order of the primary multiplet (defined to be the multipIet with the largestcoupling constant) isp. The order of the secondary multiplet iss. The expansion order ofthe shimming model iso.

The normalized relative amplitude of the primary spin one-half multiplet are given byPj.Similarly, Sk is the normalized relative amplitude for the secondary multiplet. Up to thenormalization constant,Pj andSk are given by Pascal’s triangle,Table 1 onpage 40. Thenormalized relative amplitudes used in the lineshape expansion are given byRh. Theexecution time of the experiment is given byt0 such thatt + t0 is the time each data point isacquired relative to the excitation pulse.

The phase of the resonance isφ, the decay rate constant isα, and the frequency of thevarious components of the resonance isωhjk given by

[Eq. 5]

where the location of the center of the resonances,ω, is referred to as the resonancefrequency,∆o is the spacing of the frequency components in the Lorentzian expansion ofthe lineshape,∆p is theJ coupling constant of the primary multiplet, and∆s is J couplingconstant for the secondary multiplet.

GR t( ) B PjSkRh ωhjk t t0+[ ] φ+( )cos eαt–

h 1=

o

∑k 1=

s

∑j 1=

p

∑=

GI t( ) B PjSkRh ωhjk t t0+[ ] φ+( )sin eαt–

h 1=

o

∑k 1=

s

∑j 1=

p

∑=

ωhjk ω∆o o 1 2h–+( )

2------------------------------------–

∆p p 1 2 j–+( )2

------------------------------------–∆s s 1 2k–+( )

2----------------------------------–=

Page 28: Bayesian Analysis User Guide

Chapter 1. Introduction

28 Bayesian Analysis Software Package 01-999017-00 B0498

Note that ifo = p = s = 1, Equations 3 and 5 reduce to the single exponentially decayingsinusoidal model, Equations 1 and 2. Also note that so long as the shimming order is 1,s = l, this model is the exponentially decaying sinusoidally model for multiplets ofmultiplets, which was described earlier. When the shimming order is not 1, this model is ofmultiplets of multiplets, where the lineshape is determined by a superposition ofosinusoids of relative amplitudesRh.

This equation is for a single resonance, but the actual model used in the Bayesian Analysispackage is a superposition of multiple resonances plus whatever constant models have beenselected by the user. The relative amplitudesRh are common to every resonance, but theresonance frequencies, the amplitudes, and the decay rate constants differ for everyresonance. Correlated resonances have a common phaseφ, while uncorrelated resonanceseach have a unique phase. This unique phase is implemented as a cosine and sine amplitudein the programs, not as an amplitude plus a phase as illustrated in Equations 1 and 2. Last,the first-order phase correction to appears only in correlated resonances.

The Bayes_Analyze program searches for the most probable value of these parameters. Thesearch is done in the logarithm of the joint posterior probability for the model parameters,independent of the amplitudes of the resonances. The search algorithm is a heavilymodified version of a Levenberg-Marquardt algorithm. When the shimming model isactivated, the shimming delta∆0 and the relative shimming amplitudesRh are common toall resonance models. Because these parameters are the same for every resonance model,the program is looking for effects that are common to all resonances. That is why we tendto call this model a shimming artifact model, not a lineshape model. A true lineshape modelwould allow each resonance to have a different lineshape, and this is not what the shimmingmodel does.

The shimming model is multiplied by the exponentially decaying part of the signal. Thus,the width of the Lorentzians that make up the lineshape expansion in the frequency domainare different for every resonance. When all resonance have comparable linewidth, the shapeof the line in the discrete Fourier transform is highly affected by the shimming model.When some lines are narrow and some are broad, the narrow line are primarily affected bythe shimming model and appear highly non-Lorentzian. Broad lines, however, areminimally affected by this model and appear highly Lorentzian. In either case, theestimated decay rate constant is decreased, not increased. The lines do decay faster, but itis interference that causes the decay, not an increase in the decay rate constant.

There are three sets of relative amplitudes:Pj, Sj, andRj. Each of these relative amplitudeare normalized. The relative amplitude of a resonance is a weighted average over thesethree, so the total relative amplitude of a resonance is 1. Consequently, the amplitudeB isthe total amplitude of all components that makes up a resonance. In the frequency domain,this means that the amplitudeB is the proportional to the integral over all peaks that makeup a resonance.

The Bayesian Analysis package takes special steps to make sure that the total relativeamplitude is 1. ForPj andSj this means normalizing the amplitudes from Pascal's triangle.However, for the relative shimming amplitudes,Rj, the problem is more complex.

Imposing the condition that the total relative shimming amplitude be 1 is accomplished byassigning the amplitude of the center component such that the total is 1. However, for thismodel to have physical significance, all of theRj must be positive, including the center one.But imposing these two conditions, assigning the center amplitude and positivity, is notenough to ensure a physically meaningful result, because these conditions allow theresonance frequency to be different from the center of a peak in the discrete Fouriertransform.

Page 29: Bayesian Analysis User Guide

1.4 Model Equation

01-999017-00 B0498 Bayesian Analysis Software Package 29

To avoid this problem, three additional conditions are imposed: the shimming expansionorder is always odd, the center component is required to have the largest relative amplitude,and the relative shimming amplitudes must increase up to the center and then decreasebeyond. With these conditions in place, the search algorithm places the center of theshimming expansion in the center of the line in the frequency domain. Consequently, theresonance frequency corresponds to the center of a resonance, and the total amplitude isproportional to the total integral over the lines in the frequency domain.

All of these conditions are imposed using prior probabilities. These prior are such that theyhave almost no effect on the result so long as the appropriate conditions are met, but whenthe conditions are about to be violated, they prevent the parameters from moving tophysically meaningless values. The various priors make sure thatJ coupling constants anddecay rate constants never go negative. They ensure that the total shimming amplitudes areordered, positive, and sum to 1. Last, they ensure that resonances marked by the user staynear where the user marked them. All of these conditions are informative and aid in makingsure the output from Bayes Analyze is physically meaningful.

Page 30: Bayesian Analysis User Guide

Chapter 1. Introduction

30 Bayesian Analysis Software Package 01-999017-00 B0498

Page 31: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 31

Chapter 2. Interface to VNMR: Menus

To bring the user into the process of building the model, the Bayesian Analysis package wasdesigned to be highly interactive. The model implemented in the Bayesian Analysispackage is complex and contains considerable information about NMR FIDs; however, theNMR spectroscopist still knows more about the physics and chemistry of the sample beingstudied than the program. The VNMR interface to the Bayesian Analysis package allowsthe user to enter much of this information in a convenient manner.

To the user, this interface appears as a series of menus. These menus implement a set ofmacros that set a series of VNMR parameters. When the programs are run, these parametersare written to specific files and these files serve as input to the programs.

The menus are accessed by entering the commandbayes in the VNMR command line.When thebayes command is issued from other than exp5, it brings up the Bayes menu.If the bayes command is issued from exp5, it displays the Bayes_Display menu.

In describing the interface to VNMR, we follow the natural hierarchy of the menus. Thenames used for the menus is the same as the actual menus used by VNMR. We typicallycapitalize the names of menus; however, the name used by VNMR contains no capitals.

Here are the sections for main menus with the submenus in the section listed:

• 2.1 “Bayes Menu,” this page

• 2.2 “Bayes_Analysis Menu,” page 32. Includes submenus Bayes_Setup_Ana,Bayes_Initial_Model, Bayes_Mark, Mark, Bayes_Primary_Pattern,Bayes_Secondary_Pattern, Bayes_Find, Find-Interactive, Bayes_Data_Params,Data_Setup_Signal, Data_Setup_Filter, Bayes_Noise, Bayes_Model_Params,Bayes_Constants, Bayes_Phase, Bayes_Lineshape, Bayes_Execution,Bayes_Batch_Mode.

• 2.3 “Bayes_Results Menu,” page 54.Includes submenus Bayes_Reports,Bayes_Setup_Mod.

• 2.4 “File-Transfers Menu,” page 56

• 2.5 “Bayes_Display Menu,” page 57.Includes submenu Bayes_Display2.

2.1 Bayes MenuWhen thebayes command is issued, the Bayes macro reads the Bayes parameters file andthen displays the Bayes menu. Here is that menu:

Menu 8. Bayes Menu

Page 32: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

32 Bayesian Analysis Software Package 01-999017-00 B0498

Theanalysis, results, file transfers, andmDisplay buttons take you to other menus thatare described in elsewhere in this chapter, as shown in this table of button functions:

These choices let you analyze FIDs, view and print the results of an analysis, and load andsave the results of an analysis. Each of these choices corresponds to a menu, and these menuare explained in the following sections.

2.2 Bayes_Analysis MenuThe Bayes_Analysis menu is a dispatching menu that allows you to select the type offunction you wish to perform and then changes to the menu that perform that function. Hereis the Bayes_Analysis menu:

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if an analysis has beenstarted. The format of the status display is given in “Status Display,”page 70. Thestatusbutton is always the first button and is present onmany Bayesian Analysis menus.

analysis Changes to the Bayes_Analyze menu. This menu allows you to set up,run, or model a FID. See “Bayes_Analysis Menu,” this page, for adescription of this menu.

results Changes to the Bayes_Results menu so that you can print and view thevarious reports, and model the results of an analysis. “Bayes_ResultsMenu,” page 54, describes the menu. The Bayes_Results menuappears in several different places in the menu hierarchy. When themenu is linked to in other places by the interface, we reference thesame section and do not repeat its description.

file transfer Changes to the VNMR files menu so you can load and save FIDs. Thisbutton can also load and save all files generated by the BayesianAnalysis package, which allows saving a Bayesian analysis andreloaded it later. See “File-Transfers Menu,” page 56, for more on thismenu and its function.

mDisplay Joins exp5 and changes to the Bayes_Display menu to display theresults of the analysis in the form of spectra. However, themDisplaybutton assumes that a model has already been created in exp5 and allyou are going to do is an additional display of the model. To create amodel, you must click theresults button if the analysis is alreadycompleted. If you have not yet run the analysis, you must run it beforeyou may model the results. For more on theanalysis button, see“Bayes_Analysis Menu,” this page, and for more on the modelingmenu, see “Bayes_Display Menu,” page 57.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 9. Bayes_Analysis Menu

Page 33: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 33

The buttons on this menu have the following functions:

The Bayes_Analysis menu enables you to check the status of an analysis, set up an analysis,run the analysis, and to view the results of the analysis. The menu does not actually set anyparameters. The parameters are set by the various submenus, and it is to these menus thatwe now turn.

Bayes_Setup_Ana Menu

The Bayes_Setup_Ana menu is mostly a dispatching menu that allows you to select thetypes of parameters you wish to set. From this menu you can set the parameters associatedwith the data, the model used in the automatic mode, and the model used in the slave mode.Here is a copy of the menu:

The functions performed by this menu are accessed by the following buttons:

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if an analysis has beenstarted. The format of the status display is given in “Status Display,”page 70.

setup Changes to the Bayes_Setup_Ana menu. From this menu, you can tellthe system how the data is to be processed, set the default model usedin the analysis, and define the initial model. See Section 2.1.1 for adescription of the setup menu.

execution Changes to the Bayes_Execution menus. From this menu you can tellthe package what machine you want to run the analysis on, whetheryou want the analysis to run in background or foreground, and you canrun the analysis. See Section 2.1.2 for a description of the executionmenu

results Changes to the Bayes_Results menu. From this menu you can viewand print the reports that come out of the package and you can build amodel of the data. The modeled FID can be viewed using theBayes_Display menu and it can manipulated using standard VNMRcommands. See Section see Section 2.2 for a description of the resultsmenu

Return Returns to the menu just above the current menu in the hierarchy.

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if an analysis has beenstarted. The format of the status display is given in “Status Display,”page 70.

clear Removes all of the Bayesian Analysis files in the current experiment.These files begin with the wordbayes . It then resets all of the VNMRBayesian Analysis parameters to their default values. Before the filesare removed, you are prompted for confirmation. You must confirm theaction before the files are removed. Clearing the experiment is highlyrecommended whenever you start an analysis from scratch.

Menu 10. Bayes_Setup_Ana Menu

Page 34: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

34 Bayesian Analysis Software Package 01-999017-00 B0498

Bayes_Initial_Model Menu

The Bayes_Initial_Model menu defines the model processed in the slave mode of BayesAnalyze. This is done by adding and deleting resonances for the current model. Addingresonances can be done either by marking resonances or by using thefind buttonimplemented in the Bayesian Analysis menus. Marking is more general because it allowsyou to mark singlets, multiples, and multiplets of multiplets; the find command only findssinglets. Here is a copy of the Bayes_Initial_Model menu:

The buttons on this menu have the following functions:

initial mode Changes to the Bayes_Setup_Mod menu. From this menu you canmark singlets, multiples, and multiplets of multiplets. You can findpeaks, and you can delete or reset the initial model to the previousmodel. For more on this menu, see the section “Bayes_Setup_ModMenu,” page 56.

data params Changes to the Bayes_Data_Params menu. From this menu you can setthe various parameters associated with the data. These include thenumber of data values to use in the analysis, the presence of noise, theportion of the data to be used to estimate the “noise” level, the portionof the data to be used as “signal,” which FIDs to process, and how theyare to be grouped. The value of parameterlb may also be set from thismenu. For more on this menu, see the section “Bayes_Data_ParamsMenu,” page 43.

model params Changes to the Bayes_Model_Params menu. From this menu you canset the parameters associated with the model. These parametersinclude the number of resonances to add in the automatic mode, theconstant models to used in both automatic and slave mode, the type ofresonances to find, and whether the shimming model is to be used. Formore on this menu, see the section “Bayes_Model_Params Menu,”page 47.

Return Returns to the menu just above the current menu in the hierarchy.

interactive Invokes theds program to allow you to zoom in on the region ofinterest. When you return fromds , the location of each peak in thecurrent model is marked.

mark Changes to the Bayes_Mark menu. From this menu you can marksinglets, multiplets, and multiplets of multiplets. The marked peakscan have correlated or uncorrelated phase. For more on this menu, seethe section “Bayes_Mark Menu,” page 35.

find Changes to the Bayes_Find menu. From this menu you may find eithercorrelated or uncorrelated singlets. For more on this menu, see thesection “Bayes_Find Menu,” page 40.

list Lists the current model. The listing appears in the text window. Thelisting is the same as that used in thestatus command. For more onthis listing, see “Status Display,” page 70

Menu 11. Bayes_Initial_Model Menu

Page 35: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 35

Generally, the Bayes_Initial_Model menu is used to build the model used in the slave modeof Bayes_Analyze When Bayes_Analyze is run, it reads in this model and then optimizesthe parameters in it. From there Bayes_Analyze might proceed to its automatic mode or itmight stop, depending on the options you have set.

Bayes_Mark Menu

The Bayes_Mark menu is used for building an initial model using the VNMR mark facility.On this menu, you specify the type of resonances to be marked: singlets (the default),multiplets, or multiplets of multiplets; whether the resonances are correlated oruncorrelated; and the relative phase of the resonances. Here is what the menu looks like:

The Bayes_Phase menu (described in the section “Bayes_Phase Menu,” page 50) enablesyou to set the type of resonances added in the automatic mode of Bayes_Analyze. Earlierin this manual, you specified the relative phase of the resonances and whether theresonances were correlated or uncorrelated. But those specifications are independent ofwhat is done here. Now you are building a model to be processed in the slave mode.

The buttons on the Bayes_Mark menu allow you to center in on the region of interest, selectthe pattern for the primary and secondary multiplets, select the type of resonance to bemarked, and take you to a menu where you mark the peaks. Here is how the buttons work:

remove Removes one or more resonances from the model. When you click thisbutton, you are prompted for the first and last resonance to be deleted.If you wish to remove only a single resonance, the first and last peaknumber should be the same. After deleting these resonances, theresonances are resequenced, e.g., if you delete resonances 1 to 3 froma 10-resonance model, the remaining resonances are numbered 1 to 7.

remove all Removes all resonances from the model. Before removing the peaks,you are prompted for a confirmation. If you confirm the action, allresonances are deleted from the model.

undo Restores the model from the last Bayes_Analyze run. Clickingundocauses the menus to read thebayes.params file, resetting themodel to the model in effect just before Bayes_Analyze was run last.But reading thebayes.params file also resets any parameters youmay have modified, not just resetting resonances. For example, if thebayes.params file contains a 15-resonance model with the use of anoise region, and you have since deactivated the use of the noiseregion, after theundo button is pressed, the noise region is active.

Return Returns to the menu just above the current menu in the hierarchy.

interactive Invokes theds program where you can center in on the region whereyou wish to mark peaks. Whends is executed, it displays the locationsof resonances in the current model. Donotuse themark button on thismenu. It isnot the correct menu from which to build a an initial model.This menu is strictly for zeroing in on the region of interest

Menu 12. Bayes_Mark Menu

Page 36: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

36 Bayesian Analysis Software Package 01-999017-00 B0498

Note that the Bayesian Analysis package makes extensive use of theds program. However,this menu differs from the menus you normally bring up withds . The menus used underthe Bayesian Analysis package have been modified to perform specific tasks needed by thepackage; the normal VNMR menus do not perform these tasks.

Mark Menu

The Mark menu is a modified version of theds menu. With the Mark menu, you can markthe resonance frequency for singlets, multiplets, and multiplets of multiplets. Whenmarking multiplets, more than one piece of information must be marked and thatinformation must be marked in a specific order. For example, to mark a multiplet ofmultiplets, you must mark the center of the multiplet, the primaryJ coupling, and thesecondaryJ coupling, in that order. We illustrate marking such multiplets later.

The Mark menu appears as follows:

To mark a singlet, position the cursor to the center of a line (thenl command can be usedto set the exact location), and press themark button on this menu.

As noted previously, only themark button on theds menu brought up by the BayesianAnalysis package may be used to mark peaks. Usingmark from a normalds menu doesnot work. Multiple resonances can be marked on the Mark menu provided the resonancesare all the same type. For example, if you are marking doublets, you may mark any numberof doublets. However, if you wish to mark multiplets of different order, you must go up tothe menu that sets the multiplet order, set the order, and then come back to the Mark menu.

The Mark menu is also used to mark multiplets and multiplets of multiplets. The mostcomplicated thing you can specify is a multiplet of multiplets, and if you understand how

mark Invokes theds program. It is here that youmustmark peaks if they areto become part of the initial model used in Bayes_Analyze. To mark amultiplet of multiplets, you must mark the center of the multiplet, theprimaryJ coupling constant (the largest coupling constant), and thesecondary coupling constant, in that order. Marking multiplets requireyou to mark the center and the coupling constant. Singlets require youto mark the center of the line. For more on how to mark resonances,see the section “Mark Menu,” this page.

primary ptrn Changes to the Bayes_Primary_Pattern menu. From this menu you setthe primary order of any multiplets you wish to mark. If the primaryand secondary patterns are set, you can change or disable them fromthis menu. For more on this menu, see the section“Bayes_Primary_Pattern Menu,” page 37.

uncorrelated Sets the type of peaks to be marked to resonances having eithercorrelated or uncorrelated phases. The default is correlated. Thisdefault is in effect even if you have set the default model for theautomatic mode of Bayes_Analyze to uncorrelated

rel phase Sets the relative phase of the sinusoids. For example, if you know thatthis particular resonances is 180° degrees out of phase with the otherresonances, then setting the relative phase to 180 results in a positiveamplitude for this resonances.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 13. Mark Menu

Page 37: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 37

to mark such a multiplet, marking singlets and multiplets is simple.Figure 5 to Figure 8illustrates the process. These figures correspond to the four steps needed to mark a multipletof multiplets. The multiplet being marked is a septet of doublets, about as complicated asspin one-half multiplets get.

When you change to the Mark menu, you receive a message in the graphics window thatindicates what type of multiplet is being marked and what you must mark:

• When marking multiplets of multiplets, you must mark the center, the primaryJ, andthe secondaryJ coupling constants, in that order. The primaryJ coupling is the largerof the two coupling constants.

• For multiplets, as opposed to multiplets of multiplets, you must mark the center andtheJ coupling.

• For singlets, you must mark only the center.

Figure 5illustrates marking the center of the multiplet. We have indicated the center of themultiplet using a double cursor. When a double cursor is used to indicate a single number,it is the average of the position of the two cursors that is used. By averaging the location ofthe two cursors, the center of the multiplet is located. The center of the multiplet could alsohave been marked using a single cursor positioned in the valley at the center of themultiplet.

Figure 6 illustrates the second step in marking a multiplet of multiplets. Here the primaryJ coupling constant is being marked. A double cursor must be used. The initial guess forthe primaryJ coupling constant is set to the positive difference in these two cursorlocations. Many different combinations of peaks could have been used to indicate thisdifference. Here, a set of peaks off on the side were used to illustrate this.

Figure 7 illustrates the third step in marking a multiplet. Here, the secondaryJ couplingconstant is being marked. A double cursor must again be used and again several differentcombinations of peaks could be used to indicate this difference. If there is more than onemultiplet of the same order, that must be marked. You may mark all of these before clickingtheReturn button.

When you are done marking, click theReturn button. Macros process the mark file and, ifyou have marked things correctly, you receive an output similar toFigure 8.

Note that both the center of the multiplet and the position of the individual peaks have beenindicated. If you mark the peaks from this menu and you do not mark everything correctly,you receive an error message. If you marked the peaks from some otherds menu, nothinghappens—no errors, no messages—when you click theReturn button.

Bayes_Primary_Pattern Menu

The Bayes_Primary_Pattern menu sets the order of the primary multiplet. For multiplets ofmultiplets, the primary multiplet is the multiplet with the larger coupling constants. Settingthe multiplet order is done on the following menu:

To set the multiplet order, click ondoublet, triplet , orquartet, whichever is appropriate.If the order is greater than a quartet, you must click thegtr button and then type in the orderof the multiplet. When you set the primary multiplet order, the2ndry button toggles to“2ndary.” By clicking the2ndry button, you may set a secondary multiplet order.

Menu 14. Bayes_Primary_Pattern Menu

Page 38: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

38 Bayesian Analysis Software Package 01-999017-00 B0498

Note that the multiplet order is odd, a septet, so there is no peak in thecenter of the multiplet. To mark the center, we marked two peakssymmetrically about the center. The macros average the location of thetwo cursors to get the location of the center of the multiplet. The centerof the multiplet could have also been marked using a single cursor at thecenter. In this case, that means marking the valley where the center of themultiplet is located.

Figure 5. Step 1: Marking the Center of a Multiplet

Figure 6. Step 2: Marking the PrimaryJ Coupling

The primaryJ coupling constant is defined to be the largestJ in themultiplet. We have marked two peaks that are indicative of this couplingconstant. It is the positive difference between these two cursor locationsthat indicate theJ coupling. Many different combinations of peaks couldhave been used to mark the primaryJ.

Page 39: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 39

Figure 7. Step 3: Marking the SecondaryJ Coupling

The secondaryJcoupling constant is defined to be the smallest of the twocoupling constants. To mark this coupling constant, we have selected twopeaks that are indicative of the coupling and used a double cursor to markthem. As with the primary coupling constant, many different pairs ofpeaks could have been used to mark this coupling constant.

Figure 8. Step 4: Display after Marking the Multiplet Correctly

If you marked the multiplet correctly, this is the type of display youreceive after you press theReturn button on the interactiveds menu. Theposition of the center of the multiplet and individual peaks have beennoted. If you did not mark the multiplet correctly, you receive an errormessage and this display does not appear.

Page 40: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

40 Bayesian Analysis Software Package 01-999017-00 B0498

Table 1 lists the names for the multiplets and amplitude ratios. Note that the maximummultiplet order is twelfth order. We could have easily allowed higher order multiplets, butthere was little reason to so. On a twelfth-order multiplet, the ratio of the largest to smallestpeak area is 1:462 and the signal-to-noise ratio required to detect this multiplet is so largethat, for all practical purposes, larger multiplet orders are not detectable. Before theBayes_Analyze program actually usesTable 1, amplitudes given in the table are normalizedso that the total amplitude is 1. Consequently, the amplitude reported for a multiplet is thetotal integral over all peaks in the multiplet.

Bayes_Secondary_Pattern Menu

If you set the primary multiplet order and then select the secondary option, you are broughtto the Bayes_Secondary_Pattern menu:

Functionally, this menu is identical to the Bayes_Primary_Pattern menu except that hereyou set the order of the secondary multiplet. Note that the maximum secondary multipletorder is also 12. The relative amplitudes and names of the secondary multiplet are the sameas the primary multiplets and are given inTable 1.

Bayes_Find Menu

The Bayes_Find menu is used to generate an initial model of singlets. After specifyingsome initial information about the resonances, you click thefind button. From the outputof the find command, the scripts build the appropriate Bayesian parameters. Like the mark

Table 1. Pascal’s Triangle

Multiplet Name Relative Amplitudes

Singlet 1

Doublet 1 1

Triplet 1 2 1

Quartet 1 3 3 1

Pentet 1 4 6 4 1

Heptet 1 5 10 10 5 1

Septet 1 6 15 20 15 6 1

Octet 1 7 21 35 35 21 7 1

Nonatet 1 8 28 56 70 56 28 8 1

Decatet 1 9 36 84 126 126 84 36 9 1

Undecatet 1 10 45 120 210 252 210 120 45 10 1

Dodecatet 1 11 55 165 330 462 462 330 165 55 11 1

This table lists the names and relative amplitudes of the primary and secondary multipletorders. Note that before the model is run, the Bayes_Analyze program normalizes this table sothat the total area of a multiplet is 1. Consequently, the amplitude reported for a multiplet isthe total amplitude for all of the peaks within the multiplet.

Menu 15. Bayes_Secondary_Pattern Menu

Page 41: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 41

procedures, it is only the find command accessed thought the Bayesian Analysis menus thatcorrectly finds peaks. The Bayes_Find menu looks as follows:

To use this menu to find peaks, you indicate what types of peaks are to be found, correlatedor uncorrelated, (the default is correlated) and then click thefind button to find the peaks.Here are the actions of each button on the menu:

Using thefind button is illustrated inFigure 9 andFigure 10. Setting the region and thethreshold must be done before you use thefind button. This is illustrated inFigure 9. Formore on setting the region and the threshold see the next section.

After selecting the region and setting the threshold, click thefind button. If everything iscorrect, you receive the display illustrated inFigure 10. Note that this display shows all ofthe peaks in the current model in the region displayed. If extraneous peaks were marked orpeaks were marked that correspond to noise, you should delete them from the model beforerunning the analysis program. Deleting peaks is done from the Bayes_Initial_Model menu.For more on this menu, see “Bayes_Initial_Model Menu,” page 34.

Find-Interactive Menu

The Find-Interactive menu is a copy ofds menu. Before you use thefind button on theBayes_Find menu, you must first expand the region of interest and then set the threshold.Figure 9illustrates setting the region and the threshold. The region has been expanded andthe threshold set so that the peaks of interest are above the threshold.

After these have been set, click theReturn button to change to the Bayes_Find menu. Atthis point, you are ready to click thefind button to identify the peaks above the threshold.These are, in turn, incorporated into the initial model as singlets. I

interactive Enables you to select the region where you wish to find peaks.Only the region displayed in the graphics window is used in findingpeaks. The threshold is used to determine what peaks to include. Thethreshold is set by clicking thenext button on the interactiveds menuand then clicking theTh button. Note that the threshold must be setcorrectly before you find peaks.

find Uses thefind command to mark the location of all peaks greater thanthe threshold. Only peaks in the region that are displayed in thegraphics window are examined, and only peaks greater than thethreshold are selected. After finding the appropriate peaks, the scriptsmark the location and the number of each peak found. These are, inturn, displayed in the graphics window. If this display does not appear,something is wrong; probably you have not used thefind button fromthe Bayes_Find menu.

uncorrelated/correlated

A toggle that allows you to set whether the peaks you are finding areto be correlated or uncorrelated phase resonances.

relative phase Allows you to set the phase of the resonance to be 0, 90, 180, or 270degrees out of phase with the common phase parameter. This assumesyou are finding correlated resonances.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 16. Bayes_Find Menu

Page 42: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

42 Bayesian Analysis Software Package 01-999017-00 B0498

Figure 9. Finding Singlets: Setting the Region and Threshold

This figure illustrates setting both the region and the threshold. To set theregion, use the cursor to zoom in on the region of interest and then setthe threshold. Here, we have set the region and the threshold so that largeparts of the spectrum are being ignored.

Figure 10. Finding Singlets: Using thefind Button

After setting the region and the threshold, thefind button was activated.In this example a total of six peaks were found. When the find issuccessful, you receive this plot in the graphics window showing youwhat peaks were found.

Page 43: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 43

If everything works correctly, the graphics screen is updated with the locations of the foundpeaks. This is illustrated inFigure 10. Note that the peaks used to illustrate thefind buttonare multiplets, but thefind button has incorporated them into the initial model as singlets.If you wish to incorporate the multiplet structure, you must use the mark menu.

Bayes_Data_Params Menu

The Bayes_Data_Params menu is used to set the FIDs to be processed, determine how theyare to be processed, toggle on a noise region, and set the exponential filter used in the signaldetection calculations. Here is what the menu looks like:

This is the form of the menu that is brought up if the FID being processed is arrayed. If theFID is not arrayed, the buttons1st fid, last fid,and # fidsdo not occur. Here is anexplanation of the buttons:

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if an analysis has beenstarted. The format of the status display is given in “Status Display,”page 70.

1st fid Prompts you to enter the number of the first FID to process. Thisparameter defaults to a value of 1. However, you may set it to any valueless than or equal to the VNMR parameterarraydim . The parameterset by this button is used to set the “First Fid” line in thebayes.params file. See “bayes.params.nnnn andbayes.model.nnnn Files,” page 74, for the format of the parameter file,and see Chapter 3, “Bayesian Analysis Programs,” for more on howthe Bayes_Analyze program uses this parameter.

last fid Prompts you to enter the number of the last FID to process. Thisparameter default to a value of thearraydim parameter. However,you may set it to any value less than or equal toarraydim . Theparameter set by this button is used to set the “Last Fid” line in thebayes.params file. See “bayes.params.nnnn andbayes.model.nnnn Files,” page 74, for the format of the parameter file,and see Chapter 3, “Bayesian Analysis Programs,” for more on howthe Bayes_Analyze program uses this parameter.

# fids Prompts you to enter the number of FIDs that are to be processed atone time. For an arrayed FID, this parameter default to a value of thearraydim parameter. However, you may set it to any value less thanor equal toarraydim . The parameter set by this button is used to setthe “No Fids” line in thebayes.params file. Bayes_Analyze blocksFIDs into groups. The size of these groups is determined by the settingof this parameter. See “bayes.params.nnnn and bayes.model.nnnnFiles,” page 74, for the format of the parameter file.

Menu 17. Bayes_Data_Params Menu

Page 44: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

44 Bayesian Analysis Software Package 01-999017-00 B0498

When an arrayed FID is analyzed, the Bayes_Analyze program processes the data startingwith the “first fid,” proceeding to the “last fid” in groups of “number of fids” at a time. Forexample, if “first fid” is 1, “last fid” is 10, and “num fids” is 3, the program processes 4 setsof FIDs; three runs having 3 FIDs in each, and one having one FID.

When the Bayes_Analyze program processes multiple FIDs at a time, it looks forresonances common to all those FIDs. Each resonance has a different amplitude in each ofthe different FIDs, but the same resonance frequency, decay rate constant and, if applicable,phase. For example, if there are 40 FIDs and 20 correlated resonances, then Bayes_Analyzeis doing roughly the equivalent of a nonlinear least squares search in 20 frequencies, 20decay rate constants, one phase, 20 noise variances, and 20× 40 amplitudes, for a total of861 parameters. Because Bayes_Analyze makes extensive use of marginalization, however,it actually only searches in the frequencies, decay rate constants, and phase for a total of 41parameters. This reduces the search by a factor of 21 and makes the program much morepowerful.

Data_Setup_Signal Menu

Clicking thesignalbutton on the Bayes_Data_Params menu takes you to theData_Setup_Signal menu, a copy of thedf menu. This menu is used to set the region ofthe FID to be used in the analysis. The major reason why this can be important is speed. Ifhalf of the FID is signal, the program runs roughly two times faster.

signal Changes to thedf menu to specify the part of the data that is to betreated as signal by expanding the signal region. This operation can beperformed on any FID in an array, and the signal region is used for allFIDs in the array. This parameter is used to set the “Total Points” linein thebayes.params file. See the section “Data_Setup_SignalMenu,” page 44, for more on the use of this menu and see Chapter 3,“Bayesian Analysis Programs,” for more on how the Bayes_Analyzeprogram uses this parameter.

filter Changes to thewti menu to specify the value oflb to be used byBayes_Analyze. The value oflb is used in several different places inthe analysis of the FIDs and by selectively changing this value you canchange the function of Bayes_Analyze. In particular, Bayes_Analyzeuses the value oflb as an initial guess for the value of the decay rateconstant associated with resonances added in automatic mode.Additionally, the signal detection routine useslb as a given in itscalculations. So, by varyinglb you can make Bayes_Analyzesensitive to differing time scales of the decay. Very large values oflbmakes the program sensitive to rapid decay, while small values makesit sensitive to long lived resonances. The actual value oflb isimportant only to the degree that it needs to be of the right order ofmagnitude. Thelb parameter is used to set the “Default Lb” line in thebayes.params file. See the section “Data_Setup_Filter Menu,”page 45, for the format of this file, and see Chapter 3, “BayesianAnalysis Programs,” for more on how the BayesAnalyze program usesthis parameter.

noise Changes to thedf menu so you can specify a region of the data to beused in computing the root-mean-square noise value. You specify theregion by expanding the end of the FID. That expanded region isassumed to be noise. See “Bayes_Noise Menu,” page 47, for more onthis menu.

Return Returns to the menu just above the current menu in the hierarchy.

Page 45: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 45

Figure 11 andFigure 12 are used to illustrate how to use this menu in setting the signalregion. To set the signal region you use a double cursor to select the region of interest. Thisis illustrated inFigure 11. After selecting the region, click theexpandbutton, as illustratedin Figure 12. After expanding the region, click theReturn button to indicate you are donesetting the signal region. You are then prompted to confirm the number of points to use asthe signal region. If you confirm this number, it is used in the calculations. If not, you areprompted to enter the number of total points you wish to use. The entered or confirmedvalue is then used to set the “total points” and “complex points” lines in thebayes.params file. See Section 4.3 for more on this file.

Data_Setup_Filter Menu

Clicking thefilter button in the Bayes_Data_Params menu changes you to theData_Setup_Filter menu, a copy of thewti menu. When this menu is displayed, youreceive the display illustrated inFigure 13.

To use thewti menu to set the value oflb , the line broadening parameter, make sure thatonly the value oflb is in use.Using any other filter function results in an incorrect settingof thelb parameter.Setlb to a reasonable value, as illustrated inFigure 13, and click theReturn button. The menus then perform a discrete Fourier transform the FID and returnyou to the menu. Thelb parameter is used to set the “Default Lb” line in thebayes.params file. You may also setlb using the standard VNMR commands.

The value oflb is used in two different contexts within the Bayes_Analyze program:

• In the automatic mode,lb is used as the initial guess for the value of the decay rateconstant associated with a resonance. The actual value oflb needs to be set only to thecorrect order of magnitude of the decay for the Bayes_Analyze program to workcorrectly.

• The value oflb is used in a signal detection calculation. In its “automatic” mode, theBayes_Analyze program uses a signal detection calculation on the residuals to obtain

Figure 11. Selecting a Signal Region

To select a region, click thesignalbutton and then use a double cursor toselect the region. Note that the beginning of the signal is assumed to bethe front of the FID, so only the cursor on the right counts.

Page 46: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

46 Bayesian Analysis Software Package 01-999017-00 B0498

Figure 12. Setting the Signal Region

When you expand the region, you indicate to the system that this is theportion of the data that contains signal.

Figure 13. Setting thelb Parameter

This illustrates the VNMRwti menu, which is used with the BayesianAnalysis package to set the value oflb . Here,lb is set and we are nowready to return to the Bayesian Analysis menus to complete the setup.

Page 47: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 47

an initial estimate of the resonance frequency for the next resonance to be added to themodel. The definition of a signal is a constant plus an exponentially decaying sinusoid.The value oflb is used as the decay rate constant in this calculation.

Bayes_Noise Menu

The presence of noise at the end of a FID can be put to good use because it sets a scaleagainst which the size of the resonances can be measured [14]. The programs in BayesianAnalysis have been written to use this information.

To indicate that a part of the input data is to be interpreted as noise, click thenoisebuttonon the Bayes_Data_Params menu. This takes you to the Bayes_Noise menu:

From this menu you can indicate that noise is to be taken into account. Here is the meaningof the various buttons on this menu:

After setting starting position of the noise, the macros then run a program that computes theroot- mean-square of the noise from the indicated region. This information is written to thebayes.noise file. See [14] for more on what you gain by using a noise region, and seeChapter 4, “Output Files,” for the format of thebayes.noise file.

Bayes_Model_Params Menu

The Bayes_Model_Params menu is used to set optional parts of the model, for example, theconstant models, the phase of the sinusoids, the lineshape, and some parameters associatedwith the search. Here is the Bayes_Model_Params menu:

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if started. See Chapter4, “Output Files,” for the format of the status display.

region Changes you to thedf menu so you can expand the part of the FID thatis to be considered noise. To set the noise region, first choose the regionusing a double cursor, as illustrated in Fig. 9(A) Note that the menusassume that the noise is at the end of the FID and expanding the regiononly sets the point in the FID beyond which the data is to be interpretedas noise. To set the noise region, you then expand the region asillustrated in Fig. 9(B) and click theReturn button. You are thenprompted to confirm the starting position of the noise. You may accept,cancel, or enter the value you wish to use. The starting value of theregion is used to set the “Noise Start” line in thebayes.params file.See Chapter 4, “Output Files,” for the format of this file.

noise on/off Toggles the use of the noise region on and off. This button sets the“Noise” line in thebayes.params file. See Chapter 4, “OutputFiles,” for the format of this file.

scale Scales the magnitude of the noise by an arbitrary constant.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 18. Bayes_Noise Menu

Menu 19. Bayes_Model_Params Menu

Page 48: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

48 Bayesian Analysis Software Package 01-999017-00 B0498

Figure 14. Setting a Noise Region

This figure illustrates the use of thedf menu in setting the noise region.The Bayesian Analysis package naturally assumes the noise is at the endof the FID. Therefore, in setting the noise region you must expand theback part of the spectrum. Here, the red lines denote the position of thecursors just prior to expanding the region. Clicking theexpandbuttonexpands the noise.

Expanding the back part of the signal is all that you must do to specifythe noise region.

Figure 15. Expanding the Noise Region

Page 49: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 49

The buttons have the following functions:

Bayes_Constants Menu

When modeling the signal received by an NMR spectrometer, it is necessary to take intoaccount all of the signals received by the spectrometer; not just the signal of interest. Thesignals of interest are the sinusoidal resonances but there are other artifacts in the data.

For example, if phase cycling is not used, the FID may have a constant component. Thisconstant is of no particular interest, but if it is not modeled, it would manifest itself as aresonance at zero frequency. Therefore, to model the data correctly, this constant must beaccounted for.

Many different types of constant models are possible. The Bayesian Analysis package dealswith four different constants:

• A constant offset in the real channel

• An offset in the imaginary channel

• An offset in the first data value

• A constant in both channels

Many more constant models are possible; however, these four account for many of theartifacts commonly seen in NMR data. These constant models are in effect for both theslave and automatic modes of Bayes Analyze. The four constant models are selected on theBayes_Constants menu:

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if started. See Chapter4, “Output Files,” for the format of the status display.

constants Sets various types of constant models that are to be in effect for theentire run. When this button is activated, you are taken to theBayes_Constants menu. From this menu, you can select from thevarious types of constant models. See “Bayes_Constants Menu,” page49, for more on this menu

phase Sets the phase of the sinusoidal model used in the “automatic” mode.This button takes you to the Bayes_Phase menu where you mayspecify the phase of the default sinusoids. See “Bayes_Phase Menu,”page 50, for more on this menu. Note that setting this default does notaffect the phase of any resonances currently modeled, nor does it affectthe phase of any resonances you may wish to add manually to thecurrent model. It only affects the phase of the resonances that areadded in the automatic mode on the next run of Bayes_Analyze.

lineshape Changes to the Bayes_Lineshape menu. so that you can togglebetween Lorentzian and non-Lorentzian lineshape and set the order ofthe expansion. See“Bayes_Lineshape Menu,” page 51, for adescription of this menu. ~

max newresonances

Sets the maximum number of resonances to be incorporated into themodel on this run of Bayes_Analyze. The default value for thisparameter is 10.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 20. Bayes_Constants Menu

Page 50: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

50 Bayesian Analysis Software Package 01-999017-00 B0498

Setting these four models is controlled by four different toggle buttons in the menu. Thesefour buttons toggle the various constants on and off:

Note that any or all of these models may be turned on at one time, but this is notrecommended because it costs time in inverting a matrix that shows up in optimizing theresonance parameters and because these four models are highly redundant.

Bayes_Phase Menu

The model described byEquation 3 onpage 27 has a phase parameter for each sinusoidalresonance. This phase may be the same as the phase in other resonances or it may bedifferent. If the phase is the same, the sinusoids are said to have correlated phase, and if thephase is different, they are said to have uncorrelated phase. The Bayes_Phase menu lets youselect which of these two resonance models to use in the automatic mode. Here is the menu:

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if started. See Chapter4, “Output Files,” for the format of the status display.

first pointon/off

Used to indicate that the first point in the data may be incorrect. Thenormal setting of this button is on, so the first-point model is thedefault. The reason for this is that in a preceding version ofBayes_Analyze we found in analyzing many different FIDs that thefirst data values were unreliable because the program typically tried tomodel the first few points in the FID with a rapidly decaying sinusoid.This sinusoid decayed so rapidly that, for all practical purposes, it wasmodeling the first point in the data. Consequently, a first-point modelwas added to the new version of Bayes_Analyze. Toggling this buttonturns the first-point model off. The parameters set by this button areused to add a model to thebayes.params file. This model line“First Point Problem” indicates that a first-point model should beincluded in the slave and automatic model. See Chapter 4, “OutputFiles,” for more on setting up the parameter file.

real on/off Used to indicate that a constant model is to be included for a dc offsetin the real channel. This model component is included by adding theline “Real Constant” to thebayes.params file. This component isused both in the slave and automatic modes. See Chapter 4, “OutputFiles,” for more on setting up the parameter file.

imaginaryon/off

Used to indicate that a constant model is to be included for a dc offsetin the imaginary channel. It is also set by including the line “ImaginaryConstant” in thebayes.params file. See Chapter 4, “Output Files,”for more on setting up the parameter file.

joint on/off Used to indicate that a constant offset model is to be included for thesame constant in both channels. Toggling this button on causes the line“DC Offset In Both” to be added to thebayes.params file. SeeChapter 4, “Output Files,” for more on setting up the parameter file

Return Returns to the menu just above the current menu in the hierarchy.

Menu 21. Bayes_Phase Menu

Page 51: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 51

This menu has two toggle buttons. These allow you to toggle between the correlated phasemodel and the uncorrelated phase model, and they allow you toggle on and off phasecorrection. Here is a explanation of the buttons on this menu:

It was noted earlier that clicking theuncorrelated button toggles between a resonancemodel that has correlated or uncorrelated phase. However, when the default model isuncorrelated, thephase correction onbutton appears blank and the menu has only threebuttons:status, correlated, andreturn . Phase correction is not an option for uncorrelatedresonances. The only action you can take is to clickcorrelated to return to the correlatedmodel. You may not set the phase correction parameter because uncorrelated resonanceseach have a independent phase.

Bayes_Lineshape Menu

The Bayesian Analysis package knows about non-Lorentzian lineshapes. In the frequencydomain, shimming artifacts cause the individual resonances to look like a superposition ofseveral lines. The model implemented in the Bayesian Analysis package is an expansion inLorentzians in the frequency domain. The spacing of these Lorentzians is the same forevery resonance. Every resonance in the spectrum has a unique decay rate constant,however, that affects the widths of the Lorentzians for each resonance. Broad lines arealmost not affected by the expansion, while narrow lines are greatly affected.

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if started. See Chapter4, “Output Files,” for the format of the status display.

uncorrelated/correlated

Toggles between the uncorrelated and the correlated phase model. Thisbutton sets the “Default Model” line in thebayes.params file. Thevalue set is “(CP)” for correlated phase and “(UP)” for uncorrelatedphase. No other values are valid in this file. This parameter is used inthe automatic peak finding mode of Bayes_Analyze. It does not affectwhether the model components used in the slave mode containscorrelated or uncorrelated resonances

phasecorrectionon/off

Turns on a first-order phase correction for correlated phase modelcomponents. This parameter is the analog of the VNMR parameterlp .VNMR measures the linear change in phase by two parameters: aphase at the left-hand-side of the spectrum (lp ), and a phase at theright-hand-side of the spectrum (rp ). The Bayesian Analysis packageuses a center phase (the phase at timet = 0) and a time the acquisitionstarted (t0). The main difference between the VNMR parameters andthe Bayesian parameter are units. However, in the two packages(VNMR and the Bayesian Analysis package) these parameters servedifferent functions. The VNMR parameters are used for presentationpurposes and, as such, are used to undo the effect of both zero- andfirst-order phases in the spectrum. The Bayesian parameters are usedto model these phase effects and make the modeled FID look as muchlike the FID as possible. So while the VNMR parameters and theBayesian parameters appear superficially the same, they are actuallyquite different quantities.

Return Returns to the menu just above the current menu in the hierarchy.

Page 52: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

52 Bayesian Analysis Software Package 01-999017-00 B0498

The menu that allows you to switch on the non-Lorentzian lineshape model and to specifythe order of the expansion is the Bayes_Lineshape menu:

By clicking on one of the expansion orders buttons (3rd order, 5th order, 7th order), youturn on the lineshape expansion. Thenonebutton can be used to turn off the expansion.

To illustrate the results of using this model.Figure 16shows the spectrum of a very poorlyshimmed data. Note that in the residuals, there are still errors in the lineshape. In this case,the lineshape is so complicated that a seventh-order shimming model simply cannot fit allof the variations.

Bayes_Execution Menu

The Bayes_Execution menu is used to control the execution of Bayes_Analyze andBayes_Model. Here is the Bayes_Execution menu:

When you click on theexecor theinteractive button, the parameters that describe theanalysis are written to thebayes.params file, and the Bayes_Analyze program is thenrun either interactively or in batch. If you click themodelbutton, the appropriate modelfiles are updated and the Bayes_Model program is run. Here is what the various buttons do:

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if started. See Chapter4, “Output Files,” for the format of the status display.

mode Changes to the Bayes_Batch_Mode menu. From this menu you mayselect the model in which you want to run the analysis: interactive,background, or batch. See “Bayes_Batch_Mode Menu,” page 54, formore on this menu.

exec Writes the analysis parameters to thebayes.params file, and thenruns the Bayes_Analyze program as a batch

notify Puts VNMR into a wait state so that VNMR waits until the analysis iscompleted. The wait state can be interrupted by clicking theCancelCmd button on the VNMR master menu. Note that clickingCancelCmd cancels the wait, not Bayes_Analyze. To cancel Bayes_Analyze,you must click thecancelbutton.

cancel Cancels the task that is running the analysis for this experiment. Notethat you may have multiple copies of Bayes_Analyze running. Thesecopies of Bayes_Analyze use different VNMR experiments. The taskthat is canceled by this button is the task corresponding to theexperiment that you are currently in.

interactive Writes the analysis parameters to thebayes.params file, and thenruns the Bayes_Analyze program interactively

model Changes to the Bayes_Model menu and from there to exp5.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 22. Bayes_Lineshape Menu

Menu 23. Bayes_Execution Menu

Page 53: Bayesian Analysis User Guide

2.2 Bayes_Analysis Menu

01-999017-00 B0498 Bayesian Analysis Software Package 53

Figure 16. Seventh-Order Shimming Example

This spectrum is one of 64 different spectra obtained in aT2 measurement. This isthe first time the experimenters were able to get the experiment to run correctly,and no effort was made to shim thisin vivosample. In this display, the lower panelcontains the original data (blue), the model of the line from Bayes_Analyze(yellow), and the overlap shows up as red. In the middle panel, we have theresiduals. Last, the upper panel shows the modeled line. Note how far fromLorentzian this seventh-order lineshape model is. This type of performance of thelineshape model is exceptional.

Page 54: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

54 Bayesian Analysis Software Package 01-999017-00 B0498

The analysis may be run on the local machine or on a remote machine. You may run theanalysis either interactively or in batch. When you run the analysis interactively, VNMR istied up until the analysis is complete. If you run the job in batch, you must not change thecurrent VNMR experiment until the batch job is finished because the batch job is alsomaking changes to this experiment. Batch jobs may be run on local or remote machines.

To run the job on a remote machine, the Bayesian Analysis package assumes the presenceof the Network Queuing System (NQS) and submits the job to the queue. Queues must havethe same name as the machine you are submitting the job to. There are three requirementsfor the remote machine to be able to run batch jobs: first, it must have the NQS systeminstalled. Second, the remote machine must be able to mount your home directory. Third,the remote machine must be able to read the FID in your home directory. This presupposesthat if the FID is on a remote disk, the machine running the analysis has that disk mounted.

Bayes_Batch_Mode Menu

The Bayes_Batch_Mode menu is used to set how an analysis is to be run. The choices arein interactive, background, foreground, or batch. Here is a copy of the menu:

The buttons on this menu function as follows:

2.3 Bayes_Results MenuThe Bayes_Results menu appears in several places in the Bayesian Analysis menuhierarchy: on the Bayes_Analysis, the Bayes_Display, and the Bayes_Analyze menus.Here is the Bayes_Results menu:

interactive Sets that the analysis is to be run interactively. In this mode, VNMR isdedicated to running the analysis. This mode may be canceled usingthecancel cmdbutton on the VNMR Permanent menu.

foreground Runs the analysis in the background and automatically causes VNMRto wait for the analysis to finish.

background Runs the analysis in the background, but VNMR does not wait for theanalysis to finish. When this mode is selected, VNMR is available andcan be used for other work. Note when this mode is selected, youshould leave this experiment. If you do not leave this experiment, youmust either enter thebayes command again or click thestatusbuttonto force the macros to read the updated parameter files.

batch Runs the analysis in the batch mode.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 24. Bayes_Batch_Mode Menu

Menu 25. Bayes_Results Menu

Page 55: Bayesian Analysis User Guide

2.3 Bayes_Results Menu

01-999017-00 B0498 Bayesian Analysis Software Package 55

The buttons have the following functions:

Bayes_Reports Menu

When Bayes_Analyze runs, it produces several reports, including an output report thatdetails the models Bayes_Analyze tests. This report is written to a file and that file may bedirected to a printer or to the text window of VNMR. The Bayes_Reports menu is used toperform this task for the output report and for several other reports. Here is the menu:

Here is what the various button do:

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if started. See Chapter4, “Output Files,” for the format of the status display.

reports Changes to the Bayes_Reports model. From there you may select anumber of different reports to be printed or viewed in the text window.See “Bayes_Reports Menu,” page 55, for more information.

setup Changes to the Bayes_Setup_Mod menu. The default model setup is tomodel the index number displayed at the top of the VNMR masterwindow. The number of data values modeled defaults tonp . See“Bayes_Setup_Mod Menu,” page 56, for more information.

model Runs the Bayes_Model program

Return Returns to the menu just above the current menu in the hierarchy.

hardcopy/display

Toggles between output to go to the text window or to the printer. Thedefault is to the text window.

report full Copies the bayes.output.nnnn file to the appropriate outputdevice. For details, see “bayes.params.nnnn and bayes.model.nnnnFiles,” page 74.

summary 1 Prints or displays the summary1 report produced by the programBayes_Summary1. This program reads essentially all of theBayes_Analyze output files, locates the part of the various files thatcorrespond to the model with maximum probability, and then prints areport containing only the information relevant to that model. Fordetails on the report, see “bayes.summaryl.nnnn File,” page 92.

summary 2 Prints or displays the summary2 report produced by the programBayes_Summary2. This report lists a frequency with its amplitude;consequently, it can only be used on nonarrayed FIDs. For details, see“bayes.summary2.nnnn File,” page 93

Probs Prints or display the contents of the probabilities file for the currentindex. For more on the probabilities file, see “bayes.probabilities.nnnnFile,” page 93.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 26. Bayes_Reports Menu

Page 56: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

56 Bayesian Analysis Software Package 01-999017-00 B0498

Bayes_Setup_Mod Menu

The model setup menu, Bayes_Setup_Mod, is used to set the parameters associated withmodeling the results of an analysis. Here is a copy of this menu:

Here is a more detailed explanationof the buttons:

2.4 File-Transfers MenuThe File-Transfers menu is used to save and load files from a VNMR experiment. Whenyou access this function under the Bayesian Analysis package, this menu has all of thenormal functions of the VNMR files menu and, additionally, can save and load all filesstarting with the prefixbayes .

By using thesave andload buttons supplied on this menu, you can save all of the resultsfrom the Bayesian Analysis package and later reload them for additional processing.However, note that exp5 contains a model FID and not the original data. If the File-Transfers menu is used in exp5 to replace the original FID,it destroys your original data.

The menus prompt you to confirm the save/load operation. If you confirm it, your originaldata is deleted.Never use the save function from exp5 to overwrite the original FID.

status Displays the current settings of the Bayesian Analysis parameters. Italso determines the status of the current analysis if started. See Chapter4, “Output Files,” for the format of the status display.

set fid size Sets the size of the output model FID. This number may be any validvalue. The Bayes_Model program either truncates or zero pads theFID, whichever is appropriate. This button sets the line beginning“model points” in both thebayes.params file and thebayes.params. nnnn file. The default value is the size of the FIDas specified bynp . For more on these files, see “bayes.params.nnnnand bayes.model.nnnn Files,” page 74.

select fid Sets which FID in an array is to be modeled. The default is to modelcurrent index displayed in the master VNMR window. This button setsthe line beginning “model fid” in both t thebayes.params file andthebayes.params.nnnn file. For more on these files, see“bayes.params.nnnn and bayes.model.nnnn Files,” page 74.

read params Forces the menus to read in a parameter file. This is needed when anarrayed FID has been processed in blocks and you wish to model oneof the FIDs not contained in the current parameter file. The numberentered must be the full four digit number of the parameter filecontaining the analysis of the FID of interest.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 27. Bayes_Setup_Mod Menu

Page 57: Bayesian Analysis User Guide

2.5 Bayes_Display Menu

01-999017-00 B0498 Bayesian Analysis Software Package 57

2.5 Bayes_Display MenuThe Bayes_Display menu allows you to view the results from the Bayes_Analyze programin a form that is both familiar and convenient. The output from the Bayes_Analyze programis a series of files that contain reports and descriptions of what the analyze program did.These reports contain, for example, the amplitudes and resonance frequencies for all of theresonances in all of the models tested by the Bayes_Analyze program. While thisinformation is often needed, a summary of the information that is convenient and easy tounderstand is required. That is the purpose of the modeling program and the display menu.

The Bayes_Model program takes the output from Bayes_Analyze and creates an arrayedFID in exp5. The array consists of the FID being modeled, the model of the FID, thedifference between the data and the model, and the individual resonances, in that order.From this arrayed FID, the modeling menu can display the spectra in a form that shows youexactly what the analysis program did.

The Bayes_Display menu consists of two parts: a part that deals primarily with spectra anda part that deals primarily with FIDs. Here is the part that deals with spectra:

The buttons on this menu have the following functions:

The second part of the Bayes_Display menu, called the Bayes_Display2 menu, is used todisplay the modeled FIDs. It also has some other displays used for spectra. An explanationof this menu follows:

print/display Toggles back and forth between printing output and displaying output.The default isdisplay. By settingprint , you can make printed copiesof any of plots provided on this menu or you many plot the resultsusing standard VNMR commands.

reports Changes to the Bayes_Reports menu, described in “Bayes_ReportsMenu,” page 55. From this menu you many display or print variousreports generated by the BayesAnalyze program.

over Displays the spectrum of the data, the model, the residuals, and theindividual model components.Figure 17is an example of the display.

vert Displays the spectra data, the model, and the residuals, one aboveanother.Figure 18 shows the vertical display for the31P FID.

interactive Changes to theds menu. This button may be used to focus in onvarious parts of the spectrum.

mAnalyze Returns to the original experiment, reads the appropriate parameterfiles, and bring up the Bayes menu

More Changes to the Bayes_Display2 menu, described next.

Return Returns to the menu just above the current menu in the hierarchy.

Menu 28. Bayes_Display Menu

Menu 29. Bayes_Display2 Menu

Page 58: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

58 Bayesian Analysis Software Package 01-999017-00 B0498

The buttons have the following functions:

print/display Toggles back and forth between printing output and displaying output.The default isdisplay. By settingprint , you can make printed copiesof any of plots provided on this menu or you many plot the resultsusing standard VNMR commands.

over2 Changes to the Bayes_Reports menu, described in “Bayes_ReportsMenu,” page 55. From this menu you many display or print variousreports generated by the Bayes_Analyze program. Theover2button isthe same as theover button on the first part of the menu except that thetop section, the display of the individual resonances, is not produced.Figure 19is an example of this display. The spectra shown are the same31P data used inFigure 18.

vertall Displays modeled resonances stacked one above another.Figure 20isan example of the display. The lower three spectra are the data, themodel, and the residual. Above these are displayed the spectra of theindividual model resonances in order of increasing frequency.

fids Displays all of the FIDs in the model, starting with the original data atthe bottom of the screen.Figure 21 is an example of the FIDs display.

fids3 Displays the first three FIDs in the model.Figure 22is an example ofthis display. The three FIDs are the data, the model, and the residual

Figure 17. Over Display for31P FID

This figure is the over display of an analysis of a31P FID of rat brain analyzed inautomatic model. The spectra of the FID built by the modeling program aredisplayed in three sections. The lower section of the display contain the spectra ofthe data with the spectrum of the model overlaid on it. The spectra of the residualsis shown in the middle section. Last, the spectra of the individual modelcomponents are shown in the upper section of this report. Only resonances in theportion of the spectrum currently being viewed are displayed in the upper section.

Page 59: Bayesian Analysis User Guide

2.5 Bayes_Display Menu

01-999017-00 B0498 Bayesian Analysis Software Package 59

file transfers Changes to the File-Transfers menu (see “File-Transfers Menu,” page56). From this menu, you can save the modeled FID, text, and with anyassociated Bayesian files.

back Returns to the first part of the Bayes_Display menu.

Return Returns to the menu just above the current menu in the hierarchy.

Figure 18. Vertical Display for31P FID

The lower section of the vertical display is the spectrum of the data. The middlesection is the spectrum of the model of the data built created by the modelingprogram, and the top section is a spectrum of the residuals

Page 60: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

60 Bayesian Analysis Software Package 01-999017-00 B0498

This display by theover2 button is the same as that produced by theover button(shown inFigure 17) except the individual peaks are not displayed.

Figure 19. Over2 Display of31P FID

Figure 20. Stacked Vertical Display of Modeled FID

The lower three spectra are the original data, the model, and the residual. Afterthese, the spectra of the individual model resonances are displayed in increasingfrequency order.

Page 61: Bayesian Analysis User Guide

2.5 Bayes_Display Menu

01-999017-00 B0498 Bayesian Analysis Software Package 61

Figure 21. FIDs Display

This display shows all of the FIDs in the arrayed FID built by the modelingprogram, starting with the original data at the bottom of the screen. This isfollowed by the model, the residual, and the resonances. The FIDs shown in thisdisplay are not the same as those used in the other displays. (The large baselineartifact in the31P FID makes use of that data for this display unworkable.)

Figure 22. FIDs3 Display

This display differs from theFigure 21 in that the FIDs associated with theindividual modeled resonances are not shown. Only the raw data, the model of thedata, and the residual are shown.

Page 62: Bayesian Analysis User Guide

Chapter 2. Interface to VNMR: Menus

62 Bayesian Analysis Software Package 01-999017-00 B0498

Page 63: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 63

Chapter 3. Bayesian Analysis Programs

In the previous chapters we have described the interface to VNMR. In this chapter, wedescribe the programs in the Bayesian analysis package.

• 3.1 “Bayes_Analyze Program,” this page

• 3.2 “Bayes_Model Program,” page 66

• 3.3 “Bayes_Noise Program,” page 67

• 3.4 “Bayes_Probs Program,” page 68

• 3.5 “Bayes_Summary Programs,” page 68

3.1 Bayes_Analyze ProgramThe Bayes_Analyze program runs all of the Bayesian analysis and creates all outputreports. In general terms, the Bayes_Analyze program reads a parameter file, optimizes theparameters in the initial model, and then, if permitted, proceeds to add resonances to thespecified model. These three steps are referred to as the initialization mode, the slave mode,and the automatic mode, respectively.

The initialization mode is really the time the program spends reading in the parameter fileand initializing the model to be processed in slave mode. In the input parameter file, thereis a specification that indicates which FIDs are to be processed. This specification is of theform of a “from” FID number, “to” FID number, “by” number of FIDs. From these threenumbers and the size of the FID, the program computes the amount of storage needed tostore the data, and calls the system routines to allocate the needed storage. Because the “by”number may be smaller than the total number of FIDs to be processed, the program loopsusing the “from,” “to,” and “by” numbers to control the loop. It writes out a parameter filethat indicates which set of FIDs are to be processed and then calls a subroutine thatperforms the indicated analysis. This routine next processes the input model in slave mode,and then proceeds to add resonances as permitted in automatic mode. If there are more FIDsto be processed, the next set of FIDs are similarly processed and loop continues until allFIDs have been processed.

The subroutine that performs the analysis using Bayesian probability theory reads theparameter file created by the mainline. This file tells it exactly what FIDs to process andwhat models are to be processed in the slave and automatic modes. In the slave mode, theprogram takes the input model provided and optimizes the parameters associated with thatmodel. This optimization step is a heavily modified version of a Levenberg-Marquardtalgorithm. This algorithm searches for the parameters that maximize the joint marginalposterior probability density for the parameters that appear in modelEquation 3onpage 27in a nonlinear fashion.

A marginal probability density function is a probability density function from which one ormore parameters have been removed by integration. In the case of the joint marginalposterior probability density function, the parameters that were removed by integration

Page 64: Bayesian Analysis User Guide

Chapter 3. Bayesian Analysis Programs

64 Bayesian Analysis Software Package 01-999017-00 B0498

were the amplitude of the correlated resonances and the sine and cosine amplitudes of theuncorrelated resonances. In addition to these amplitudes, the variance of the noise is alsoremoved by marginalization.

The modifications to the Levenberg-Marquardt algorithm are essentially those needed toallow the algorithm to work with these probability density functions. If you are interestedin the details on the Levenberg-Marquardt algorithm, seeNumerical Recipes [15].

Levenberg-Marquardt algorithms are a type of Newton-Raphson algorithms, which useboth first and second derivatives in computing the corrections to the parameter values. Theyare typically quadratic in their convergence, but tend to be linear when the initial guessesare far from the parameter values indicated by the data. Consequently, the search algorithmin Bayes_Analyze tends to be quadratic in its convergence except, of course, when it isn't.

The Levenberg-Marquardt algorithm locates the maximum of the joint marginal probabilityfor the parameters given the data. After this routine has finished, the probability for themodel is computed from the joint marginal probability for the parameters. Thiscomputation involves integrating all of the remaining parameters from the joint marginalprobability density function. Now, if there are many frequencies and decay rate constantsin the model, performing these integrals is essentially impossible, and approximations arerequired. The approximation used is a Gaussian approximation.

To approximate a probability density function as a Gaussian, we must have both the firstand second derivatives of the sufficient statistics. The sufficient statistic is essentiallyexponent that remains after performing the integrals over the amplitudes. Fortunately, andnot accidently, the Levenberg-Marquardt algorithm computes these first and secondderivatives. Consequently, computing the probability for the model, at least approximately,is straightforward.

At this stage in the calculation, Bayes_Analyze has optimized the parameter associatedwith the input model and then computed the probability for that model. The program writesall of the output associated with the model and then either it stops or it goes on to itsautomatic mode. The automatic mode uses both the optimization algorithm and thealgorithm that computes the probability for the model. However, to find resonances it musthave an algorithm that guesses at the location of a resonances.

This guessing routine is the signal detection algorithm. To guess at the location ofresonances, the signal detection algorithm takes advantage of one additional fact aboutsinusoids: if two sinusoids have been sampled atΝ discrete evenly space time increments,and if the two sinusoids differ in frequency by∆, then the sum:

if ∆ = 2πν/Ν, with ν an integer, which is small unless∆ ≈ 2π/Ν. The frequencies at whichthis sum is zero are the frequencies at which a discrete Fourier transform is computed andthe sinusoids associated with these frequencies are orthogonal. This fact is at the heart ofwhy the discrete Fourier transform has multiple peaks when the data has multiplefrequencies.

The signal detection routine uses this to significant advantage. After the parametersassociated with a model have been optimized, the signal detection routine subtracts a time-domain model generated from the most probable value of the parameter from the data.Because sinusoids are almost orthogonal, subtracting this model signal from the dataremoves the modeled resonances. So the residual is almost exactly the unmodeled signal.Using this residual, the signal detection routine then computes both the probability for a“signal” and a “no signal” model.

∆t( ) 0=cost 0=

Ν 1–

Page 65: Bayesian Analysis User Guide

3.1 Bayes_Analyze Program

01-999017-00 B0498 Bayesian Analysis Software Package 65

The signal model is an exponentially decaying sinusoid plus a constant. The no signalmodel is just the constant. The probability for the signal model is computed given the valuesof the frequency and decay rate constant. The base 10 logarithm of the ratio of these twoprobabilities is computed. This ratio is called an odds ratio and, when the logarithm istaken, it is called the log-odds.

If the log-odds is negative as a function of frequency, it is indicative of no signal in the dataat that value of the frequency; if it is positive, it is indicative of a signal. In a typical dataset, it is not unusual for this log-odds to be in the hundreds. If the log-odds is l00, it is a betof 10100:1 that there is a “signal” at this value of the frequency.

After computing this statistic, the routine compiles a table of peaks and the correspondingodds for each peak. This table is then ordered by decreasing odds ratio and used by theroutine that controls the automatic mode to build a model. The number of peaks icorporatedinto the model from this table is under user control, but experience dictates that the onlysafe course is to incorporate peaks one at a time. Indeed, the menus default to incorporatingone peak at a time and the only way you can change this is to manually modify theparameter file.

Assuming one peak is used, the controlling routine postulates a model having oneadditional resonance located at the frequency having maximum signal detection odds. Theresonance incorporated into the model is either a correlated or an uncorrelated singlet,depending on what the user selected when the analysis was set up. The initial guess for thedecay rate constant is set to the current value of parameterlb . The new model, containingone additional resonance, is then processed by the optimization routines exactly as if it werebeing optimized in the slave mode.

Note that even though only a single resonance was added to the model, the parametersassociated with all of the resonances are optimized. This is done because while it is true thatsinusoids are almost orthogonal, in fact they are not exactly so, and the presence of the newresonance changes the location of the maximum of the joint posterior probability for theparameters.

After the maximum of the joint posterior probability is located, the probability for themodel is computed and the various output files are updated. If the probability for this modelincreases, the controlling routine repeats the signal detection calculation and the entireprocess is repeated until one of three conditions occurs:

• The signal detection routine fails to find evidence for additional resonance in the data.

• The probability for the model decreases.

• The user-specified maximum number of new resonances to add to the model has beenreached.

The Bayes_Analyze program takes several different command line arguments. As noted inthe introduction, the name of the program isbayes_analyze with no capitalization. Ifthe program is run with no command line arguments, here is the output you receive:

Developed by Monsanto St. Louis NMR Center and

Washington University School of Chemistry

Usage: bayes_analyze INPUT_FILE

where INPUT_FILE is the name of the input PARM file

or 'limits' (to display program limits)

This message is purely informational and indicates that two different formats for thecommand line argument are permitted:

Page 66: Bayesian Analysis User Guide

Chapter 3. Bayesian Analysis Programs

66 Bayesian Analysis Software Package 01-999017-00 B0498

• The first specifies the name of a parameter file (INPUT_FILE ) that under the menuscontrol is namedbayes.params but, in fact, can have almost any name.

• The second takes the argumentlimits . When this argument is entered,Bayes_Analyze displays some limits that were specified when the program wascompiled. This form of the command line argument is used by the menus and macrosto obtain the maximum values that are displayed.

Here is a typical example of this output:

Developed by Monsanto St. Louis NMR Center

and Washington University School of Chemistry

fids 64 np 65536 resonances 40

This message shows that this particular version of Bayes_Analyze can process up to 64FIDs at one time. Each of these FIDs may have up to 65,536 total data values. A total of 40resonance models is permitted.

To get a feeling for how large of an analysis this specifies, and how much integrating outparameters from the probability distributions you gain, suppose that you were trying to usenonlinear least squares to estimate the resonance parameters from an uncorrelatedresonance model. The total number of parameters would be 40× 64× 2 amplitudes (oneeach for the cosine and sine amplitude), 40 frequencies, 40 decay rate constants, and 64variances of the noise, for a total of

40 × 64× 2 + 40 + 40 + 64 = 5264 parameters

with 65,536× 64 = 4,194,304 data values. Nonlinear least squares could never process suchan analysis on anything short of the world’s fastest computer. Yet such an analysis could beprocessed on a fast workstation using Bayes_Analyze (although, it might take severaldays).

The reason that Bayes_Analyze can process this analysis is because of the use ofmarginalization. In this case, marginalization reduces the search to a total of 40 frequenciesand 40 decay rate constants, and the largest matrix it has to deal with is of dimensionality80; where nonlinear least squares would have to deal with a matrix of 5264. Whilecomputers today could store such a matrix, inverting it would be difficult.

3.2 Bayes_Model ProgramThe Bayes_Model program takes the output from Bayes_Analyze and reformats it in theform of a FID. The modeling program is implemented from the Bayes_Results menu(Menu 25 onpage 54) or from the Bayes_Execution menu (Menu 23 onpage 52). Whenthe modeling program is run, it reads the input model file and writes its output into apreexisting directory. The output directory can be an experiment directory or a datadirectory. When the program is implemented under the menus, it always receives its inputfrom an experiment directory and it writes the output into exp5. But these choices are in themenus; they may be changed manually in the model file.

If you wish to run the modeling program in batch and do not know the format of thecommand line, enter the commandbayes_model and the program responds:

Developed by Monsanto St. Louis NMR Center and

Washington University School of Chemistry

Page 67: Bayesian Analysis User Guide

3.3 Bayes_Noise Program

01-999017-00 B0498 Bayesian Analysis Software Package 67

Usage: bayes_model model_file

where "model_file" is the input model file

This shows that the program takes a single command line argument, which is the name ofthe input model file. These files are namedbayes.model. nnnn when they are writtenby the analysis program. The format of this file is discussed in “bayes.model.nnnn File,”page 83. Unlike the Bayes_Analyze program, the model program does not have alimitsoption on its command line. The reason for this is that the Bayes_Model program is writtenin such a way that its limits are the same as the limits in Bayes_Analyze.

When the Bayes_Model program is run, it readds the model file and creates an outputVNMR experiment or data directory. From the model file, Bayes_Model readds the originaldata and extracts the FID being modeled. This data, along with a modified copy of theprocpar and text file, are copied to the output directory. The modifcations to the text fileindicate that the output FID is a modeled data set, not the original data. The outputprocpar is tailored appropriately for the model file.

The output modeled FID is an array that contains at least four elements, in this order:

• Copy of the FID being modeled.

• Best-fit model.

• Residuals.

• One or more FIDs, one FID for each resonance in the model.

If the model file contains 10 resonances, the output array contains 3 + 10 = 13 FIDs.

3.3 Bayes_Noise ProgramThe menus use the Bayes_Noise program to calculate the root-mean-square noise valuefrom the user-specified region. The program is implemented by the menus when you returnfrom the Bayes_Noise menu. For more on this menu, see“Bayes_Noise Menu,” page 47.

If the commandbayes_noise is entered, the program prints out a message that indicatesits command line arguments:

Developed by Monsanto St. Louis NMR Center and

Washington University School of Chemistry

Usage: bayes_noise infid outnoise nnstart

infid - input fid file

outnoise - output noise file

nnstart - complex point at which noise starts

This output shows that three command line arguments are required by this program:

• The first argument is the name of the input FID that is to be processed. This FID filemay be arrayed. If it is arrayed, Bayes_Noise computes an estimate of the root-mean-square data value for each array element, and these data values are written to an outputfile.

• The second argument is the name of this output file. When Bayes_Noise isimplemented from the menus, this file is namedbayes.noise . This output file istwo-column ASCII and is discussed in “bayes.params.nnnn and bayes.model.nnnnFiles,” page 74.

Page 68: Bayesian Analysis User Guide

Chapter 3. Bayesian Analysis Programs

68 Bayesian Analysis Software Package 01-999017-00 B0498

• The third argument specifies the location to start computing root-mean-square values.The computations continue to the end of the FID. Both real and imaginary values areused in this calculation.

3.4 Bayes_Probs ProgramThe program Bayes_Probs is used by the menus to print the probabilities file. As with allof the other Bayesian Analysis programs, if you run this program with an incorrect numberof command line arguments, it displays a message about the command line arguments. Ifyou enter the commandbayes_probs , here is the output:

Developed by Monsanto St. Louis NMR Center and

Washington University School of Chemistry

Usage: bayes_probs startfid

where startfid is the starting fid number.

The argumentstartfid is suffix number of the probabilities file that is to be normalizedand printed. If a suffix number is entered and the corresponding probabilities file does notexist, the program prints out the appropriate headings and terminates. No errors aregenerated.

The Bayes_Probs program is used by the menus to produce the list of probabilities thatoccurs at the end of the report produced by thestatus button, and it is activated on thereports menu by theProbs button.

An example the output from this program is shown inFigure 41onpage 94. This output isdiscussed in “bayes.probabilities.nnnn File,” page 93.

3.5 Bayes_Summary ProgramsBayes_Summary1 and Bayes_Summary2 are the summary report programs. The reportsfrom these programs are accessed on the reports menu by thesummary 1andsummary 2buttons. Unlike other programs in the Bayesian Analysis package, these program need nocommand line arguments. To run them, change to the experiment or data directory thatcontains the output files to be summarized, and enterbayes_summary1 orbayes_summary2 .

When the programs run, they use the UNIX commandls to build up a list of all of thebayes.output. nnnn files in the current directory. From this list of files, a summaryreport is produced for each output file. These summary reports are printed to standard outand they are written to an output file namedbayes.summaryl. nnnn orbayes.summary2. nnnn , where the suffix is the same as the suffix on the output filebeing summarized.

The formats of these files are explained in “bayes.summaryl.nnnn File,” page 92 and“bayes.summary2.nnnn File,” page 93.

Page 69: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 69

Chapter 4. Output Files

The Bayesian Analysis package has different outputs, ranging from the status display to theoutput files. In this chapter, we describe each of these outputs:

• 4.1 “Status Display,” this page

• 4.2 “bayes.status.nnnn File,” page 73

• 4.3 “bayes.params.nnnn and bayes.model.nnnn Files,” page 74

• 4.4 “bayes.log.nnnn File,” page 84

• 4.5 “bayes.output.nnnn File,” page 87

• 4.6 “bayes.summaryl.nnnn File,” page 92

• 4.7 “bayes.summary2.nnnn File,” page 93

• 4.8 “bayes.probabilities.nnnn File,” page 93

We begin the chapter by describing the output from thestatus button. Thestatus buttonalso displays the contents of thebayes.status. nnnn file. The suffixnnnn is thenumber of the first FID that has its analysis appear in the given file. The parameter file isused to communicate between the programs and VNMR interface.

When the parameter file is written by VNMR, it is namedbayes.params , and when itwritten by Bayes_Analyze, it is namedbayes.params. nnnn . The communicationbetween VNMR and Bayes_Analyze is two-way because VNMR reads the parameter fileswritten by Bayes_Analyze. All of these files are located in the directory that contains thedata being analyzed. This directory may be either an experiment directory or a datadirectory.

In addition to the parameter file and the status file, the Bayes_Analyze program writes filesnamedbayes.model. nnnn , bayes.output. nnnn , and bayes.log. nnnn .Information about the root-mean-square noise value are communicated to Bayes_Analyzethrough a file namedbayes.noise .

The model file,bayes.model. nnnn , is used by the modeling program to build themodel FID in exp5. The model file is almost a copy of the parameter file. The informationnormally written to the text window as Bayes_Analyze is running interactively is alwayswritten to the filebayes.log. nnnn .

The output file,bayes.output. nnnn , contains a detailed listing of everythingBayes_Analyze did. Two summary reports,bayes.summary1. nnnn andbayes.summary2. nnnn , are written by Bayes_Summary1 and Bayes_Summary2,respectively.

Last, thebayes.probabilities. nnnn file describes the model, the base 10logarithm of the probability for the model, and the search probability limits (if applicable).

Page 70: Bayesian Analysis User Guide

Chapter 4. Output Files

70 Bayesian Analysis Software Package 01-999017-00 B0498

4.1 Status DisplayWhen thestatus button is activated on one of the Bayes_Analysis menus, the macrosdisplay the settings of all of the Bayesian Analysis parameters. These parameters are usedby the menus and macros to write thebayes.params file, which describes the analysisto the programs. Consequently, the settings of the various parameters are important.

This display normally comes to the text window, but it is possible direct this report to aprinter on the results menus and the display menu. In either case, the contents of the displayis shown inFigure 23.

01 Analysis Parameters:02 First, last, and number of fids: 1, 1, 103 Data elements to treat as signal: 1 thru 2000, 20.0': of fid (np=9984)04 Lb setting for matched filter: 30.000000 Hz05 Data elements to treat as noise: 2567 thru np=9984, 74.3% of fid06 Scale factor applied to noise stdev: 1.00000007 Fid# Noise Std Dev08 1 1.06616409D+0309 Default model for constants: none10 Default model for phasing: correlated without phase correction11 Default model for shimming artifacts: none12 Multiplet patterns for new resonances: singlets (cannot be changed)13 Max new resonances to add next run: 2014 Nax resonances in each iteration: 115 Initial Model:16 Resonances to mark or find: singlets,17 correlated phase, relative phase 018 Resonances in initial model: 1419 Res# Frequency Pri Sec Primary Secondary Corr Rel Width20 (ppm) Pat Pat J-coupling J-coupling Pha (hz)21 1 -29.449406 1 1 0.000000 0.000000 y 0 856.11466322 2 -16.358054 1 1 0.000000 0.000000 y 0 808.78040323 3 -16.350221 1 1 0.000000 0.000000 n 0 69.44669024 4 -7.814661 1 1 0.000000 0.000000 n 0 516.50142025 5 -7.637567 1 1 0.000000 0.000000 n 0 29.22589626 6 -3.676216 1 1 0.000000 0.000000 y 0 244.57337827 7 -2.560128 1 1 0.000000 0.000000 y 0 49.15824128 8 -0.015518 1 1 0.000000 0.000000 y 0 23.53866529 9 0.095651 1 1 0.000000 0.000000 n 0 484.19584030 10 4.771107 1 1 0.000000 0.000000 n 0 165.73817331 11 6.755216 1 1 0.000000 0.000000 n 0 28.39716332 12 6.869463 1 1 0.000000 0.000000 y 0 824.27906433 13 14.336338 1 1 0.000000 0.000000 y 0 819.89003734 14 23.515642 1 1 0.000000 0.000000 y 0 701.07746035 Modeling Parameters:36 Fid elements to be generated: 998437 Analysis Status:38 Bayesian Analysis started: Wed May 1 09:33:05 199639 Status last updated: Wed May 1 09:35:59 199640 Status: Analysis completed41

Figure 23. Status Display

Page 71: Bayesian Analysis User Guide

4.1 Status Display

01-999017-00 B0498 Bayesian Analysis Software Package 71

The format of the status display varies considerably depending on what has been selectedby the user. The status display shown was selected because it illustrates most of the featuresof this display. We have numbered the lines in this figure to make referencing them easier.We explain below each nontrivial line in this report and, when appropriate, we refer to thesection in this manual that describes setting the parameters.

Line 02 is the first nontrivial entry in the status display and it indicates how the data is tobe processed. In this example there is only a single FID so the first FID, last FID, andnumber of FIDs are all the same. However, for arrayed FIDs these parameters vary. Forexample, if Bayes_Analyze were to processing the fifth through seventh FIDs one at a timethis line would read “5, 7, 1.” Setting these parameters is described in “Bayes_Data_ParamsMenu,” page 43.

Line 03 indicates what part of the signal is to be interpreted as data. The signal alwaysbegins with the first complex data point and proceeds for some number of complexelements. In the example shown, 2000 points, or about 20.0% of the signal, is beingprocessed. The user can specify any number of data values up to the maximum. The defaultsetting of this parameter is for all of the data, up to the maximum, to be processed. Thisparameter is set according to the section “Data_Setup_Signal Menu,” page 44.

Line 04 shows the current setting of the VNMRlb parameter. This parameter may be setin any way allowed by VNMR. The menus used to set this parameter are discussed in“Data_Setup_Filter Menu,” page 45.

Line 05 is used to indicate which part of the FID is to be treated as noise. In this example,roughly the back 75% of the FID is to be treated as noise. If no noise regions is set, the word“none” appears on the display. Setting the noise region is explained in “Bayes_NoiseMenu,” page 47.

Line 06 is used to indicate the scale factor. Sometimes the end of a FID has not yet droppedto into the noise. So specifying a noise region would over estimate the noise level by somefactor. For example, if the signal-to-noise level in the noise region is about 2, then settingthe noise scale factor to 0.5 would give Bayes_Analyze a reasonable estimate of the noiselevel, because the product of the noise scale factor and the estimated root-mean-square datavalue in the noise region are taken as the estimated noise level. Setting this parameter isexplained in “Bayes_Noise Menu,” page 47.

Line 07 through 08 are the calculated root-mean-square noise values. In this example, therewas only a single FID so there is only a single line. If there were multiple FIDs, line 08would be repeated. The status report lists the root-mean-square noise value for the first 10FIDs. Therefore, if there are 60 FIDs in your data, the last 50 values are not printed. Theyare calculated, however, and stored in thebayes.noise file. The root-mean-square noisevalue is not a parameter you directly set; instead, it is computed after you set a noise region.The program, Bayes_Noise, is used to compute them. Setting the noise region is describedin “Bayes_Noise Menu,” page 47.

Line 09 indicates what constant models are turned on. In the example shown, “none” wereturned on. However, when constant models are in use, this line is replaced by “first point,”“real,” “imaginary” or “joint.” Note that any or all of these constant models may be presentat one time, and this is indicated by a comma separated list of the above names. Setting thedefault constant models is explained in “Bayes_Constants Menu,” page 49.

Line 10 indicates the phase of the resonance model to be used in the automatic mode.Resonances may be correlated or uncorrelated. The default setting is correlated phasewithout phase correction. Setting the resonance model to use in the automatic mode isexplained in “Bayes_Phase Menu,” page 50.

Page 72: Bayesian Analysis User Guide

Chapter 4. Output Files

72 Bayesian Analysis Software Package 01-999017-00 B0498

Line 11 indicates whether the shimming model is turned on. In the example shown, “none”indicates there is no shimming model. If 5th order shimming had been turned on, this linewould have read “5th-order.” Similar notation is used for third and seventh order shimming.Setting the shimming order is explained in “Bayes_Lineshape Menu,” page 51.

Line 12 is an informational message indicating that new resonances are singlets. At presentBayes_Analyze does not have the capability to automatically find multiplets.

Line 13 is the maximum number of new resonances that may be added to the model inautomatic mode. This parameter defaults to a value of 10. It may be set to any value fromzero up. Setting this parameter is explained in “Bayes_Model_Params Menu,” page 47.

Line 14 is the maximum number of new resonances that may be added on each iteration ofthe model in the automatic mode of Bayes_Analyze. When Bayes_Analyze builds a model,it incorporates, at most, the number of resonances specified by line 14. The default is 1, andthis parameter cannot be changed within the menus.

Line 16 and 17 indicates the settings used in building an initial model. In building an initialmodel, you may find singlets and mark singlets, multiplets, and multiplets of multiplets.The default for both finding and marking resonances is singlets. In the example shown, thedefault was used. Setting this parameter is explained in “Bayes_Find Menu,” page 40.

Line 18 indicates the presence of an initial model. If there is no initial model this line willread: “No initial model.” Setting up an initial model requires a number of steps and thevarious menus that perform these steps are explained in “Bayes_Initial_Model Menu,” page34.

Lines 19 and 20 are fixed headers that appear whenever an initial model is used.

Lines 21 through 34 are the resonance components in the initial model. A number of thingsshould be noted about these. First, the frequencies are given in the units used by VNMR.These may be either ppm or hertz. Second, the two numbers following the frequency arethe order of the primary and secondary multiplets. Because the primary and secondary areboth one, these are singlets. If a primary multiplet order is specified, and the secondaryorder is 1, then this is a multiplet. If both orders are given, this model component is amultiplet of multiplets. The primary and secondaryJ coupling constants are listed as 0when the corresponding multiplet order is 1. The heading “Corr” means correlated phaseand this is a yes(y) or no(n) column. InFigure 23, some of the lines are correlated and someare uncorrelated. Relative phase can be 0, 90, 180, or 270, respectively. Last, the linewidthis the full width at half maximum of the resonance. This number is always reported in hertz.For details on setting up an initial model, see “Bayes_Initial_Model Menu,” page 34.

Lines 35 and 36 list the number of points to generate in the model FID. Setting thisparameter is described in “Bayes_Setup_Mod Menu,” page 56. Note that there is a secondmodel parameter, the FID number to model. However, this number is displayed as the indexnumber in the main VNMR window. For example, if you set FID 25 to be modeled, the lineat the top of the VNMR master window might read

seq: sh2pul Exp:2 Index: 25

Lines 38 through 40 are the contents of thebayes.status file. This file is created andmaintained by both Bayes_Analyze and Bayes_Model. When Bayes_Analyze is running,it continuously makes updates to this file and you can monitor the status of a run byrepeated use of thestatusbutton. For an explanation of thebayes.status file, see thenext section.

Page 73: Bayesian Analysis User Guide

4.2 bayes.status.nnnn File

01-999017-00 B0498 Bayesian Analysis Software Package 73

4.2 bayes.status. nnnn FileThebayes.status. nnnn file is a three or four line file that is written byBayes_Analyze and Bayes_Model as they are running. Bayes_Model places the number ofthe last FID modeled in this file, while Bayes_Analyze continuously updates this file.Because this file is continuously updated, it gives you the current status of a Bayes_Analyzerun.Figure 24 is an example of the status file

The first line of the file is the time the analysis started. while the second is the time this filewas last updated. Optionally, the FIDs being processed is given on the third line. This lineis present when multiple FIDs are being processed in blocks. The last line indicates whataction happen at the time of the last update. In the example shown inFigure 24, the last lineindicates that the run had completed, which makes this message purely information.However, the status file is also used to communicate setup problems and program errors.

A complete listing of all of the messages that may be written to the status file is given inAppendix A. In this appendix, informational messages are numbered 1-8; setup messagesare numbered 9-29; and errors messages are numbered 30-49.

The informational messages are written into the status file for no other purpose than toallow you to determine the current status of a run. The status report contains the status fileas part of that listing. The informational messages might be as simple as indicating that theinput data is being read (message number 1) or they might indicate that the entire analysisis completed, as message 7 indicates.

Message numbers 9 to 29 are true errors. These indicate that the Bayes_Analyze detecteda problem in the setup. They include such things as not finding the input FID (message 15),exceeding to the capabilities of the programs (message 27), and a number of others. All ofthese messages require one to correct one or more problems with the setup.

The remaining messages, messages 30-49, are program errors in one form or another. Themessage consists of the name of the routine in which the error occurred and a message thatindicates you should contact Varian. In almost all of these cases, these message could notoccur without something being seriously wrong with the program. Indeed most of thesemessages can occur during testing because they indicate things like we forgot to modify acertain routine to properly handle a new model. There are two error messages that are notterribly serious, however, and before reporting them you should investigate them further.They are included in the errors messages primarily because they can be true errors, butusually they are problems with the setup. These messages are numbers 37 and 38.

Message 37 occurs when a matrix inversion routine detects a singular matrix. But singularmatrices can only occur when one or more of the model functions are nearly identical andeven then this is rare because the prior probabilities used in the calculations are suppose toprevent this. You should check to make sure that the analysis is makes physical sense.

For example, did you mark a peak and then Bayes_Analyze tried to put a second peak atnearly the same location. This type of problem can occur whenever you mark a peak too farfrom the “true” location of the resonance. It can also occur when you mark a peak thinking

Bayesian Analysis started: Tue May i4 13:il:01Status last updated: Fri May 17 10:27:21

Current fids: 15 Through 25Status: Analysis completed

Figure 24. bayes.status. nnnn File

Page 74: Bayesian Analysis User Guide

Chapter 4. Output Files

74 Bayesian Analysis Software Package 01-999017-00 B0498

it is a single line and it is really multiple lines. The solution to this type of problem is toremove the marked peaks and allow Bayes_Analyze to put the peak in by itself.

There are other reasons that this problem can occur, such as when all of the constant modelsare used and Bayes_Analyze attempts to model a baseline artifact. Baseline artifacts aremodeled with vary rapid decay, and so are very nearly like first point models—so they canbecome redundant. This can cause the matrix inversion to fail. The pattern should be clear:this problem occurs when several model components are nearly identical. The solution isto remove the redundant models and rerun the analysis. If the problem persists and you canmake no progress on solving the problem, contact Varian.

The other error, message 38, is essentially the same as the message 37. In this case thematrix inversion routine failed but did not detect the failure. One or more of the modelfunctions are redundant and that redundancy is causing either convergence or round-offproblems in the matrix inversion routine. The solution is again to remove the redundantvectors and try the analysis again.

The remaining errors are true program errors and should never occur. Indeed, if they dooccur, you should save the experiment in which the problem occurred (making sure you getthe FID and not a pointer to it) and then contact Varian. They will tell you how to deliver itto the appropriate people.

4.3 bayes.params. nnnn and bayes.model. nnnn FilesThe Bayes_Analyze program and the Bayes_Model program read the parameter file and themodel file, respectively. The parameter file and the model file are almost identical. The onlydifference between them is that the model file contains the estimated amplitudes of theresonances components for each FID processed, while the parameter files do not containthese amplitudes.

The parameter file is used to communicate between VNMR and the Bayes_Analyzeprogram. The name of the parameter files may be eitherbayes.params orbayes.params. nnnn , where the numbernnnn is described shortly. If the number isnot present, the file was output from VNMR and is input to the Bayes_Analyze program. Ifthe number is present, the file was output from Bayes_Analyze and serves as input toVNMR.

Bayes_Analyze can write many different parameter files. The number of them depends onhow the data are to be analyzed. For example, suppose that FIDs 1 to 20 by 5 are to beprocessed, then Bayes_Analyze writes parameter files having numbers 0001, 0006, 0011,and 0016. This numbering convention applies to all Bayesian Analysis files that end with anumber. These files include the log, output, model, summary, status, probabilities, andparameter files.

In the remaining sections, we describe the output to that is written to various files. Many ofthese files contain a header that describes the parameters used in running the analysis.Consequently, in the next section, that header is described and then referenced when theother output files are explained.

Bayes_Analyze File Header

The file header used in the parameter, output, model, and summary file contains the analysisparameters.Figure 25 shows the header as it is written out from VNMR:

The first part of this header contains a description of the parameter and this is followed byits value. Some of the parameters are text strings and some of them are numbers. Text

Page 75: Bayesian Analysis User Guide

4.3 bayes.params.nnnn and bayes.model.nnnn Files

01-999017-00 B0498 Bayesian Analysis Software Package 75

strings start in column 22 and extend to the right. Numerical values may appear anywherefrom column 22 through 32. Note that in this example the numerical fields are often zerofilled. The zero filling is done by the macros that write the parameter file and is not requiredby the programs.

The programs that read this header can find the numbers anywhere within the allowedcolumns. The programs recognize the individual lines by the labels that appear in column5, these labels must appear as shown, including capitalization. The ordering of theparameters is generally not critical, although keeping them in the order shown is advisable.

The numbers on the left and the column headings were added for reference and do notappear in the file. Blank and comments lines (lines starting with “!”) are ignored and mayappear anywhere within the parameter or model files.

1 2 3 4 5 612345678901234567890J234567890123456789012345678901234567890123

01! Bayesian Analysis Input Parameter File02! Created 07-May-96 15:14:21 by larry

03 32 Configuration Parameters

04 File Version = 3.00005 Fid File = /uer/ackgrp/glb/vnmrsys/exp3/acqfil/fid06 Procpar File = /usr/ackgrp/glb/vnmrsys/exp3/procpar07 Analysis Dir = /usr/ackgrp/glb/vnmrsys/exp308 Model Dir = /uer/ackgrp/glb/vnmrsys/exp509 Model Dir 0rg = EXP10 Units = PPM11 Activate Shims = YES12 Activate Delay = NO13 Baseline Prob = NO14 Data Type = VNMR15 Noise = NO16 Output = FULL17 Default Model = (CP)18 First Fid = 119 Last Fid = 120 No Fids = 121 Total Points = 102422 Complex Points = 51223 Noise Start = 024 Model Points = 0000000102425 Model Fid = 0000000000126 Prior Odds = 0.0000027 Sampling Time = 0.2990028 Spec Freq = 300.0000029 User Reference = -2.8434930 True Reference = -2.8434931 Total Models = 332 Shim Order = 733 Max Freqs = 1034 Max Candidates = 135 Default Lb = 1.08755

Figure 25. bayes.params. nnnn File

Page 76: Bayesian Analysis User Guide

Chapter 4. Output Files

76 Bayesian Analysis Software Package 01-999017-00 B0498

In describing the various lines that appear in the header, we reference lines by number andrefer to the parameters by name.

Line 03 contains the number of configuration parameters. This line must be the firstparameter in the header, and the programs expect this number to be correct. The count is ofthe number of parameters that follow; it does not include the configuration count itself.Here there are 32 configuration parameters, and the programs will fail to read this headercorrectly unless there are exactly 32 parameters following this line. Note that means 32parameters, not 32 lines. Blank lines and comment lines may be embedded in this header.

Line 04 is the file version number and, asFigure 25implies, the current file version is 3.000.This parameter must follow the configuration parameters. The programs have the ability toread old file versions. We have included this parameter because output files from a BayesianAnalysis may be saved sometimes for long periods of time, and we did not want to lose theability to read and model older versions of these files.

Line 05 is the fully qualified name of the input data file. This file may be either the nameof a VNMR FID file or the name of a two-column ASCII file.Figure 26 shows a smallsegment of an ASCII input file. When multiple FIDs are input using ASCII, they are placedin the ASCII file one after another, with no separators. This particular parameter file headerwas written by VNMR, however, so the file to be processed is a VNMR FID located in anexperiment directory.

Line 06 is the name of the input parameter file. For VNMR FID files this is theprocparfile name; for ASCII input, this is the name of the ASCII parameter file.Figure 27 showsan example of the ASCII parameter file. When ASCII input is used, the parameter filecontains only four parameters: the total number of FIDs, the total number of data values,the acquisition time, and the spectrometer frequency. The format of the file is simply oneparameter per line and the parameter may appear anywhere on the line. Comments mayappearafter the parameters, but only after. When multiple input ASCII FIDs are specified,they must be stacked in the ASCII FID file one after another with no separators. As with

Real Imaginary12435.74218750 12928.89062500-8749.79101563 -5062.30859375-5772.41210938 -4175.4897460912151.72460938 -1913.69848633

1558.63842773 7160.62011719-15038.20312500 -1796.31079102

9567.06835938 -2999.822265634102.32666016 -4858.40039063

-5844.81640625 15708.34375000-1027.10742188 -8971.38671875

3016.07861328 -6322.290039062894.81298828 10342.85937500

When the input is an ASCII FID file, the only requirement is that itbe two columns. The data is read by field, not by column, so thedata can appear anywhere on the line be space or comma separated.The format of the numbers may be integer, real, or in scientificnotation. If in scientific notation, e, E, D, and d are accepted asvalid exponent identifiers. The headers (“Real.” “Imaginary”) areinformational and must not appear in the file.

Figure 26. ASCII Input FID Files

Page 77: Bayesian Analysis User Guide

4.3 bayes.params.nnnn and bayes.model.nnnn Files

01-999017-00 B0498 Bayesian Analysis Software Package 77

the name of the FID, the name of the parameter file may be any fully qualifiedprocparor ASCII parameter file.

Line 07 is the name of the directory in which the output files are to be written. In thisexample, the header was written by VNMR so the analysis directory is a VNMRexperiment, but this need not be the case. Any directory can be used to store the output filesfrom Bayes_Analyze. Because this particular parameter header was to run under VNMRcontrol and because the programs was run from the current experiment, this particular filename could have been specified as “.” under UNIX. Note that Bayes_Analyze will notcreate this directory; it is assumed that this directory exists.

Line 08 is the name of the directory where any model of the experiment is to be placed. Thisparticular field is used by Bayes_Model and indicates where the output model is to bewritten. This is typically exp5, but it need not be that way. Any valid output directory canwork. Note, that Bayes_Model will not create this directory; it is assumed that it exists.

Line 09 specifies the organization of the directories. The valid entries are “EXP” and“DATA”. The “EXP” organization means that directory is organized like a VNMRexperiment. In a VNMR experiment,procpar and text files are located in the experimentdirectory but the FID file is located in a subdirectory calledacqfil . If the organization is“DATA,” the program assumes the FID,procpar and text files are located in the analysisdirectory, i.e., there is noacqfil subdirectory.

Line 10 specifies the units to use in the analysis. The valid entries are “PPM,” and“HERTZ”. When running these programs under VNMR control, the units displayed by thedscale command are used by the programs. Note that the units must be specified prior tosetting up an analysis. The menus and scripts that run under VNMR control keep anextensive set of tables containing such things as the resonance frequencies and decay rateconstants. These tables are in the units used by VNMR. If you change the units after youbegin setting up and analysis, these tables will be incorrect. The only way to fix the problemis to recreate the initial model.

Line 11 specifies whether the lineshape model is to be used. The valid values are “YES” or“NO,” meaning the lineshape is to be expanded or it is not, respectively. If lineshape, orshimming model, is activated, the order, shown on Line 32, must be specified as greaterthan 1.

Line 12 is used to activate the first-order phase correction. This phase correction is theequivalent of using both left and right phase in VNMR. The valid values are “YES” and“NO” meaning the first-order phase correction is to be activated or no do not activate it,

11 Number of fids1024 "np" total data values (real + imag)

1.012 "at" The total acquisition time82.700 "sfrq" the spectrometer frequency

Figure 27. ASCII Input Parameter Files

When an ASCII input file is supplied, an ASCII parameter file must alsobe supplied. This file contains four parameters: total number of FIDs,total number of data values, acquisition time, and spectrometer frequency.Each parameter must be on a separate line, and comments may followeach parameter. The fields may be located anywhere on a line, providedthey are the first thing on a line.

Page 78: Bayesian Analysis User Guide

Chapter 4. Output Files

78 Bayesian Analysis Software Package 01-999017-00 B0498

respectively. If this indicator is set to YES, the Bayes_Analyze program activates the phasecorrection when ever the number of correlated resonances components is greater than 1.

Line 13 indicates if a baseline artifact is present in the data. The valid values are “YES” and“NO.” This feature is only available in batch processing. VNMR always set this indicatorto no. When set to “YES,” Bayes_Analyze attempts to model the baseline before it attemptsto model any resonances in the data. To do this, it saves its internal value oflb , sets thisparameter to a large value, sets the default model to “baseline,” and attempts to model thebaseline artifacts as very rapidly decaying components at the front of the signal. Thisfeature was added after the menus were created. We have not had sufficient experience withit to implement it in the VNMR menus.

Line 14 indicates the type of input data to be processed. The valid values are “VNMR” and“ASCII.” When “VNMR” is specified, the input file indicated on line 05 must be a validVNMR FID. When this line indicates “ASCII,” then, as explained previously, this input filemust be a two-column ASCII file. The two columns are the real and imaginary parts of theFID. The entries on these lines may be integer, real numbers, or in scientific notation.Multiple FIDs are placed in this file, one after another, with no breaks between them. Foran example of what an ASCII input file looks like, seeFigure 26.

Line 15 indicates whether an estimate of the root-mean-square noise is available. The validvalues for this indicator are “YES” or “NO.” These indicate a noise measurement isavailable or a noise measurement is not available, respectively. If a noise measurement isavailable, the Bayes_Analyze program attempts to read thebayes.noise file. Figure 28is an example of this file.

This noise file is two columns, the first being the number of the FID and the second beingthe estimated root-mean-square noise value. This file must be present if the noise usedindicator is “YES.” If used, there must be one entry in this file for every FID in the inputdata. This file is built by the menus using the Bayes_Noise program. See “Bayes_NoiseProgram,” page 67, for more on how to run this program.

Line 16 indicates the amount of output written to standard out. This entry may be “FULL”or “NONE” This option is set to “FULL” whenever Bayes_Analyze is run interactively and“NONE” whenever the program is run in background. As the name implies, no output goesto standard out when this option is set to none.

Line 17 is used to set the resonance model used in the automatic mode of Bayes_Analyze.Table 2is a list of all the model names currently in use in the Bayesian Analysis package.

1 3.22299585E+012 3.19859327E+013 3.22769104E+014 3.18850559E+015 3.21451727E+016 3.19790225E+017 3.20911816E+018 3.19975486E+019 3.19348404E+01

Figure 28. bayes.noise File

The second column is the standard deviation of the noise for the FIDspecified in the first column; i.e., FID 1, 2, 3, etc. This file is used only ifthe noise indicator in the parameter file is “YES” (Line 15 inFigure 25).If used, this file must contain one entry for every FID in the input file.

Page 79: Bayesian Analysis User Guide

4.3 bayes.params.nnnn and bayes.model.nnnn Files

01-999017-00 B0498 Bayesian Analysis Software Package 79

There are two resonance models in this table: “(CP)” for correlated phase and “(UP)” foruncorrelated phase.

Lines 18 through 20 are the first, last, and number of FIDs, respectively. Bayes_Analyzebegins processing the data starting with the first FID. It processes number of FIDs at a time,looking for common resonances. After processing a given block of FIDs, the programincrements the first FID by number of FIDs and then proceed to process this block of FIDs.This process continues until all indicated FIDs have been processed. As noted in4.4“bayes.log.nnnn File,” page 84, the number of the first FID processed in a cycle is appendedto all of the output files from Bayes_Analyze.

Lines 21 and 22 are the total and number of complex data values to be processed byBayes_Analyze. The complex number of data values is redundant in that it is just half thetotal number of data values.

Line 23 is the starting position of the noise region. This field is not used by Bayes_Analyzebut it is used by the menus and macros to run Bayes_Noise. Consequently, this field wasplaced in the parameter file so that it could be saved when an analysis is saved.

Line 24 is the number of model points in the output modeled FID. When the modelprogram, Bayes_Model, creates a model of a FID, it creates an arrayed FID in exp5. Thefirst element of this array is a copy of your data. If the number of model points is less thannp , only part of your data is copied to the output FID. If it is greater thannp , the data arecopied and then zero padded. The default is for this value to be equal tonp . However, thereare conditions where this might not be possible, such as ifnp exceeds the maximum FIDsize in Bayes_Model or Bayes_Analyze.

Line 25 is the number of the FID to model. If the user does not specify the FID to model,it defaults to the FID that was last displayed in the experiment. If no FID has beendisplayed, it defaults to the first FID processed by the user.

Line 26, the prior odds, is used in the signal detection calculation. The signal detectioncalculation makes some assumptions about the size of the amplitudes of the sinusoids inyour data. These assumptions are based on the value of the first few data points in the FIDsbeing processed. In essence, it was assumed that when an acquisition is run you could guessthe order of magnitude of the amplitudes of the sinusoids. Based on this assumption, a priorprobability for the amplitudes could be assigned. The signal detection calculation couldthen be done in such a way that it adapts automatically to data of very different magnitudes.The signal detection calculation computes the probability for “a signal” and the probability

Table 2. Model Names.

Model Name Description Resonance

Real constant A constant in real channel No

Imaginary constant A constant in imaginary channel No

DC offset in both The same constant in both channels No

First-point problem Model the data as if the first point were inerror

No

(CP) Correlated Phase model Yes

(UP) Uncorrelated Phase model Yes

The Bayesian Analysis package currently recognizes six different models. This tablegives the name of the models as they appears in all reports and files, a short descriptionof the model, and whether the model is a resonance model or not.

Page 80: Bayesian Analysis User Guide

Chapter 4. Output Files

80 Bayesian Analysis Software Package 01-999017-00 B0498

for “no signal”. From these two, the base 10 logarithm of the ratio of the probability for “asignal” divided by the probability for “no signal” is computed. When this quantity isnegative, it is evidence in favor of the “no signal,” and when it is positive, it is evidence infavor of “a signal.” The even money bet occurs when the logarithm of the odds is zero.Bayes_Analyze tests resonances for which there is positive evidence. The prior odds on line26 allows you to move this threshold because the prior odds is subtracted from the signaldetection odds ratio. Entering a value of “1” lowers the threshold, which allows the programto test for weaker lines.

Line 27 is the sampling time of the data being processed. Note that this is the sampling timeof the data being processed, which is not the same as the VNMR parameterat . The VNMRsampling timeat is for the entire FID. If you are processing 25% of the FID, this field is25% ofat .

Line 28 is the spectrometer frequency and is used in the conversion to and from ppm.Internally, the Bayes_Analyze program uses the radian as the frequency units. When eitherBayes_Analyze or Bayes_Model reads the input parameter file, the programs determinewhat units are being used and make the appropriate conversions to internal units.

Line 29 is the reference frequency used by the Bayesian Analysis package. This parameterhas no exact correspondence to any VNMR parameter. It is computed from the referencecurrently in use in VNMR. When converting frequencies to VNMR units, the frequenciesare converted to the appropriate unreferenced units, and then this number is subtracted fromthat value. Similarly, when going to internal units, this number is added to the frequency,and then the frequency is converted to radians.

Line 30 is the true reference. The meaning of the field is exactly the same as the userreference.

Line 31 is a count of the total model components in the input model to be analyzed in slavemode. A model component might be a singlet, a multiplet, or a constant. These modelcomponents are specified by their names and, for resonances, the parameters associate withthat component. In the next section we give more details on how to specify the modelcomponents.

Line 32 is the order of the expansion being done on the lineshape. This field is ignoredunless the activate shims indicator is “YES.” An example of setting the activate shimsindicator is shown on Line 11 inFigure 25. When this indicator is set, the expansion ordermust be 1, 3, 5, or 7. Only odd numbers are allowed, an expansion order of 1 is the same asno expansion, and the maximum expansion order is 7 (although it can be increased). Whenthe activate shim indicator is “NO,” Bayes_Analyze ignores this parameter.

Line 33 is the maximum number of resonances that may be incorporated into the model onthis run of Bayes_Analyze.

Line 34 is the maximum number of resonances that may be incorporated from one run ofthe signal detection algorithm. As explained earlier, in its automatic mode, Bayes_Analyzebuilds the model X resonances at a time, where X is the parameter specified on this line.This parameter is set to one by the menus and cannot be changed within the menus. Youcan set it manually, however, but we advise against it. The signal detection calculation usedby Bayes_Analyze is very similar to peak picking a power spectrum. Now, power spectrahave multiple peaks corresponding to multiple frequencies, and so when we were designingBayes_Analyze, it seemed natural to allow it to take multiple peaks from the signaldetection calculation. However, long experience with this program indicates that this is nota good idea even for the first few resonances. Consequently, we removed the ability tochange this parameter within the menus and will probably remove this parameter from theparameter file on the next release of the programs.

Page 81: Bayesian Analysis User Guide

4.3 bayes.params.nnnn and bayes.model.nnnn Files

01-999017-00 B0498 Bayesian Analysis Software Package 81

Line 35 is current value of parameterlb . It is used by Bayes_Analyze in the signaldetection calculation and as an estimate of the decay rate constant for models built inautomatic mode. By varying this parameter you can selectively blind Bayes_Analyze toeither rapidly decaying or long lived resonances. The value oflb should typically be set tomatch the decay of the FID as closely as possible.

Global Parameters

Immediately following the configuration parameters is a small section that usually containsonly one or two lines, the global parameters. These parameters apply to multiple modelscomponents. An example of these parameters is shown inFigure 29.

The numbers on the left as well as the column indicators on the top have been added forreference purposes. InFigure 29, there are 10 global parameters and this is the maximum.When these parameters appear in the parameter file, they must appear in the order shown.The programs recognize these parameters by name, and if you are building a parameter fileby hand, you must spell these names exactly as they appear, including capitalization andspacing. These parameters are optional, however, and if they do not appear, they default toreasonable values.

Line 01 is a count of the number of global parameters. To be strictly correct, this is a countof the number of noncomment and nonblank lines in the global section of the report. Thisnot quite the same as saying that all of these lines contain global parameters and, as we willsee, at least one of those lines, line 09 inFigure 29, is not a parameter; it is informationalonly. This count must be correct if the parameter file is to be read correctly.

Line 03 and 04 are the phase parameters used in the correlated resonances modelcomponents. VNMR allows spectra to have a linear frequency dependent phase. This linearphase is specified by the phase on the left-hand-side of the spectrum, the left phaselp , andthe phase on the right-hand-side, the right phaserp . These parameters are natural forspectra but are clumsy in the time domain. The Bayesian Analysis package expresses thislinear variation as a slope (the delay time) and an intercept (the center phase). The center

0 1 2 3 4 51234567890123456789012345678901234567S90123456789012

01 10 Global Model Parameters0203 Center Phase = 219.1704104204 Time Delay = 0.0083098305 Shim Delta = 36.923702254267 2.500000000000006 R Minus 3 = 0.012108370026207 R Minus 2 = 0.012381818719008 R Minus 1 = 0.287800637012009 R Center = 0.28814051886S010 R Plus 1 = 0.134050628702911 R Plus 2 = 0.133451017574212 R Plus 3 = 0.1320670090977

Figure 29. Global Parameters

The global parameters immediately follow the header. There are at most10 global parameters, and all 10 are exhibited here. These parametersinclude the two phasing parameters, the spacing of the Lorentzians in theshimming model (Shim Delta), and the relative amplitudes of theLorentzians in the expansion.

Page 82: Bayesian Analysis User Guide

Chapter 4. Output Files

82 Bayesian Analysis Software Package 01-999017-00 B0498

phase parameter is called the center phase because it is the phase of the sinusoids at thecenter of the spectrum, and we wanted a name that was the analogue of the left and rightphase parameters.

Lines 05 through 12 concern the expansion of the lineshape in Lorentzians. Theseparameters are not present in the parameter file unless the shimming model is turned on andBayes_Analyze has been run previously. They are present in the model file if the: shimmingmodel is activated. When present in the parameter file, as shown inFigure 29, the menusread these values from thebayes.params. nnnn file and then transfer them unmodifiedto thebayes.params file. When the shimming model is first activated, the menus do notwrite lines 05 through 12 into the parameter files. Instead, they allow these parameter so beset to their default values.

Line 05 is the shim delta, the separation frequency between the Lorentzians in thefrequency domain expansion. It is the exact analogue of theJ coupling constants inmultiplets. There are two entries present on line 05: the first is the shim delta, and thesecond is its initial value. The Bayes_Analyze program keeps track of the initial value ofsome parameters because these parameters are forced to stay near their initial values. Thisis done primarily to keep Bayes_Analyze from moving resonances far where the usermarked them, but there are other reasons for this.

The shimming delta is one of the parameters that is constrained to stay near its initial value.This was done to prevent the program from making the expansion so wide that the userwould be able to see the individual expansion components. Its initial value is on the orderof lb /(expansion order). Assuminglb is approximately equal to the full-width at halfmaximum for a typical line in the spectrum, then constraining the shimming delta to be nearits original value means that the Lorentzian expansion cannot create lineshapes muchdifferent in width thanlb .

Lines 06 through 12 are the relative amplitudes assigned to the Lorentzians that make upthe lineshape expansion. If the shimming order is set to three, then there are threeLorentzians for each peak in the spectrum. The total area under these peaks is required toadd up to 1, so there are only two independent amplitudes; the third is redundant. Byconvention, we take the redundant amplitude to be the center amplitude. For the seventh-order shimming shown inFigure 29, the redundant center amplitude is on Line 09.

Model Components

The parameter file consists of the header, the global parameters, and then the individualmodel components. The header and the global parameters have already been described. Inthis section, we describe the individual model components.

Figure 30 is an example of what the model component information looks like. In thisexample, three model components are shown. Each model component consists of a blankline, a comment line used as a header, and the model detail line. Each model detail lineconsists of a count, the name of the model, a description of the model and, for resonances,the resonance information. The first two models in this example are a real and an imaginaryconstant. The third entry is a multiplet.

Multiplets are examples of resonances. For resonance models, the header and model linesare very long and we have broken them apart. The model name is “(CP)” for correlatedphase (seeTable 2for a list of the valid model names). For resonances, the model name isfollowed by a description. This description is built from the descriptions shown inTable 1onpage 40. For multiplets of multiplets, the description is of the form “triplet of doublets”etc. This description is for information only.

Page 83: Bayesian Analysis User Guide

4.3 bayes.params.nnnn and bayes.model.nnnn Files

01-999017-00 B0498 Bayesian Analysis Software Package 83

Next is the multiplet order. In this example, it is “(3,1) 0” and this means a triplet of singleswith zero relative phase. The relative phase may have values 0. 90, 180, and 270.

Last are four sets of parameters. Each set has the current value of the parameter and itsinitial value. Each parameter value is a 15 position space separated field. Each set ofparameters is therefore 32 positions. The four sets of parameters are the frequency, decayrate constant, and then the primary and secondaryJ coupling constants. The parametervalues may be either real numbers or in scientific notation.

bayes.model. nnnn File

The model file is a modified copy of the parameter file. In addition to the informationcontained in the parameter file, the model file also contains the estimated amplitudes of thesinusoids for each FID processed.Figure 31 is an example of the amplitude output.

! # Name1 Real Constant

! # Name2 Imaginary Constant

! # Name Order Frequency Init Value3 (CP) Triplet (3,1) 0 1.2913619868959 1.2900933000000

Decay Rate Init Value1.0405457695713 1.0875500000000

Primary J Init Value6.9823931646449 6.6850000000000

Secondary J Init Value0.0000000000000 O.0000000000000

Figure 30. Model Components

! # Name Order Frequency Init Value3 (CP) Singlet (1,1) 0 24.305874354538 24.172984999931

! Fid Amplitude1 76499.4642965922 75736.8157357i73 75008.8705792334 74424.9266969275 7376i.5233498486 73730.8465863297 72942.02i5023018 72735.2150548799 72103.72202227010 72022.172495999

Figure 31. bayes.model. nnnn File

Page 84: Bayesian Analysis User Guide

Chapter 4. Output Files

84 Bayesian Analysis Software Package 01-999017-00 B0498

The resonance shown inFigure 31 is the same triplet shown inFigure 30. The amplitudesection has a comment header, followed by the estimated amplitude of the resonance. Thisline is repeated for each FID processed.

Note thatFigure 31is the output for a correlated phase model. Some models, uncorrelatedphase resonances, have multiple amplitudes per resonance.Figure 32 is what the outputamplitude looks like for an uncorrelated resonance.

The uncorrelated resonance has both a cosine and a sine amplitude. Together these specifythe amplitude and phase of the resonance.

4.4 bayes.log. nnnn FileWhen Bayes_Analyze runs, it prints a record of its activities. This record includes outputfrom the signal detection algorithm, output from the optimization of the parameters, andoutput from the model selection calculation. The log file is namedbayes.log. nnnnwhere thennnn is a zero-padded number specifying the number of the first FID processedin this cycle of Bayes_Analyze. Unless instructed not to do so, Bayes_Analyze also printsthe information in the log file to standard out. Standard out goes to the text window ofVNMR when Bayes_Analyze is run in the interactive model.

Figure 33is a small section of the log file. The information shown is from one cycle of theautomatic mode of Bayes_Analyze. In the process of building a model, Bayes_Analyzeperforms a signal detection calculation, an optimization of the joint probability for thefrequencies and decay rate constants, and a calculation of the probability for the model. Allof these phases are illustrated inFigure 33.

The signal detection calculation computes the logarithm of the probability for two differentmodels: the probability for “no signal” and for a “signal.” The difference is then taken. Thisdifference is a function of frequency, and the frequency with maximum probability is usedto build the next model. This information is the first line shown inFigure 33. Here theevidence for the next resonances is 0.3 in favor. This is a base 10 logarithm, and 0.3translates to almost 2:1 in favor of a signal.

From the set of possible resonances locations, the current model is updated and themaximum of the joint probability for the resonance parameters is located. The linebeginning with the dashes is the part of the log file concerning the optimization of theparameters. This line indicates how many resonances are in this particular model. In theexample shown, this is a 5 resonance model.

The next line is a simple header, and this is followed by four blocks of lines that are outputfrom the optimization routines. These four blocks of lines show the parameter values at theend of a step in the search. Each block of lines consists of some information about thesearch and then the current value of the parameters.

The parameter values are the last three entries on this line, and these last three entries arerepeated however many times necessary to print all of the parameters. We will say moreabout these parameters and how to interpret them later. For now we would like to turndiscuss the parameters that pertain to the search itself.

! Fid Cos Amplitude Sine Amplitude1 4848.0043462323 -8028.i16298822

Figure 32. Uncorrelated Phase Amplitudes

Page 85: Bayesian Analysis User Guide

4.4 bayes.log.nnnn File

01-999017-00 B0498 Bayesian Analysis Software Package 85

The Levenberg-Marquardt search algorithm in use (for details, see [15]) has threeassociated parameters: the logarithm of the joint probability for the parameters, a relaxationparameter, and a Levenberg-Marquardt parameter. These parameters are identified by theheadings: “Log Prob”, “Relax”, and “L,” respectively.

The single character I, A, or R in front of the relaxation parameter indicates whether thesearch step is the initial, accepted, or rejected step, respectively, and if the covariancematrix is being computed. The initial setting indicates the logarithm of the probability forthe parameter settings at the beginning of the search. The final, Z, indicate the logarithm ofthe probability at the end of the search when the covariance matrix is being computed. Thecovariance matrix is computed by zeroing the Levenberg-Marquardt parameter andcomputing the second partial derivatives of the joint probability for the resonanceparameters. This covariance matrix is then used in computing the probability for the model.

The remaining three fields, labeled “Parameter” on this line and the repeated lines, are theparameters that appear in the model. There is no particular order to these parameters exceptthat resonances are listed in increasing resonance order. The resonances are ordered before

Base 10 Log Evidence for The Next Resonance is: 0.3-------------------------- 5 Resonance Model -----------------------Log Prob Relax L Parameter Parameter Parameter776.5 I 1.000 0.010 0.1167(f) 0.9950(d) -57.9401(Ph)

1.2914(f) 0.8575(d) 6.9822(Jp)0.0083(T0) 4.S648(f) 0.8882(d)6.9795(Jp) 5.6478(f) 3.2275(d)4.4656(f) 1.0876(d)

776.9 A 1.000 0.001 0.1167(f) 0.9849(d) -57.9017(Ph)1.2914(f) 0.8572(d) 6.9822(Jp)0.0087(T0) 4.8648(f) 0.8870(d)6.9793(Jp) 5.6477(f) 3.2293(d)4.4651(f) 1.6998(d)

777.1 A 1.000 0.000 0.1167(f) 0.9822(d) -57.8867(Ph)1.2914(f) 0.8571(d) 6.9821(Jp)0.0088(T0) 4.8648(f) 0.8869(d)6.9794(Jp) 5.6477(f) 3.2289(d)4.4648(f) 2.5345(d)

777.3 Z 1.000 0.000 0.1167(f) 0.9806(d) -57.8711(Ph)1.2914(f) 0.8569(d) 6.9821(Jp)0.0090(T0) 4.8648(f) 0.8868(d)6.9795(Jp) 5.6477(f) 3.2284(d)4.4645(f) 3.5147(d)

Base 10 Log Of The Probability of 5 Resonances =-3.17473576E+03

Probability For The Model---- Model --- Probability ---- Prob/I -- Prob/F ------ Ended ------

A Constant 4.358829-431 12.7 Wed May 1 13:14:232 Resonances 5.610831-313 123.8 431.4 Wed May 1 13:14:253 Resonances 5.051696E-51 624.3 707.2 Wed May 1 13:14:254 Resonances 6.026667E-01 763.7 768.4 Wed May 1 13:14:265 Resonances 2.940744E-01 775.7 776.4 Wed Nay 1 13:14:28

Bayesian Analysis Ended Fri May 3 14:23:44And Took: 1Sec. (0.02 Min.)

Figure 33. bayes.log. nnnn File

Page 86: Bayesian Analysis User Guide

Chapter 4. Output Files

86 Bayesian Analysis Software Package 01-999017-00 B0498

a search begins, not while it going on, so it is possible for the resonance frequencies tobecome disordered while the search is in progress. Each parameter is listed to four decimalplaces, although, the number of decimal places varies depending on the size of theparameter. The parameter is followed by a short description in parentheses. SeeTable 3fora list of these parameters and their meaning. This short description is only used in the logfile.

The output from the search algorithm to the log file follows this general form until thelocation of the maximum of the joint posterior probability is located, then the covariancesmatrix is computed with the Levenberg-Marquardt parameter set to zero and thiscovariance matrix is used to compute a Gaussian approximation of the posterior probabilityfor the model. The base 10 logarithm of the posterior probability is printed next. Becausethis is a logarithm, it is only differences from the previous model that are meaningful.Increasing logarithms means the model is more probable. For example, if the previousmodel probability was –128 and the current model has probability of –100, this new modelis 1028 times more probable than the previous model.

After printing out the base 10 logarithm of the probability for the model, the output files areupdated and the entire calculation is repeated. The result of this is that the log file containsrecord of what occurs in each loop of the automatic mode. Each loop produces a reportsimilar to the file shown inFigure 33. This loop continues until one of three things happen:the logarithm of the posterior probability for the model decreases, the signal detectionroutine failed to find a candidate resonance, or the maximum number of new resonances isreached. At this point the program finishes printing out the log file by printing thenormalized posterior probability for the models. This part of the printout is shown at theback of the report and begins with header reading “Probability For The Model.” The nextline is another header and then follows the probability for the models.

This table of model probabilities is cumulative and accumulates across multiple runs of theBayes_Analyze program. Different runs are separated by a blank line. After the modelprobability for the current model is appended to the probability file, the model probabilitiesare exponentiated and normalized. You may often see models with zero probability; this

Table 3. Short Description

Short Description Full Description Units

(Ph) Center phase Degrees

(T0) Starting time of FID Points

(f) Resonance frequency Hertz or PPM

(d) Decay rate constant Hertz

(Jp) PrimaryJ coupling constant Hertz

(Jx) SecondaryJ coupling constant Hertz

(Sd) Lorentzian spacing in lineshapeexpansion

Hertz

(1) First relative shim amplitude No units

(2) Second relative shim amplitude No units

...

(7) Seventh shim amplitude No units

The log file prints the parameters with a short description. This table shows thedescriptions along with an explanation and the units used.

Page 87: Bayesian Analysis User Guide

4.5 bayes.output.nnnn File

01-999017-00 B0498 Bayesian Analysis Software Package 87

means that the probability for this model was so small that it was zero in the scientificnotation used by the computer.

There are three ways to reset the probabilities file: loading a new FID, clearing theexperiment, or manually deleting the probabilities file. This file may be safely deletedanytime, even while Bayes_Analyze is running. If the file is not found, it is created.

The printed lines that make up the normalized probability for the model contain a numberof entries. These include a description of the model, the normalized probability for themodel, the “from” and “to” search probabilities, and the date and time the model wasprocessed. If constant models are present, they are shown at the top of the entries for a givenrun. They are indicated by the description “A Constant”. Note that the probability for theconstant models is computed jointly and the probability for the individual constant modelscomponents is not computed. There is no search done on the constant models, so there isan initial probability but no ending probability. Last, the “from” and “to” probabilities areonly the beginning and ending joint probabilities for the parameters that were used in thesearch. These two numbers may be used to determine which cycle of Bayes_Analyzeplaced a particular entry in the probabilities file.

After this table of probabilities is computed, Bayes_Analyze determines the amount ofCPU time it took to run this job and logs this along with the data and time the job startedand ended. After logging this last entry, Bayes_Analyze terminates.

4.5 bayes.output. nnnn FileThe output file is the main output report from the Bayes_Analyze program. The output fileis namedbayes.output. nnnn , where, as explained in “bayes.log.nnnn File,” page 84,the numbernnnn is the number of the first FID who's analysis is contained in this outputfile. This file contains the detailed output from each model processed by Bayes_Analyze.Because it contains so much detail, it can be rather difficult to follow and should be printedonly when this information is needed. When the detail is not needed, the summary reportshould be used. The summary report is essentially the section out of the output filepertaining to the model with maximum probability. For more information on the summaryreport and the difference between these two reports, see the sections “bayes.summaryl.nnnnFile,” page 92, and “bayes.summary2.nnnn File,” page 93.

When Bayes_Analyze runs in its automatic mode, many different models may be analyzed.At the end of the analysis the values of the model parameters are written to the outputreport. In this section, we describe this report in detail.

The output reports starts with a listing of the configuration parameters associated with theanalysis. An example of these configuration parameters is given inFigure 25 onpage 75,and an explanation of these configuration parameters is given in “Bayes_Analyze FileHeader,” page 74. There are two small differences between what is shown inFigure 25andwhat is printed in the output report. These difference consist of a header a the beginning ofthe report. This header merely indicates that the initial configuration parameters follow. Theother difference is at the end of the configuration parameters. The output file contains a listof the resonances processed in the slave mode:

Figure 34 shows two multiplets: one triplet and one quartet. The notation used to indicatethe triplet and quartet is the same as that explained in “Model Components,” page 82. Thisis followed by the resonance frequency and the primary and secondary coupling constants.These coupling constants are zero if they are not used.

Page 88: Bayesian Analysis User Guide

Chapter 4. Output Files

88 Bayesian Analysis Software Package 01-999017-00 B0498

The configuration parameters are then followed by one or more sets of detailed information.The detailed information consists of the output from the signal detection calculation, outputfrom the optimization of the joint probability for the parameters, the output from the modelselection calculation, and the normalized probability for the models analyzed so far. Thesignal detection calculation is not used when Bayes_Analyze is running in its slave mode.The signal detection output consists of only single line preceding the dashed line, as shownin Figure 35.

As the message indicates, this is a base 10 logarithm. In this particular case, the evidenceindicates that it is a bet of approximately 1050:1 that a resonance is present.

After the signal detection calculation is performed, the program builds a model having oneor more new resonances and then optimizes the parameters associated with that model. Theresonances added corresponds to the frequencies having maximum signal detectionprobability. The optimization step locates the maximum of the joint posterior probabilityfor the model parameters.

The second section of this report contains the values of the parameters for which the jointposterior probability is maximum.Figure 36shows an example of this output. In this figure,the global parameters consists of the two phase parameters: the center phase and the timedelay. There can be as many as 10 global parameters, however. An explanation of all theseparameters was given in “Global Parameters,” page 81, when the parameter file wasexplained, and we will not repeat those explanations.

In the output file, these parameters have been reformatted in a more readable form, thelabels assigned to these parameters differ slightly, and each parameter has an associateduncertainty with it. The uncertainty in the estimated parameter is in the form of a standarddeviation. The standard deviation is computed from the width of the joint posteriorprobability for the parameters given the model.Figure 37shows the complete list of globalparameters formatted as they appear in the output report.

Following the global parameters is the information about each model component. In theparameter file, this information was on one very long line. In the output report, each modelcomponent is on several lines and each model component has one or more amplitudesassociated with it.

The individual model components all start with a header. This header begins “#Name” andis always present.Figure 36shows five headers, so there are five model components. Eachmodel component consists of a model name, the estimated resonance parameters, and theestimated amplitudes. Both constants and resonances have amplitudes; however, onlyresonances have frequencies, decay rate constants, andJ coupling constants. The modelname, multiplet order, relative phase, and other parameters are the same as those described

Initial Model:# Order Frequency Decay Rate Primary J Secondary J1 (3,1) 0 1.2913982000000 0.8574675300000 6.9821668000000 0.00000000000002 (4,1) 0 4.8648472000000 0.88817441O0000 6.9795215000000 0.0000000000000

Figure 34. Initial Model

Base 10 Log Evidence for The First Frequency is: 49.6--------------------------------------------------------------------------------------------

Figure 35. Signal Detection

Page 89: Bayesian Analysis User Guide

4.5 bayes.output.nnnn File

01-999017-00 B0498 Bayesian Analysis Software Package 89

in “bayes.params.nnnn and bayes.model.nnnn Files,” page 74 and we will not repeat thathere.

The resonance frequency is printed on the same line with the model name and is followedby up to three additional lines containing the decay rate, the primaryJ coupling constant,and the secondaryJ coupling constant. Each of these parameters has an associateduncertainty printed with it.

Base 10 Log Evidence for The Next Frequency is: 49.6-----------------------------------------------------------------------Number of Models In This Step 6Center Phase Uncertainty Time Delay Uncertainty-5.7941E+01 7.32E-01 8.322E-03 6.28E-03

# Name1 Real Constant

Fid Amplitude Uncertainty1 5.106E+01 4.41E+01

# Name2 Imaginary Constant

Fid Amplitude Uncertainty1 1.16E+01 4.41E+01

# Name Order Type Parameter Uncertainty3 (CP) Singlet (1,1) 0 Freq 1.16733E-01 3.64E-04

Decay 1.007E+00 3.25E-01Fid Amplitude Uncertainty

1 7.997E+02 6.5SE+01

# Name Order Type Parameter Uncertainty4 (CP) Triplet (3,1) 0 Freq 1.2913983E+00 6.07E-05

Decay 8.577E-01 3.73E-02Jp 6.9822E+00 2.31E-02

Fid Amplitude Uncertainty1 9.381E+03 9.97E+01

# Name Order Type Parameter Uncertainty6 (CP) Quartet (4,1) 0 Freq 4.8648472E+00 8.60E-06

Decay 8.879E-01 6.96E-02Jp 6.9796E+00 3.26E-02

Fid Amplitude Uncertainty1 6.346E+03 1.10E+02

Base 10 Log Of The Probability of 4 Resonances =-3.17799726E+03

Probability For The Model----- Model ----Probability ----Prob/I ---Prob/F ------Ended----

1 Resonances 3.149126-312 431.0 431.1 Fri May 10 10:41:632 Resonances 3.274689E-60 626.3 707.6 Fri May 10 10:41:643 Resonances 1.000000E+00 764.3 768.3 Fri May 10 10:41:65

Bayesian Analysis Ended Fri May 10 10:42:11 1996And Took: 16 Sec. (0.26 Min.)

Figure 36. Output Report

Page 90: Bayesian Analysis User Guide

Chapter 4. Output Files

90 Bayesian Analysis Software Package 01-999017-00 B0498

Following the model component name and the resonance parameter, if present, are theamplitudes associated with each FIDs processed. If there were 10 FIDs, there are 10amplitudes. The number of the FID that the amplitude is associated with appears on eachline.

In addition to printing the amplitudes, the uncertainty in the estimated amplitude is alsoprinted. These uncertainties are different for each FID. The amplitudes shown inFigure 36are all for correlated phase models components, so there is only a single amplitude.However, uncorrelated phase models have two amplitudes associated with them: a cosineamplitude and a sine amplitude. Under these conditions, the output amplitudes have twoentries, as shown byFigure 38.

If you compare the frequency, decay rate constant andJ coupling constants, you will findthem to be essentially identical. The amplitude has been replaced by the correspondingcosine and sine amplitudes, along with an estimate of how uncertain one is of the true value.In the summary reports, these two amplitudes are reported as an amplitude and a phase. Formore on the summary reports see “bayes.summaryl.nnnn File,” page 92, and“bayes.summary2.nnnn File,” page 93.

After the output associated with the parameter estimates comes the output from the modelselection calculation. This output is in two forms: the first is a logarithm of the posteriorprobability for the model. InFigure 36, this is given by the following line:Base 10 Log Of The Probability of 4 Resonances =-3.17799725E+03

This is a logarithm of an unnormalized probability distribution; consequently, onlydifferences between this number and the logarithm of the probability for some other modelare meaningful. Roughly speaking, a difference of 1 means that the new model is fitting one

Center Phase Uncertainty Time Delay Uncertainty-5.7861E+01 1.74E+00 1.43E-02 1.65E-02

Shim Delta Uncertainty R Minus 3 Uncertainty3.6935E+01 1.03E-01 1.176E-02 1.38E-03

R Minus 2 Uncertainty R Minus 1 Uncertainty1.203E-02 1.39E-03 2.8808E-01 1.36E-03

R Center Uncertainty R Plus 1 Uncertainty2.8842E-01 2.72E-03 1.34101E-01 7.38E-04

R Plus 2 Uncertainty R Plus 3 Uncertainty1.33502E-01 6.71E-04 1.32111E-01 8.56E-04

Figure 37. Output Global Parameters

# Name Order Type Parameter Uncertainty3 (UP) Triplet (3,1) 0 Freq 1.29i424E+00 1.28E-04

Decay 8.688E-01 7.77E-02Jp 6.9828E+00 4.84E-02

Fid Cos Amplitude Uncertainty Sine Amplitude Uncertainty1 4.826E+03 2.10E+02 -8.118E+03 2.10E+02

Figure 38. Uncorrelated Output

Page 91: Bayesian Analysis User Guide

4.5 bayes.output.nnnn File

01-999017-00 B0498 Bayesian Analysis Software Package 91

additional data value. Because the number of data can be large, it is not unusual to see largedifference in the probability for the models.

The second form of this output is the normalized probability for the model. This cumulativeprobability distribution consists of one entry for every model tested. Here are these linesreproduced fromFigure 36:

Probability For The Model

-----Model ----Probability ----Prob/I ---Prob/F ------Ended----

1 Resonances 3.149126-312 431.0 431.1 Fri May 10 10:41:63

2 Resonances 3.274689E-60 626.3 707.6 Fri May 10 10:41:64

3 Resonances 1.000000E+00 764.3 768.3 Fri May 10 10:41:65

They indicate several things about the models that were processed. First, three models weretested on this run of Bayes_Analyze. If Bayes_Analyze is run multiple times, all of themodels tested are written into the probabilities file and a blank line separates the outputfrom successive runs. Each model written into the output file gets a short description. Thisdescription is under the labeled, “Model,” inFigure 36. The description is usually just thenumber of resonance components in the model.

The model description is followed by the normalized posterior probability for the model.These are labeled “Probability.” When this probability distribution is normalized, we areessentially using probability theory to answer the following question: Given the one, two,and three exponentially decaying resonances models, which of these three models bestaccounts for the data. In order to normalized the probability distribution, we have to tellprobability theory to pick the best model from this set and only from this set. This is notequivalent to saying that the three exponential model is the best, only that it is the best ofthe three tested. Indeed the statement that some model is the “best” is indeterminate untilthe alternatives against which it is being tested are given.

In this example, the one-resonance model has a probability that is essentially zero, the two-resonance model has a probability 272 orders of magnitude higher; but, it is still 50 ordersof magnitude lower than the probability for the three-resonance model. These numbers arecomputed using a Student-t distribution. The logarithm of the Student-t distributions ismultiplied by essentially the number of data values. A change of one order of magnitude inthese probabilities means, at least very approximately, that the model has fit one more datavalue, so a change of 272 means that the two-resonance model fits roughly 272 more datapoints than the one resonance model, and so forth.

This rule—one point equals one order of magnitude—is only approximate and should beused only as a guide. Usually the changes from one model to the next are so large that littlethought need go into which to accept; however, sometimes these probabilities can be veryclose. When that happens, we must carefully evaluate the different models to determinewhich is appropriate.

After the probabilities comes the initial (Prob/I) and the final (Prob/F) base 10 logarithm ofthe joint posterior probability for the parameters in the model. The joint posteriorprobability for the parameters is the probability density function used in optimizing themodel parameters. The initial and final probabilities listed here are the initial and finalprobabilities from that optimization.

Finally, the last entry is the date and time the processing occurred. When Bayes_Analyzebegins a step, it gets the date and time from the system clock. The numbers displayed arethose times. Their primary function is to supply us with one more indication of whichmodel we are dealing with. When we test many different models, it is possible for this setof probabilities to become fairly long. These dates and times, along with the initial and finalsearch probabilities, can help determine which models we are dealing with.

Page 92: Bayesian Analysis User Guide

Chapter 4. Output Files

92 Bayesian Analysis Software Package 01-999017-00 B0498

The list of probabilities printed in this section are taken from the probabilities files.Bayes_Analyze never deletes the probabilities files. If they are present, it simply appendsthe results of any new calculations to the end of these files. We maintain this informationacross multiple runs precisely so that we can test different models. To reset this list ofprobabilities, we must clear the experiment, load new data, or manually delete theprobabilities files.

After Bayes_Analyze completes a run, it computes the total computer time used and printsthis number at the end of the output file. This number is purely informational.

4.6 bayes.summaryl. nnnn FileThe filebayes.summaryl. nnnn is produced when thesummary 1button is activatedfrom the reports menu. This button calls a program named Bayes_Summary1. The purposeof this program is to summarize the information in the output files. “Bayes_SummaryPrograms,” page 68, contains more information on this program.

In the process of analyzing a FID, Bayes_Analyze develops a hierarchy of models. Thesemodels usually begin with one resonance, followed by two, etc., until either the signaldetection algorithm fails to find evidence for an additional signal or the probability for themodel goes down. The output files written by Bayes_Analyze contains all of thisinformation and can get fairly long. The summary report takes the information in the outputfiles and to prints out only that part of it that is most important to the analysis. In particular,it extracts that part of the output file that corresponds to the model having maximumprobability. In this section, we describe the output from Bayes_Summary1 and point outwhere the information has been reformatted.

First, the preceding discussion indicates that the summary report is built out of the outputfile; this is not totally correct. The summary report is built out of pieces of the output,model, probabilities, text, and procpar files. When Bayes_Summary1 is run, the programstarts by determining how many output files there are in the experiment. Each of theseoutput files are summarized one at time. Therefore, if there are 10 output files, 10 differentsummary reports are written. These reports are written to both standard out (the textwindow when the program is run under VNMR control) and to the summary files, onesummary file is written for each output report.

Much of the summary report is identical to other outputs and we will not repeat thosedescriptions here. We will simply reference you to the correct descriptions. The summaryoutput starts with a header that is unique to the summary report. The header is shown inFigure 39.

This header is made up of the name of the output file that was summarized, the date thesummary was done, the directory in which the output files were located, the name of theFID that was processed, and last the contents of the text file. In building this header,Bayes_Summary1 had to process both the text file and theprocpar file. However, thisprogram also gathers information from the model file, the output file, and the probabilitiesfile. These files are used in building the main body of the report. This header is followed by

Summaryl: /home/akgrp/glb/vnmrsys/exp3/bayes.output.O001Date/time: Fri May 10 10:42:13 1996Directory: /home/akgrp/glb/vnmrsys/exp3File: "/home/akgrp/glb/data/pl3.fid"Text File: This is test data

Figure 39. Summary Report Header

Page 93: Bayesian Analysis User Guide

4.7 bayes.summary2.nnnn File

01-999017-00 B0498 Bayesian Analysis Software Package 93

the configuration parameters and these have already been explained—see“bayes.params.nnnn and bayes.model.nnnn Files,” page 74, for a description of theseparameters.

The remaining part of the summary report is essentially identical to the output report andwe will not repeat it here. A difference worth noting is that uncorrelated resonances in thesummary report have their amplitudes reported as an amplitude and a phase, which isdifferent from the output report where they are listed as a cosine and sine amplitude. Thisdifference is mostly for convenience; sometimes the amplitude of an uncorrelatedresonances is needed.

4.7 bayes.summary2.nnnn FileThe filebayes.summary2. nnnn is produced when thesummary 2button is activatedfrom the reports menu. This button calls the Bayes_Summary2 program. “Bayes_SummaryPrograms,” page 68, contains more information on this program. Like the first summaryreport, this report is only on the section of the output file most important to the user.Because of its extremely compressed format, this report can only be run on nonarrayedFIDs. The report is essentially a column listing of the estimated frequencies, decay rateconstants, the amplitudes and the uncertainties in these parameters. The report can be runon either correlated or uncorrelated phase models, but when it is run on uncorrelated phasemodels, the sine and cosine amplitudes are reported as the square root of the sum of thesquares of these amplitudes. This quantity is the amplitude of the resonance.

An example of this report is shown inFigure 40. Note that the first few lines of this reportare essentially the same as in the Summary1 report. The main difference is in the detailedoutput. In the Summary2 report, the output is essentially a column listing of the mostprobable model in the output report. In this column listing, the frequency, decay rateconstant, amplitude, and the estimated uncertainty in our knowledge of these parametersare given. Additionally, the type of resonance and the resonance name are given. When theresonance is a multiplet, the coupling constants are given at the end of the report. When nomultiplets are present, this section of the report does not appear. When uncorrelatedresonances models are encountered, the sine and cosine amplitudes are reported in the formof a total amplitude for the resonances. The phase of these resonances are not reported. Ifthis information is needed, it is listed in the Summary1 report. Last, the resonances arereported in the units that were in use at the time the analysis was run.

4.8 bayes.probabilities.nnnn FileThe probabilities file is perhaps one of the simplest and most important files in the BayesianAnalysis package. These files are namedbayes.probabilities. nnnn , wherennnnis the number of the first FID analyzed in this file.Figure 41 is an example of this file.

This file is particularly simple in its format. It consists of a description of the model, i.e.,“A Constant,” “1 Resonance,” etc., the base 10 logarithm of the probability for the model,the beginning and ending search probability (if applicable), and the date and time the modelwas tested.

To compare several different models using probability theory, the user computes theprobability for each model. The model with highest probability is the best. WhenBayes_Analyze computes the probability for a model, that probability is appended to theprobabilities file. Because information is appended to this file, it accumulates across

Page 94: Bayesian Analysis User Guide

Chapter 4. Output Files

94 Bayesian Analysis Software Package 01-999017-00 B0498

Summary2: ./bayes.output.0001Date/time: Fri Sep 6 08:57:32Directory: .File: "/home/jagrp/glb/vnmrsys/data/ethyl.ether"Text File: This is test data

Freq Error Decay Error Amplitude Error Type Resonanceppm ppm Hertz Hertz arbitrary

0.116750 1.10E-04 0.604000 0.110000 648.0000 27.00000 (CP) Singlet1.291439 7.90E-05 0.792000 0.023000 9033.000 47.00000 (CP) Triplet (See 1)4.864975 2.50E-05 0.772000 0.026000 5926.000 51.00000 (CP) Quartet (See 2)5.648083 6.30E-05 2.991000 0.057000 3999.000 50.00000 (CP) Singlet

No. Jp Err Sp ErrHertz Hertz Hertz Hertz

1 6.978000 0.0081002 6.972500 0.009600

Bayesian Analysis Ended Thu Dec 1 15:35:19 1994And Took: O Sec. (0.00 Min.)

Figure 40. Summary2 Report

Model Desc Model Prob Search/I Search/F Date-Time1 Resonance 0.000 102.0 124.9 Mon May 20 08:54:442 Resonances 40.823 169.4 174.9 Mon May 20 08:54:453 Resonances 93.923 228.5 237.7 Non May 20 08:54:454 Resonances 165.324 298.0 318.8 Mon May 20 08:54:465 Resonances 261.385 396.5 426.5 Non May 20 08:54:476 Resonances 443.048 536.2 622.7 Mon May 20 08:54:487 Resonances 478.148 666.7 668.5 Mon May 20 08:54:498 Resonances 515.355 713.7 716.9 Mon May 20 08:54:519 Resonances 576.265 770.8 790.1 Mon May 20 08:54:52

10 Resonances 576.079 797.5 798.3 Mon May 20 08:54:55

1 Resonance 90.088 220.1 220.2 Mon May 20 08:55:092 Resonances 156.099 286.7 296.1 Mon May 20 08:55:093 Resonances 260.609 384.5 410.9 Mon May 20 08:55:104 Resonances 450.966 531.9 614.9 Mon Nay 20 08:55:115 Resonances 486.696 659.5 661.2 Mon May 20 08:55:126 Resonances 524.166 706.5 709.6 Mon May 20 08:55:137 Resonances 584.155 762.5 781.5 Mon May 20 08:55:148 Resonances 583.867 788.8 789.5 Mon May 20 08:55:16

2 Resonances 284.782 431.2 431.4 Mon May 20 08:55:303 Resonances 546.734 624.3 707.2 Mon May 20 08:55:314 Resonances 596.811 763.7 768.4 Mon Nay 20 08:55:325 Resonances 596.499 775.7 776.4 Mon May 20 08:55:33

2 Resonances 281.672 428.1 430.4 Mon May 20 08:56:023 Resonances 542.561 624.6 705.9 Mon May 20 08:56:054 Resonances 592.327 762.4 767.0 Mon May 20 08:56:085 Resonances 592.005 774.4 775.1 Mon May 20 08:56:11

Figure 41. bayes.probabilities. nnnn File

Page 95: Bayesian Analysis User Guide

4.8 bayes.probabilities.nnnn File

01-999017-00 B0498 Bayesian Analysis Software Package 95

multiple runs of Bayes_Analyze, and so it may be used to compare many different modelsto see which model is best.

To illustrate how you can use the probabilities file to do model selection, seeFigure 41. Thisfigure is an example of the probabilities file for four different runs of Bayes_Analyze. Notethat Bayes_Analyze has separated these four different runs with a blank. In this figure, wehave changed the normalization so that the logarithm of the probability for the oneresonance model is zero. The probabilities for the models are stored as unnormalizedlogarithm, so any constant may be added or subtracted from every value in the file withoutchanging the normalized probabilities.

The probabilities file illustrated inFigure 41are from an analysis of a1H FID of ethyl ether.Part of the spectrum of the FID is shown inFigure 1onpage 15. This is a small part of theethyl ether spectrum in the region of a triplet and the quartet. In addition to theseresonances, this spectrum contains two other small resonances that are not shown.

Bayes_Analyze was run on this data four different times, using different initial models, tosee which model was the best description of this data. In the first of the four runs,Bayes_Analyze was allowed to find correlated resonances in its automatic mode. Themaximum resonances was set to 20 resonances, many more than the 9 present. In that run,the program found 9 resonances—3 associated with the triplet, 4 with the quartet, and 2nuisance resonances. When Bayes_Analyze tried to add a tenth resonance, the probabilityfor the model went down, thus indicating that this last candidate resonance was probablynoise. This run is represented inFigure 1 by the first 10 lines. Notice that the probabilityfor the model starts at 0 and then rises steadily until it reaches a maximum of 576.265 andthen it decreases.

The first test indicated that a 9 resonance model was the best; however, we know that thereis a triplet and a quartet in this data. In the second test, we marked the triplet, and letBayes_Analyze add resonances until the probability for the model decreased.Bayes_Analyze added resonances until it reached an 8 resonance model, and then thelogarithm of the model probability decreases; so Bayes_Analyze has indicated that a 7resonance model (1 triplet and 6 singlets) is the best model tested so far. The logarithm ofthe probability for 9 singlets was 576.265; while the logarithm of the probability for the 6singlet plus one triplet is 584.155, an increase of 7.89 orders of magnitude. So probabilitytheory prefers this model to the 9 singlet model, as it should.

In the third test, we marked the triplet and quartet, and then allowed Bayes_Analyze to addresonances in its automatic mode. Bayes_Analyze tested three additional resonances andon the third resonance the logarithm of the probability for the model decreased. So themodel preferred in this test was a triplet, a quartet and two singlets for a total of 9 peaks.The base 10 logarithm of the probability for this model is 596.811. This should becompared to the best model in the previous two tests: 584.15 and 576.265. Note that thismodel is 12.656 orders of magnitude more probable than the best previous model.

For illustrative purposes, we ran one additional test. We turned on third order shimming andallowed Bayes_Analyze to run using the triplet and quartet model as a starting point. In thiscase, Bayes_Analyze added three resonances and, on the third singlet, the probabilitydecreased. But the probability for this shimming model has decreased from 596.811 to592.327, a decrease of 4.484 orders of magnitude—so the shimming model does not help.The shimming model did nothing to improve the fit and the prior probability for this modelhas decreased enough to rule this model out.

Page 96: Bayesian Analysis User Guide

Chapter 4. Output Files

96 Bayesian Analysis Software Package 01-999017-00 B0498

Page 97: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 97

Chapter 5. Common Problems

The Bayesian Analysis package has been in existence, more or less in its current form, forseveral years. It has been used many times by many different people on a wide variety ofdata. The systems was intentionally designed to allow great flexibility in how the analysisis to be performed because no one knows more about your data than you. But in runningany system as complex as the Bayesian Analysis package, problems are going to occur.Some of these problems are well known because they keep being rediscovered by peoplewhen they first start using the package. In this chapter, we attempt to describe some of theseproblems and how to go about fixing them.

There are two main sources of these problems: very high signal-to-noise data, and effectsthat appear across multiple runs of Bayes_Analysis. High signal-to-noise data tends tocome in two types— very high signal-to-noise baseline artifacts and very high signal-to-noise with no baseline artifacts. Both types of data can cause the programs to hallucinate—the misfit between the Lorentzian lineshape and the “true” lineshape in the data becomesstatistically significant. The programs see this misfit and try to model it as resonances.There is no single simple solution to this problem, but on specific types of problems we dogive some suggestions below.

The problems that occur across multiple runs of the analysis program, Bayes_Analyze, aremore subtle. These problems tend to be related to the prior probabilities in use in theprograms. These priors tend to be at times both a blessing and a curse. They are a blessingbecause they solve certain types of serious problems that occurred in a previous version ofBayes_Analysis. This previous program was named Quad, an abbreviation of the wordquadrature because it was the first program that we developed that used full quadraturemodel.

The problems occurred when Quad would take a marked resonance and move it. Nowmoving a resonance when the parameters are being optimized is not bad; indeed, that is theentire purpose of the optimization step. Moving it completely across the spectrum andplacing it under another peak is, however, and this is what was happening. Consistently,what we would see is that in high signal-to-noise data, Quad would move a small markedresonance to the location of a big unmarked resonance—the non-Lorentzian lineshape wascausing the problems.

When we wrote this new version of the program, we solved this problem using two differenttacks. First, we restricted how far a marked peak could be moved, and second, we addedthe shimming model. The way we restricted how far a peak could be moved was by addinginformative prior probabilities. These priors indicated such things as a decay rate constantmust be positive, and a marked peak must stay within a typical linewidth of where it wasmarked. This means that the searching algorithm can move the resonance frequencyprovided the frequency stays under the marked line. And if you think about this, you shouldfind it a reasonable criteria. Problems can occur on subsequent runs of Bayes_Analyze,however, if you do something that changes the maximum likelihood location of theresonances. The prior information prevents the peak from being moved to its maximumlikelihood location. However, the program can still fit the data by adding additional

Page 98: Bayesian Analysis User Guide

Chapter 5. Common Problems

98 Bayesian Analysis Software Package 01-999017-00 B0498

resonances at the maximum likelihood location. This is the source of most problems thatoccur across multiple runs.

The solution is to remove the initial model and rerun the analysis. Removing the initialmodel then allows Bayes_Analyze to place the resonances at their maximum likelihoodlocation. There are a number of options that the user can set that change the maximumlikelihood location of a resonance, these are explained below also.

In the following list, the problem is given in bold type. Each problem is followed by anexplanation of what is happening. We begin with an example of the type of problems thatcan occur across multiple runs of Bayes_Analyze.

• I have a spectrum that looks phasable using a zero phase correction, so I ran itthat way. But when I looked at the models, the models have the characteristicresidual that indicates a phase shift across the spectrum. I turn on the first orderphase correction and rerun the analysis, now however, when I look at the results,the program has put all kinds of small lines in the spectrum that are clearly notphysical. So what happened?When we use probability theory, two types of information go into the analysis: theinformation about the model and information about the values of the parameters in themodel. Information about the values of the parameters is encoded in the program as aseries of prior probabilities. Among other things, these prior probabilities keep thedecay rate constants positive, and when you mark a peak they keep that resonance nearwhere you said it must be. Resonances marked by the user and resonances found bythe signal detection routines are not treated differently by Bayes_Analyze.

In both cases, the resonances are constrained to stay within about half a linewidth oftheir initial positions. Turning on or off the first order phase correction changes theapparent location of a resonance, but the prior information prevents the searchingroutines from moving the lines. Those unphysical resonances are caused by the priorconstraining how far a peak can be moved.

The solution is simple, remove all the resonances and rerun the analysis with phasecorrection on.

• The program does not seem to be able to run automatically.The most common cause of this is that the data contains some type of artifact. Theartifact might be a large baseline artifact or it might be some type of constant offset inthe two channels.

For cases where the data contain a rolling baseline, try the following: start the analysiswith a value of parameterlb that matches the broad lines. If you don't know whatvalue this should be, setlb to a value somewhere between 100 and 1000 times largerthan the narrow lines in the spectrum and then run the analysis allowing it to find twoor three lines. When this completes, you should have the baseline modeled. Now setlb to a value that matches the narrow lines and then rerun the analysis. This should fixthe problem. If the program is still unable to search automatically, try adding morebroad lines.

For cases where the data contain a constant offset, turn on a real and imaginaryconstant. You can determine if an offset is present by issuing the commandwft('nodc') and then look at the center of the spectrum. If a resonance magicallyappears in the center, the data contain a constant offset in the two channels. Turning onthe real and imaginary constant models should fix this problem.

• I mark some lines, and then ran the analysis, but when the analysis wascompleted, it did not have my marked lines in it. What happened?When you mark lines, you must use the menu brought up by themark button on theBayes_Mark menu (Menu 12onpage 35). You cannot use the menu brought up by theds command, and you cannot use the menu brought up by theinteractive button.

Page 99: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 99

Neither of these menus work, in spite of the fact that they are identical to the menubrought up by themark button. Themark button brings up theds menu and then,when that menu returns, it processes the mark file. The mark file is not processed whentheds menu is accessed any other way.

• How do I mark a multiplet of a multiplet?To mark a multiplet of a multiplet requires that you mark three different pieces ofinformation: the multiplet center, the primaryJ coupling, and the secondaryJcoupling. These three quantities must be marked in that order. Note that the primaryJcoupling must be larger than the secondaryJ coupling. For more on markingmultiplets, see the section “Bayes_Mark Menu” on page 35.

• I loaded an experiment andthenbrought up the Bayes menus. Now when I runthe modeling program or do any other processing, the resonances in the model arewrong. What is going on?When an experiment is loaded by the Varian files menu, the experiment is not clearedof files prefixed withbayes . When thebayes command is entered, it looks in theexperiment, and if there are any files prefixed withbayes , it reads those files. Thesolution is to use theclear button on the setup menu before you begin an analysis.

• I saved the FID from exp5 and now my data is gone. What happened?The FID placed in exp5 is a model of the original,it is not your original data.Savingthis experiment to the original data directory willdestroyyour original data. Themenus do warn you that you are about to delete your original data, but they let youproceed if you confirm the operation.

The solution to this is to always save the Bayesian Analysis files from the sourceexperiment, and always save exp5 to a new name.

• I set the signal-to-noise region but the program seemed to ignore it. What is goingon?To specify either a signal or a noise region, you must expand the region for theBayesian Analysis menus. If you attempt to set these regions using thedf commandit does not function correctly. In the case of setting a noise region, you must alsoactivate thenoisebutton onMenu 18 (seepage 47).

• I have a model in place and changed the referencing or units and nothing lookscorrect. What happened?The menus set a series of Bayesian Analysis parameters. When these parameters areset, they are stored using whatever units and referencing you are currently using. So ifyou change units or reference, the stored parameters are in the wrong units.

If you must change the units, the clear the experiment and start over. Otherwise, changethe units back.

• I have a model, and when I display the spectrum, not all of the model resonancesare displayed, in spite of the fact that the entire spectrum was displayed. Whereare my other peaks?When spectra are displayed, theds command displays a range window, a lowest tohighest frequency window. Assuming no referencing, when the entire spectrum isdisplayed, the low frequency is –sw/2 and the high is+sw/2, in hertz, wheresw is thespectral width parameter. The missing resonances are outside of this window and werealiased, and Bayes_Analyze figured it out. Usually, these missing resonances arebaseline artifacts. Baseline artifacts are modeled by very rapidly decaying sinusoids.Sometimes these sinusoids may be aliased.

• I ran a model with shimming turned on, but it did not seem to help?For the shimming model to work, two things must happen: the signal-to-noise of thedata must be extremely high and the search algorithm must converge. If the signal-to-

Page 100: Bayesian Analysis User Guide

Chapter 5. Common Problems

100 Bayesian Analysis Software Package 01-999017-00 B0498

noise ratio of the data is not high, the misfit between the exponential decayingsinusoidal model and the resonances in question will be small. If the size of thisdifference is on the order of the size of the noise standard deviation, then probabilitytheory cannot tell the shimming misfit from noise. Consequently, there may be no peakin the probability distribution as a function of the shimming parameters. If thishappens, the probability for the shimming model decreases.

Similarly, if the search algorithm does not get a good enough initial guess for theshimming parameters, the search algorithm may not converge. If this happens there isno peak in the joint probability for the parameters and again the probability for themodel decreases.

You have no control over the initial values used for the relative shimming amplitudes.However, you do have some indirect control over the value used for the shimmingdelta. The shimming delta is set from the current value oflb . Doubling the value oflb doubles the initial guess for the shimming delta. There is a chance that changingthe shimming delta might help the search to converge but, frankly, when the searchdoes not converge, it is usually an indication that the signal-to-noise of the data is toolow. Consequently, if the probability for the shimming model does not increase, youare better off to remove the shimming model.

• The program does not seem to be able to model my resonances. The spectrumlooks fine but nothing fits. I even tried marking the resonances, but the markedresonances don't fit. What's going on?The resonances are probably aliased. The model in use by the Bayesian Analysispackage knows the sign convention that represents a nonaliased sinusoid. If theresonances are aliased, they still appear in the sampling window in the discrete Fouriertransform, but they are folded in. When resonances are folded, the sign conventionschange and the model does not correctly fit the resonances.

Assuming you want to use the Bayesian Analysis package to analyze the data, youhave two choices: rerun the sample using a larger sweepwidth so the resonances arenot aliased or try editing thebayes.params file and adjust the frequency by addingor subtracting the sweepwidth from the location of the resonance in the spectrum. Ifthe resonance is on the left half of the spectrum, add half the sweep width. If it is onthe right half, subtract. However, if you do this, don't be surprised if the model appearsstrange. Aliased resonances are, by definition, outside the window being displayed bythe Bayes_Display menu. Consequently, the aliased resonance never appears in the toppart of the display, even thought they are obviously present in the data and the model.

Page 101: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 101

Appendix A. Error Messages

This appendix contains a complete listing of messages that Bayes_Analyze and Bayes_Model write to the status file. Each message is numbered and shown in bold. The messagesare divided into three general categories: informational, setup errors, and program errors.The categories are not organized in any particular order. There are some additionalcomments about each category at the end of each category.

A.1 Informational MessagesWhen Bayes_Analyze is running in either automatic or slave mode, the status filebayes.status. nnnn is updated with an information message whenever the programchanges from one general function to another. The messages do not indicate any problem.:

1. Reading input data - The input FIDs are being read by Bayes_Analyze.

2. Completed Baseline Artifact Model - The baseline model has been processed.Bayes_Analyze will attempt to model a baseline artifact whenever the baselineroutines are activated in the parameter file. These routines can only be activatedmanually at present.

3. Probability For A Constant Completed - Computing the probability for theconstant model is now completed.

4. Performing n Resonance Search -Bayes_Analyze is optimizing the parameters foran n resonance model where n is the number of resonances components in the model.

5. Completing n Resonance Model -The maximum of the joint posterior probabilityfor the n resonance model has been located and Bayes_Analyze is now writing theoutput files and computing the probability for the model.

6. Completed n Resonance -Bayes_Analyze has finished then resonance model buthas not yet started then+1 model.

7. Analysis completed -Bayes_Analyze has completed running in both the slave andautomatic mode. You may now print, model, or modify the analysis in anywaydeemed appropriate.

8. Fid Number n Modeled - The analysis has been completed.

A.2 Setup ErrorsThe following messages indicate some type of a problem. If you receive one of thesemessages, you must take action to correct the problem.

9. Configuration error - Did not recognize (text) -There is an error in theconfiguration parameters in the parameter file. The word “(text)” is replaced by thetext that was not recognized.

10. Memory Allocation Failed - Rerun Later - Both Bayes_Analyze and Bayes Modeldynamically allocates virtual memory for the data and for the models. If there is notenough memory available, you receive this message. If you have sufficient virtual

Page 102: Bayesian Analysis User Guide

102 Bayesian Analysis Software Package 01-999017-00 B0498

memory, you can try again later. If you do not have enough virtual memory to runthe program, you can increase the swap space and then rerun the analysis.Alternately, you can try analyzing fewer FIDs. Along the same line, you can tryreducing the amount of data analyzed by setting a signal region. Reducing either ofthese reduces the amount of virtual memory requested.

11. Fid File Not Found - Correct Model File - The input FID file was not found.Bayes_Model is looking for the FID specified in the model file. Either that FID hasbeen deleted, the model file is wrong, or Bayes_Model is being run on a machinethat does not have access to the FID.

12. Initial Model In Error - Fix - When Bayes_Analyze read the input parameter file,it detected a problem in the file. If you created the file manually, you need to correctthe problem. Before Bayes_Analyze proceeds to process the input model, BayesAnalyze calls the routine that computes the prior probability for all of theparameters. If this model is valid, in the sense that all of the parameters arephysically reasonable, the routine that evaluates the prior probability return a zerostatus. If the parameters are not physically reasonable, the routine sets a nonzerostatus and this is what happened. The types of problems that can cause this are:negative decay rate constants, the secondary coupling constant is greater than theprimary coupling constant, one of the coupling constants or shimming amplitudes isnegative. The number of things that can be wrong here is extensive, but it is sometype of logical problem. Getting an input field in the wrong place could also causethis problem.

13. The input file is in an old format Vers('nnn') - The input file contains a bad fileversion or a file version no longer recognized by the Bayesian Analysis package.

14. ASCII Fid File Error - The input ASCII lid file was not found or it contained toofew total data values.

15. The Input Fid File Was Not Found - The open for the input FID file failed. Theinput file name is probably incorrect. This error can occur in either the Bayes_Modelor Bayes_Analyze.

16. The ASCII Parm File Was Not Found - The file name in the parameters file is inerror or the input ASCII parameter file is not present. Either way, Bayes_Analyzecould not find the file.

17. The ASCII Parm File Is In Error - The ASCII input parameter file is in error.Check the file and make the appropriate corrections. For more on this file, seeSection 4.3, “bayes.params.nnnn and bayes.model.nnnn Files,” on page 74.

18. Input Procpar File Not Found—See log file - The open failed on theprocparfile. Either the name in the parameter or model file is incorrect or the file has beendeleted. The log file contains the name of the file the program was trying to read.

19. Input FID File Was Not Found - See log File -The open failed for the Varian FIDfile. Either the name in the parameter or model file is incorrect or the file has beendeleted. The log file contains the name of the file the program was trying to read.

20. Adding Freq Would Cause Max_Freq To Be Exceeded - The requested analysishas exceeded the capabilities set at the time Bayes_Analyze was compiled. You candetermine the limits by running the commandbayes_analyze limits . Thiscauses Bayes_Analyze to print its hard coded limits. If you need these to be largercontact Varian. See Chapter 3, “Bayesian Analysis Programs” for more on runningBayes_Analyze.

21. Adding Freq Would Cause MaxRes To Be Exceeded - Same as above.

22. Adding Freq Would Cause Rmax To Be Exceeded - Same as above.

Page 103: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 103

23. Adding Freq Would Cause MGMAX To Be Exceeded -Same as above.

24. Adding Resonance Would Cause RMAX To Be Exceeded -Same as above.

25. No of fids exceeded max - see log file -The requested number of FIDs exceeded themaximum allowed for this version of Bayes_Analyze. Either reduce the number ofFIDs requested or contact Varian for a version of the programs with larger limits.The log file contains the current limits.

26. No of fids exceeded actual—see log file - Therequested number of FIDs exceededthe actual number in the array.

27. Total data values exceeded max—see log file - The requested number of datavalues exceeds the maximum allowed for this version of Bayes_Analyze. You candetermine the maximum allowed for the parameters by running the commandbayes analyze limits . This causes Bayes_Analyze to print its hard-codedlimits. If you need these to be larger, contact Varian. See Chapter 3, “BayesianAnalysis Programs” for more on running Bayes_Analyze.

28. Total data values requested exceeded actual—see log file - The number of datavalues that are supposed to be used is greater than the actual number of data valuesin the FID.

29. Requested Fid Is Not In Model File -The input parameter file does not contain theparameters for the FID you wanted to model.

A.3 Program ErrorsExcept for messages 37 and 38 (which are discussed further at the end of this section), thefollowing list of errors are true program errors. If you receive one of these messages, itindicates that Bayes_Analyze has a serious internal problem and you should contact Varianimmediately.

To illustrate what is meant by a “true” program error, consider message 39. The routineSETMODEL has the function of taking a particular model and generating the time domainmodel. The model to generate is requested by the calling routine. The SETMODEL routineconsists of a series of IF statements that determine the type of model to be processed andthen calls the appropriate model dependent code. Message 39 can only be obtained if theseIF statements fail to recognize the model, and the only way the model could beunrecognized is if we forgot to modify this routine when a new model was added.Therefore, this message represents a very significant problem in Bayes_Analyze thatshould never be seen outside of testing. With the exception of messages 37 and 38, the othermessages have similar implications.

Here is the list of program errors:

30. CONSTGIJ - Program Error Contact Varian

31. DEVZERO - Program Error Contact Varian

32. OUTMODEL - Program Error Contact Varian

33. PMSG—Program Error Contact Varian

34. PUTMODEL - Program Error Contact Varian

35. SETGIJ—Program Error Contact Varian

36. TRANS - Program Error Contact Varian

37. ALOOF—Possible Program Error Investigate Further (see below)

38. ALOGP2 - Possible Program Error Investigate Further (see below)

Page 104: Bayesian Analysis User Guide

104 Bayesian Analysis Software Package 01-999017-00 B0498

39. SETMODEL - Program Error Contact Varian

40. SCCETRANS - Program Error Contact Varian

41. SCUETRANS - Program Error Contact Varian

42. GETMODEL - Program Error Contact Varian

43. APPEND_TEXT - Program Error Contact Varian

44. READHDR- Program Error Contact Varian

45. WRITEDATA—Program Error Contact Varian

46. WRITEMODEL - Program Error Contact Varian

47. WRITERESID - Program Error Contact Varian

48. COPY_PROCPAR—Program Error Contact Varian

49. LIST_MODEL—Program Error Contact Varian

The two exceptions in this list are messages 37 (ALOOF) and 38 (ALOGP2),. Althoughthese two messages are considered program errors, they may be caused by the model, sowe need to discuss the conditions under which they may occur.

In the process of marginalizing out the amplitudes, a matrix must be inverted. Message 37indicates that this matrix is singular. When this matrix becomes singular, it is almost alwaysbecause one or more of the resonances have converged to the same resonance frequency.This behavior may occur under several circumstances: first it is possible that a peak wasmarked and this peak was so far from the value indicated by probability theory thatBayes_Analyze added one or more additional resonances near the same location. Theseresonances are nearly identical and this can cause the error. The easiest thing to try underthese conditions is to remove the offending resonances and allow Bayes_Analyze to run inits automatic model.

There is one other condition where this problem has been known to occur. NMR lines neverdecay in a perfectly exponential manor because the magnetic fields are never perfectlyuniform. When the signal-to-noise is very high, Bayes_Analyze may try to fit so manyresonances at nearly the same resonance frequency that the matrix it is trying to invertbecomes singular. Unfortunately, in this case, there is little that can be done. You can tryturning on the shimming models and rerunning the analysis, but if the problem reoccurs,you may not be able to analyze this data.

Message 38 is almost the same as message 37, and is caused by essentially the sameconditions. The previous error occurs when the matrix inversion routine detects that thematrix is singular. Here the inversion routine did not detect failure and it returned a zerostatus. After the inverse is computed, Bayes_Analyze computes the projection of the dataonto the model. What it found was that the projection of the data onto the model was greaterthan the projection of the data onto itself. This is simply not possible. When it happens, itmeans that the matrix inverse failed.

Page 105: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 105

Appendix B. Software Installation

Bayes software requires about 6 megabytes of disk space in thevnmr directory.

B.1 Installing the SoftwareTo install the software, do the following steps:

1. Mount the CD-ROM as described in the manualVNMR and Solaris SoftwareInstallation.

2. Log in asvnmr1 .

3. Open a UNIX window and change to thevnmr directory by entering thefollowing UNIX command:

cd /vnmr

4. Depending on the computer on which you are installing the Bayes software,enter one of the following commands.

Note: In entering thecp command, it is important to include a space and the dot (e.g.,*. )at the end of the command.

B.2 Making Bayes Commands and Menus AvailableThe Bayes application is selected in VNMR as an “app mode.” To make the Bayescommands and menus available, do the following steps.

1. In the VNMR menu, click on the Main menu.

2. Click on Setup.

3. Click on App Mode.

4. Click on Bayes.

Computer Operating system Command.

Sun Solaris 2x cp -r /cdrom/bayes_sun/* .

SGI IRIX 5.x or 6.x cp -r /cdrom/bayes_sgi/* .

IBM AIX 4.x cp -r /cdrom/bayes_ibm/* .

Page 106: Bayesian Analysis User Guide

106 Bayesian Analysis Software Package 01-999017-00 B0498

Page 107: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 107

Bibliography

1. Bayes, Thomas Rev., “An Essay Toward Solving a Problem in the Doctrine ofChances,”Phil. Trans. Roy. Soc., 53,pp. 370-418, 1763. Photographic reproductionin E. C. Molina (1963). Reprint, G. A. Barnard in Biometrika45,pp. 293-313 (1958)and in Pearson & Kendall (1970).

2. Bretthorst, G. Larry, “Bayesian Spectrum Analysis and Parameter Estimation,” inLecture Notes in Statistics,J. Berger, S. Fienberg, J. Gani, K. Krickeberg, and B.Singer, eds., vol. 48, Springer-Verlag, New York, 1988.

3. Bretthorst, G. Larry, “Bayesian Analysis. I. Parameter Estimation Using QuadratureNMR Models,” J.Magn. Reson., 88,pp. 533-551, 1990.

4. Bretthorst, G. Larry, “Bayesian Analysis. II. Model Selection,” J.Magn. Reson., 88,pp. 552-570, 1990.

5. Bretthorst, G. Larry, “Bayesian Analysis. III. Applications to NMR SignalDetection, Model Selection and Parameter Estimation,” J.Magn. Reson., 88,pp.571-595, 1990.

6. Bretthorst, G. Larry, “Bayesian Analysis. V. Amplitude Estimation for MultipleWell-Separated Sinusoids,” J.Magn. Reson., 98,pp. 501-523, 1992.

7. Bretthorst, G. Larry, “An Introduction To Parameter Estimation Using BayesianProbability Theory,” inMaximum-Entropy and Bayesian Methods, P.F. Fougere, ea.,Kluwer Academic Publishers, Printed in the Netherlands, 1990.

8. Bretthorst, G. Larry, “An Introduction To Model Selection Using BayesianProbability Theory,” inMaximum Entropy and Bayesian Methods,G. R. Heidbreder,ea., pp. 1-42, Kluwer Academic Publishers, Printed in the Netherlands, 1996.

9. Jaynes, E. T.,Probability Theory: The Locic Of Science.available by anonymousFTP frombayes.wnstl.edu .

10. Jeffreys, Harold Sir,Theory of Probability,Oxford Univ. Press, London, 1939 Latereditions, 1948, 1961.

11. Kotyk, John, N. G. Hoffman, W. C. Hutton, G. L. Bretthorst, and J. J. H. Ackerman,“Comparison of Fourier and Bayesian Analysis of NMR Signals. I. Well-SeparatedResonances (The Single-Frequency Case),” J.Magn. Reson., 98,pp. 483-500, 1992.

12. Neil, Jeffrey J., and G. L. Bretthorst, “On the Use of Bayesian Probability Theoryfor Analysis of Exponential Decay Data: An Example Taken from IntravoxelIncoherent Motion Experiments,”Magn. Reson. in Med., 29,pp. 642-647, 1993.

13. Bretthorst, G. Larry, “Estimating The Ratio Of Two Amplitudes In NuclearMagnetic Resonance Data,” inMaximum-Entropy and Bayesian Methods, C.R.Smith and G. J. Erickson, eds., Reidel, Printed in the Netherlands, 1991.

14. Bretthorst, G. Larry, “Bayesian Analysis. IV. Noise and Computing TimeConsiderations,”J. Magn. Reson., 93,pp. 369-394, 1991.

15. Press W. H., S. A. Teukolsky, W. T. Vetterling and B. P. Flannary,Numerical RecipesThe Art of Scientific Computing Second Edition,Cambridge University Press,Cambridge UK, 1952.

Page 108: Bayesian Analysis User Guide

108 Bayesian Analysis Software Package 01-999017-00 B0498

Page 109: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 109

IndexIndex

Symbols# fids button, 43(1) to (7) parameters, 86(CP) model, 79(CP) value, 51(d) parameter, 86(f) parameter, 86(Jp) parameter, 86(Jx) parameter, 86(Ph) parameter, 86(Sd) parameter, 86(T0) parameter, 86(UP) model, 79(UP) value, 51

Numerics1st fid button, 432ndry button, 373rd order button, 525th order button, 527th order button, 52

Aacqfil directory, 77activate shims indicator, 80adding resonances to the model, 72aliased resonances, 100ALOGP2 error message, 103, 104ALOOF error message, 103, 104amplitude ratios, 40analysis button, 15, 16, 32analysis program, 13analysis setup, 23analyzing FIDs, 13App Mode button, 105APPEND_TEXT error message, 104arraydim parameter, 43arrayed FIDs, 24, 56arrayed model, 19artifacts in data, 49, 98ASCII FID file error, 102ASCII input file, 76ASCII param file in error, 102ASCII param file not found, 102ASCII parameter file, 76at parameter, 80automatic mode, 13, 14, 63, 87automatic peak finding mode, 51

Bbackground button, 54baseline artifacts, 74, 78, 97, 98, 99batch button, 54batch control of an analysis, 23batch jobs, 54bayes command, 15, 16, 23, 31, 99Bayes menu, 15, 31bayes.log.nnnn file, 84bayes.model.nnnn file, 67bayes.noise file, 47, 67, 78

bayes.output.nnnn file, 55, 68, 87bayes.params file, 17, 23, 24, 25, 35, 43, 44, 45,

47, 50, 56, 70bayes.params.nnnn file, 56, 74bayes.probabilities.nnnn file, 93bayes.status file, 72, 73bayes.status.nnnn file, 101bayes.summary2.nnnn file, 68, 93bayes.summaryl.nnnn file, 68, 92Bayes_Analysis menu, 16, 32Bayes_Analysis program, 13bayes_analyze command, 13, 17, 65Bayes_Analyze program, 63, 73, 74, 97Bayes_Batch_Mode men, 54Bayes_Constants menu, 49Bayes_Data_Params menu, 43Bayes_Display menu, 19, 20, 31, 57Bayes_Display2 menu, 57Bayes_Execution menu, 17, 52, 66Bayes_Find menu, 40Bayes_Initial_Model menu, 34Bayes_Lineshape menu, 52Bayes_Mark menu, 35, 98bayes_model command, 13, 66Bayes_Model program, 13, 23, 66, 73, 74Bayes_Model_Params menu, 17, 47bayes_noise command, 67Bayes_Noise menu, 47Bayes_Noise program, 67, 78Bayes_Phase menu, 50Bayes_Primary_Pattern menu, 37bayes_probs command, 68Bayes_Probs program, 68Bayes_Reports menu, 21, 55Bayes_Results menu, 18, 54, 66Bayes_Secondary_Pattern menu, 40Bayes_Setup_Ana menu, 16, 33Bayes_Setup_Mod menu, 56bayes_summary1 command, 68Bayes_Summary1 program, 55, 68, 92bayes_summary2 command, 68Bayes_Summary2 program, 55, 68, 93Bayesian Analysis files, 33Bayesian Analysis package, 13Bayesian probability theory, 22Bruker data processing, 26building an initial model, 72button name convention, 11

Ccancel button, 52Cancel Cmd button, 52canceling Bayes_Analyze, 52center of resonances, 27center phase, 86center phase parameter, 81changing the model, 24clear button, 16, 33, 99clearing the experiment, 33, 99comparing models, 93complex data values, 79complex points line, 45configuration error, 101

Page 110: Bayesian Analysis User Guide

Index

110 Bayesian Analysis Software Package 01-999017-00 B0498

configuration parameters, 76, 87constant in real or imaginary channel, 26constant models, 24, 26, 49, 71, 87constant offset, 17, 26, 98constants button, 17, 49CONSTGIJ error message, 103conventions used in manual, 11COPY_PROCPAR error message, 104correlated button, 41, 51correlated phase model, 84correlated phases, 14, 26correlated resonances model, 81coupling constants, 87CPU time, 87

Ddata params button, 16, 34data values exceeded actual, 103data values exceeded maximum, 103Data_Setup_Filter menu, 45Data_Setup_Signal menu, 44dc biases of channels, 26DC Offset In Both line, 50dc offsets, 17, 50decay model, 26decay rate constants, 13, 28, 45, 81, 86default constant models, 71Default Lb line, 44, 45Default Model line, 51default parameter values, 16, 33DEVZERO error message, 103df command, 99df menu, 44, 47, 48directory organization, 77display button, 55, 57, 58displaying parameter settings, 70displaying spectra, 19doublet button, 37ds menu, 57ds program, 34, 35, 36, 98, 99dscale command, 77

Eerror messages, 73, 101ethyl ether spectrum, 14, 15, 95exec button, 52execution button, 16, 17, 33exp5 (experiment 5), 18, 20, 23, 31, 56, 57, 66, 99expand button, 45, 48expanding the noise region, 48expanding the region of interest, 41expansion order, 80experiment execution time, 27exponentially decaying sinusoidal resonances, 16exponentially decaying sinusoidal signal, 25

FFID analysis, 13FID file not found, 102FID model number, 18

FID not in model file, 103FID number exceeded actual, 103FID number exceeded maximum, 103FID signals, 25FID size, 56FID to model, 79fids button, 58FIDs display, 61FIDs in an array, 13fids3 button, 58file transfer button, 32file transfers button, 15, 59file version number, 76File-Transfers menu, 56filter button, 44, 45filter ringing, 26find button, 34, 41finding peaks, 41Find-Interactive menu, 41first FID, 79First Fid line, 43first point in FID, 17first point on/off button, 50First Point Problem line, 50first time-domain point in data, 26first-order phase correction, 17, 51, 77first-order phase shift, 26first-point model, 50foreground button, 54Fourier transform on arrayed model, 18full quadrature model., 97

GGaussian approximation, 64, 86GETMODEL error message, 104global parameters, 81gtr button, 37

Hhardcopy button, 55HERTZ units, 77homogeneous magnetic field, 27host computer, 23

Iimaginary channel, 25Imaginary Constant line, 50imaginary on/off button, 50information messages, 101initial mode button, 34initial model, 14, 72, 87initial model button, 16initial model in error, 102initialization mode, 63input data, 78input data file, 76input FID file not found, 102input file is an old format, 102input parameter file, 63, 76, 102input procpar file not found, 102

Page 111: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 111

Index

installing the software, 105interactive analysis, 54interactive button, 17, 19, 20, 34, 35, 41, 52, 54,

57, 98

JJ coupling constant, 27joint marginal posterior probability density function,

63joint on/off button, 50joint posterior probability, 65

Llast fid button, 43Last Fid line, 43lb parameter, 25, 44, 45, 46, 65, 71, 81, 98, 100Levenberg-Marquardt algorithm, 28, 63, 64, 85linear phase, 81lines in the spectrum, 98lineshape button, 17, 49lineshape model, 28, 77list button, 34LIST_MODEL error message, 104load button, 56loading files, 56log files, 22, 84log-odds, 65Lorentzian expansion, 27Lorentzian lineshape, 82Lorentzian lineshapes, 25, 26, 82Lorentzian spacing in lineshape expansion, 86lp parameter, 51, 81ls command, 68

Mmain output report, 87mAnalyze button, 20, 24, 57marginal probability density function, 63marginalization, 44, 64, 66marginalizing, 104mark button, 34, 36, 98mark file, 99Mark menu, 36marking a multiplet of a multiplet, 99marking peaks, 14, 36, 41marking resonances, 34, 35, 36marking the center of a multiplet, 38max new resonance button, 17max new resonances button, 49max_freq exceeded, 102maximum likelihood location, 98maximum number of resonances, 80mDisplay button, 15, 32memory allocation failed, 101menu interface, 31messages, 101mode button, 52model button, 18, 52, 55model changing, 24model components, 80, 82, 88

model FID, 72model fid line, 56model file, 22, 66, 74, 83model for a resonance, 27model hierarchy, 92model names, 79model params button, 16, 34model points line, 56model probability, 86model selection calculation, 21, 22, 90modeling program, 13modeling the results, 23More button, 57more button, 20moving a marked peak, 97multiplet identification, 20multiplet names, 40multiplet order, 37multiplets of multiplets model, 28

Nnegative decay rate constants, 102Network Queuing System (NQS), 54Newton-Raphson algorithms, 64nl command, 36No Fids line, 43no signal model, 65noise button, 44, 47, 99Noise line, 47noise on/off button, 47noise regions, 48, 71, 79noise scale factor, 71Noise Start line, 47none button, 52nonlinear least squares, 66non-Lorentzian lineshapes, 17, 51normalized posterior probability, 91normalized probability for the model, 87, 91normalized relative amplitude of multiplet, 27notational conventions, 11notify button, 52np parameter, 56, 79

Oodds ratio, 65OUTMODEL error message, 103output file, 87output file directory, 77output files, 14, 22, 69output model, 77output model FID, 56output modeled FID, 67, 79output report, 21over button, 19, 57over display, 19, 20, 57, 58over2 button, 58, 60overlay of data and model spectra, 19

Pparameter estimates, 90

Page 112: Bayesian Analysis User Guide

Index

112 Bayesian Analysis Software Package 01-999017-00 B0498

parameter estimation calculation, 22parameter files, 22, 74parameter settings, 32, 70parameter units and referencing, 99parameter values, 16, 74Pascal’s Triangle, 27, 40peak picking a power spectrum, 80phase button, 17, 49phase correction on/off button, 51phase cycling, 26, 49phase of resonances, 14, 41, 71PMSG error message, 103PPM units, 77primary J coupling constant, 38, 86primary multiplet order, 27, 37primary ptrn button, 36print button, 57, 58printer output, 55prior odds, 79prior probabilities, 98probabilities file, 21, 24, 55, 68, 91, 92, 93probability theory as logic, 22probe ringing, 26problems in the software, 97Probs button, 55, 68procpar file, 67, 76, 102program errors, 73, 103PUTMODEL error message, 103

QQuad program, 97quartet button, 37queueing jobs, 54

Rread params button, 56READHDR error message, 104real and imaginary constant models, 98real channel, 25Real Constant line, 50real on/off button, 50redundant models, 74reference frequency, 80referencing stored in parameters, 99region button, 47rel phase button, 36relative amplitude of a resonance, 28relative phase button, 41relative phase of sinusoids, 36relaxation parameter, 85remote machine, 54remove all button, 35remove button, 35removing resonances, 35report full button, 55reports button, 18, 55, 57residual element, 18residual spectrum, 19resonance deletion, 35resonance frequencies, 13, 27, 86resonance model, 27, 78, 79resonance phases, 26

restoring the model, 35results button, 15, 16, 18, 32, 33Return key, 11root-mean-square noise value, 44, 67, 71, 78rp parameter, 51, 81running an analysis, 23

Ssampling time, 80save button, 56saving files, 56scale button, 47scale factor, 71SCCETRANS error message, 104SCUETRANS error message, 104search algorithm, 28, 99secondary J coupling constant, 39, 86secondary multiplet order, 27, 40select fid button, 56set fid size button, 56SETGIJ error message, 103SETMODEL error message, 103, 104setting up an analysis, 23setup button, 16, 18, 33, 55setup error messages, 73, 101seventh-order lineshape model, 53shim amplitude, 86shim delta, 82shimming artifact model, 28shimming artifacts, 17, 27shimming delta, 100shimming expansion, 29shimming mode expansion order, 27shimming model, 82, 97, 99shimming order, 72sign conventions, 25signal button, 44signal detection calculation, 13, 14, 17, 22, 45, 64,

65, 79, 80, 81, 84, 88signal model, 65signal region, 44, 46, 102signal-to-noise of data very high, 97, 99singlet model, 21singular matrix error, 73sinusoidal model, 49sinusoids phase, 17slave mode, 13, 14, 63software installation, 105spectra display, 19, 99spectral width, 99spectrometer frequency, 80stacked vertical display, 60standard deviation, 88standard out, 78, 84, 92starting time of FID, 86status button, 15, 23, 32, 70, 72status file, 101status file messages, 73Student-t distribution, 91summary 1 button, 55, 68, 92summary 2 button, 55, 68, 93summary report, 87, 92summary1 report, 21, 55

Page 113: Bayesian Analysis User Guide

01-999017-00 B0498 Bayesian Analysis Software Package 113

Index

summary2 report, 21, 55sw parameter, 99swap space, 102

Ttable of model probabilities, 86table of peaks, 65Taylor expand, 17text window output, 55threshold for finding peaks, 41time-domain amplitude of a resonance, 27time-domain mode, 64Total Points line, 44total points line, 45TRANS error message, 103triplet and quartet model, 21triplet button, 37

Uuncorrelated button, 36, 41, 51uncorrelated phases, 14, 26uncorrelated resonance, 84undo button, 35units in the analysis, 77units stored in parameters, 99UNIX command names, 13unphysical resonances, 98updated parameter files, 22

Vversion of file, 76vert button, 57vertall button, 58vertical button, 20vertical display, 57, 59virtual memory, 101VNMR control of an analysis, 23vnmrsys directory, 23

Wwait state, 52wft command, 19, 98WRITEDATA error message, 104WRITEMODEL error message, 104WRITERESID error message, 104wti menu, 44, 45, 46

Zzero filling, 75zoom into spectra display, 34