Exemple #1
0
		/// <summary>
		/// Plots the cross predicted versus actual Y (concentration) into a provided layer.
		/// </summary>
		/// <param name="table">The table of PLS output data.</param>
		/// <param name="layer">The layer to plot into.</param>
		/// <param name="whichY">The number of the component (y, concentration etc.) for which to plot the residuals.</param>
		/// <param name="numberOfFactors">The number of factors used for calculation of the residuals.</param>
		public static void PlotCrossPredictedVersusActualY(Altaxo.Data.DataTable table, XYPlotLayer layer, int whichY, int numberOfFactors)
		{
			string ypredcolname = WorksheetAnalysis.GetYCrossPredicted_ColumnName(whichY, numberOfFactors);
			string yactcolname = WorksheetAnalysis.GetYOriginal_ColumnName(whichY);
			if (!table.ContainsDataColumn(ypredcolname))
			{
				GetAnalysis(table).CalculateCrossPredictedAndResidual(table, whichY, numberOfFactors, true, false, false);
			}

			PlotOnlyLabel(layer, table, table[yactcolname], table[ypredcolname], table[WorksheetAnalysis.GetMeasurementLabel_ColumnName()]);

			layer.DefaultXAxisTitleString = string.Format("Y original{0}", whichY);
			layer.DefaultYAxisTitleString = string.Format("Y cross predicted{0} (#factors:{1})", whichY, numberOfFactors);
		}
Exemple #2
0
		/// <summary>
		/// Plots all preprocessed spectra into a newly created graph.
		/// </summary>
		/// <param name="table">The table of PLS output data.</param>
		public static void PlotPredictionScores(Altaxo.Data.DataTable table)
		{
			MultivariateContentMemento plsMemo = table.GetTableProperty("Content") as MultivariateContentMemento;
			if (plsMemo == null)
				return;
			if (plsMemo.PreferredNumberOfFactors <= 0)
				QuestPreferredNumberOfFactors(plsMemo);

			GetAnalysis(table).CalculateAndStorePredictionScores(table, plsMemo.PreferredNumberOfFactors);

			AscendingIntegerCollection sel = new AscendingIntegerCollection();

			for (int i = 0; i < plsMemo.NumberOfConcentrationData; i++)
			{
				string name = WorksheetAnalysis.GetPredictionScore_ColumnName(i, plsMemo.PreferredNumberOfFactors);
				if (table.ContainsDataColumn(name))
					sel.Add(table.DataColumns.GetColumnNumber(table[name]));
			}

			string newName = string.Format("GPredScores#{0}F", plsMemo.PreferredNumberOfFactors);
			newName = Main.ProjectFolder.CreateFullName(table.Name, newName);
			Worksheet.Commands.PlotCommands.PlotLine(table, sel, true, false, newName);
		}
Exemple #3
0
		/// <summary>
		/// Plots the x (spectral) residuals into a provided layer.
		/// </summary>
		/// <param name="table">The table of PLS output data.</param>
		/// <param name="layer">The layer to plot into.</param>
		/// <param name="whichY">The number of the component (y, concentration etc.) for which to plot the residuals.</param>
		/// <param name="numberOfFactors">The number of factors used for calculation of the residuals.</param>
		public static void PlotXResiduals(Altaxo.Data.DataTable table, XYPlotLayer layer, int whichY, int numberOfFactors)
		{
			string xresidualcolname = WorksheetAnalysis.GetXResidual_ColumnName(whichY, numberOfFactors);
			string yactcolname = WorksheetAnalysis.GetYOriginal_ColumnName(whichY);

			if (!table.ContainsDataColumn(xresidualcolname))
			{
				GetAnalysis(table).CalculateXResidual(table, whichY, numberOfFactors);
			}

			PlotOnlyLabel(layer, table, table[yactcolname], table[xresidualcolname], table[WorksheetAnalysis.GetMeasurementLabel_ColumnName()]);

			layer.DefaultXAxisTitleString = string.Format("Y original{0}", whichY);
			layer.DefaultYAxisTitleString = string.Format("X residual{0} (#factors:{1})", whichY, numberOfFactors);
		}
Exemple #4
0
		/// <summary>
		/// Plots the x (spectral) leverage into a provided layer.
		/// </summary>
		/// <param name="table">The table of PLS output data.</param>
		/// <param name="layer">The layer to plot into.</param>
		/// <param name="preferredNumberOfFactors">The number of factors used for leverage calculation.</param>
		public static void PlotXLeverage(Altaxo.Data.DataTable table, XYPlotLayer layer, int preferredNumberOfFactors)
		{
			string xcolname = WorksheetAnalysis.GetMeasurementLabel_ColumnName();
			string ycolname = WorksheetAnalysis.GetXLeverage_ColumnName(preferredNumberOfFactors);

			if (!table.ContainsDataColumn(ycolname))
			{
				GetAnalysis(table).CalculateXLeverage(table, preferredNumberOfFactors);
			}

			PlotOnlyLabel(layer, table, table[xcolname], table[ycolname], table[WorksheetAnalysis.GetMeasurementLabel_ColumnName()]);

			layer.DefaultXAxisTitleString = string.Format("Measurement");
			layer.DefaultYAxisTitleString = string.Format("Score leverage (#factors:{0})", preferredNumberOfFactors);
		}