<?xml version="1.0"?>
<OriginStorage Label="" Display="652"><XFname NodeID="11" Label="Name" DataID="300">weibullfit</XFname><xFdescription NodeID="11" Label="Description" DataID="310">&amp;Weibull Fit:Perform a Weibull fit on survival data</xFdescription><attachTo NodeID="13" Label="Attach to Origin Object" Combo="None|Auto|Column|Sheet/Layer|Book/Graph" DataID="320" Show="0">1</attachTo><author NodeID="11" Label="Author" DataID="314"/><AutoDependent NodeID="10" Label="Auto Compile Dependent Files" DataID="451">1</AutoDependent><UsageCtxt NodeID="268435456" Label="Usage Context" DataID="329"><LabTalk NodeID="10" Label="Labtalk" DataID="357">1</LabTalk><WksSel NodeID="10" Label="Worksheet Selection" DataID="350">0.</WksSel><GrObj NodeID="268435456" Label="Graphic Object Events" DataID="330" Use="0"><InitAnchors NodeID="10" Label="Initialization" DataID="339">1.</InitAnchors><Move NodeID="10" Label="Move" DataID="331">1.</Move><Moving NodeID="10" Label="Moving" DataID="332">0.</Moving><Resize NodeID="10" Label="Resize" DataID="333">0.</Resize><Resizing NodeID="10" Label="Resizing" DataID="334">0.</Resizing><Delete NodeID="10" Label="Delete" DataID="335">0.</Delete><Select NodeID="10" Label="Select" DataID="336">0.</Select><Unselect NodeID="10" Label="Unselect" DataID="337">0.</Unselect><BtnClick NodeID="10" Label="Button Click" DataID="338">0.</BtnClick><Rotate NodeID="10" Label="Rotate" DataID="340">0.</Rotate><Rotating NodeID="10" Label="Rotating" DataID="341">0.</Rotating><Skew NodeID="10" Label="Skew" DataID="342">0.</Skew><Skewing NodeID="10" Label="Skewing" DataID="343">0.</Skewing><EditEv NodeID="10" Label="Edit" DataID="344">0.</EditEv><Editing NodeID="10" Label="Editing" DataID="345">0.</Editing><NewSelection NodeID="10" Label="New Selection" DataID="346">0.</NewSelection><DeletePart NodeID="10" Label="Delete Part" DataID="347">0.</DeletePart><Keyboard NodeID="10" Label="Keyboard" DataID="348">0.</Keyboard><ObjType NodeID="13" Label="Type" Combo="Rect|Line" DataID="349">0.</ObjType></GrObj><Theme NodeID="268435456" Label="Theme" DataID="386"><UseInDialog NodeID="10" Label="Support Saving Themes in Dialog" DataID="372">1.</UseInDialog><ShowInMenu NodeID="10" Label="Show Themes as Popups in Menu" DataID="352">1</ShowInMenu><SaveInBook NodeID="10" Label="Support Saving to Book" DataID="387">0.</SaveInBook><SaveInSheet NodeID="10" Label="Support Saving to Sheet" DataID="388">0.</SaveInSheet></Theme><mainmenu NodeID="268435456" Label="Menus" DataID="365" Use="1" BranchCombo="None|Main Menus|Context Menus|Both|Context Menus 1|Context Menus 2|Context Menus 3|Context Menus 4"><AddAsTool NodeID="10" Label="Add As Tool" DataID="366">0.</AddAsTool><ClassOp NodeID="10" Label="Class Operation" DataID="367">0.</ClassOp><GetN NodeID="13" Label="Auto GetN Dialog" Combo="None|Simple GetNBox|GetNGraphBox with Preview|GetNImageBox|Wizard" DataID="371">1</GetN><DlgFromMenu NodeID="10" Label="Open Dialog from Menu for Option Index" DataID="374">1.</DlgFromMenu><checkMenu NodeID="10" Label="Check Menu" DataID="470">0.</checkMenu></mainmenu><windows NodeID="268435456" Label="Windows" DataID="450" Use="1"><graph NodeID="10" Label="Graph" DataID="368">0.</graph><worksheet NodeID="10" Label="Worksheet" DataID="369">1</worksheet><matrix NodeID="10" Label="Matrix" DataID="370">0.</matrix><matrix NodeID="10" Label="Report" DataID="360">0.</matrix></windows></UsageCtxt><outTree NodeID="10" Label="Generate LabTalk Tree upon execution" DataID="373">0</outTree><askOutResultsLog NodeID="10" Label="Add Checkbox to Auto GetN Dialog about Results Log Output" DataID="393">1</askOutResultsLog><outResultsLog NodeID="13" Label="Output to Results Log upon execution" Combo="None|All|Report Tree|First Input|First Output|All Outputs|All Except Trees" DataID="394">2</outResultsLog><customButtons NodeID="11" Label="GetN Dialog Custom Buttons" DataID="391"></customButtons><syntax NodeID="41" Label="Command Line Usage" DataID="305" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="2-18">1. weibullfit irng:=(1,2) censor:=0 
2. weibullfit irng:=(1,2) censor:=0 conf:=99 rt:=&lt;new name:= Weibull&gt;</syntax><vars NodeID="268435456" Label="Variables" Branch="1"><v1 _XFUNCTION_VAR="1" RepeatID="1"><name NodeID="11" Label="Name" DataID="10">irng</name><description NodeID="11" Label="Label" DataID="20" Show="0"></description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase" DataID="40">Range</type><valdata NodeID="57" Label="Data" DataID="50"></valdata><comboString NodeID="11" Label="Control" DataID="70">Time Range|Censor Range</comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">I:0x00000010</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">Specify input data range, including time data range and censor data range.
Time data range
 Specify time data column
Censor data range
 Specify censor data column</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">The input data range</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">入力データ範囲を指定します。これには、時間データ範囲と打ち切りデータ範囲が含まれます。
時間データ範囲
 時間データ列を指定します。
打ち切りデータ範囲
 打ち切りデータ列を指定します。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">入力するデータの範囲</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Festlegen von Eingabedatenbereich, einschließlich Zeitdatenbereich und Zensordatenbereich.
Zeitdatenbereich
 Festlegen der Zeitdatenspalte
Zensordatenbereich
 Festlegen der Zensordatenspalte</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Der Datenbereich der Eingabe</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v1><v2 _XFUNCTION_VAR="1" RepeatID="2"><name NodeID="11" Label="Name" DataID="10">censor</name><description NodeID="11" Label="Label" DataID="20" Show="0">Censoring Value(s)</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase" DataID="40">vector</type><valdata NodeID="35" Label="Data" DataID="50" _DROP_DOWN_BUTTON_ID="2112|1"></valdata><comboString NodeID="11" Label="Control" DataID="70">|0|1|2</comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">T:1</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Censoring Value(s)</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8"><![CDATA[Specify the censored value. ]]></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Censored value</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932">打ち切り値</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932"><![CDATA[打ち切り値を指定します。 ]]></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">打ち切り値</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Zensierungswert(e)</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252"><![CDATA[Festlegen des zensierten Werts ]]></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Zensierter Wert</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v2><v3 _XFUNCTION_VAR="1" RepeatID="3"><name NodeID="11" Label="Name" DataID="10">conf</name><description NodeID="11" Label="Label" DataID="20" Show="0">Confidence Level(%) for Parameters</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase" DataID="40">double</type><valdata NodeID="13" Label="Data" DataID="50" Combo="" Enable="1">95</valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69"></optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Confidence Level(%) for Parameters</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">Text box to enter a confidence level to be used when computing errors for the survival function and upper and lower limits of the quartile estimates.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Confidence level</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932">パラメータに対する信頼水準(%)</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">生存関数に対する計算誤差および四分位数の上側および下側限界を推定するときに使用される信頼水準を入力するテキストボックス</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">信頼水準</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Konfidenzniveau (%) für Parameter</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Textfeld zur Eingabe eines Konfidenzniveaus, das zur Berechung des Fehlers der Überlebensfunktion und für die oberen und unteren Grenzen der Quartilschätzer benutzt werden soll.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Konfidenzlevel</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v3><v4 _XFUNCTION_VAR="1" RepeatID="4"><name NodeID="11" Label="Name" DataID="10">rt</name><description NodeID="11" Label="Label" DataID="20" Show="0">Output Results</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">1</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase" DataID="40">ReportTree</type><valdata NodeID="81" Label="Data" DataID="50" _DROP_DOWN_BUTTON_ID="2112|0">[&lt;input&gt;]&lt;new&gt;</valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">N:sheet:=WeibullFit1;P:0;O:A</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Output Results</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">Specify the report worksheet destination</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Report worksheet</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932">結果の出力</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">レポートワークシートの出力先を指定します。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">レポートワークシート</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Ergebnisausgabe</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Bestimmen des Ziels des Berichtsdatenblatts</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Berichtsdatenblatt</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v4></vars><modificationLog NodeID="41" Label="Modification Log" DataID="438" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="2-15">6/01/07 Fay. Edit the document. 
7/11/07. Larry. Review document, change some format.
7/30/07. Fay. Review document and complement some details.
8/15/07. Fay. Review and modify.</modificationLog><codes NodeID="268435456" Label="Code" DataID="324"><rettype NodeID="11" Label="Return Type" Combo="void|int|double|string|vector" DataID="41">void</rettype><header NodeID="45" Label="Header" DataID="323" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="3-15"><![CDATA[

//put additional include files here
#include <ocStats.h>
#include <stats_utils.h>
#include <ReportTree.h>
#include <GetNBox.h>
#include <report_utils.h>
#include <event_utils.h>
#include <control.h>
#include <o8dlg.h>
//put your own support static functions here

#define IDST_SA_ANASTATS  0x00000010
#define	IDE_WBL_PLOT	0x11100010		

/*
static void get_summary_stats(SASummary psSASummary, vector &vStats)
{
	vStats.SetSize(4);
	vStats[0] = psSASummary.Total;
	vStats[1] = psSASummary.Events;
	vStats[2] = psSASummary.NumCen;
	vStats[3] = round(psSASummary.PerCen,4);

}
*/

static void get_analysis_stats(SAParaEstim *psSAParaEstim, int ii, vector &vStats)
{
	vStats.SetSize(5);
	vStats[0] = (psSAParaEstim[ii].DOF == 0) ? NANUM : psSAParaEstim[ii].DOF;
	vStats[1] = round(psSAParaEstim[ii].ParaEst,4);
	vStats[2] = round(psSAParaEstim[ii].SE,4);
	vStats[3] = round(psSAParaEstim[ii].LCL,4);
	vStats[4] = round(psSAParaEstim[ii].UCL,4);

}

static void	wb_update_report_tree(ReportTree& outRT, double dCriterion, SAParaEstim *psSAParaEstim, double dConfLev, int nErr)
{
	
		
	int ii;
	
	//////////////////////////////////////////////////////////////////
	// Analysis Statistics
	//////////////////////////////////////////////////////////////////
    
	ReportTable rtAnalysis = outRT.CreateTable("Analysis", _L("Analysis of parameter estimates"), IDST_SA_ANASTATS);
	
	vector<string> vstrParamColLabels(5);
	string strConf = ftoa(dConfLev);
	
	//vstrParamColLabels[0] = _L("Parameter");
	vstrParamColLabels[0] = _L("DF");
	vstrParamColLabels[1] = _L("Estimate");
	vstrParamColLabels[2] = _L("Standard Error");
	vstrParamColLabels[3] = strConf + "% LCL";
	vstrParamColLabels[4] = strConf + "% UCL";

	vector<string> vstrParamRowLabels(4);
	vstrParamRowLabels[0] = _L("Intercept");
	vstrParamRowLabels[1] = _L("Scale");
	vstrParamRowLabels[2] = _L("Weibull Scale");
	vstrParamRowLabels[3] = _L("Weibull Shape");
	
	vector vANAStats;
	
	vector<string> vstrColTagName, vstrRowTagName;
	string strColTagName = WEIBULL_PARAM_ESTIM;
	strColTagName.GetTokens(vstrColTagName, '|');
	string strRowTagName =  WEIBULL_PARAMS;
	strRowTagName.GetTokens(vstrRowTagName, '|');
	
	for(ii = 0; ii < 4; ii++)
	{
	    get_analysis_stats(psSAParaEstim, ii, vANAStats);
	    rtAnalysis.AddRow(vstrRowTagName[ii], vANAStats, vstrParamRowLabels[ii], vstrParamColLabels, vstrColTagName, make_one_set_ID(IDST_SA_ANASTATS, ii));		
		///Sophy 3/30/2009 QA80-13352 SUPPORT_SPECIFY_COLUMN_DESIGNATIONS_IN_REPORT_TABLES
		TreeNode trRow = rtAnalysis.GetNode(vstrRowTagName[ii]);
		if ( trRow )
		{
			tree_set_attribute_to_all_nodes(trRow, STR_COL_DESIGNATION_ATTRIB, (string)OKDATAOBJ_DESIGNATION_Y);
			if ( trRow.SE )
				trRow.SE.SetAttribute(STR_COL_DESIGNATION_ATTRIB, OKDATAOBJ_DESIGNATION_ERROR);
		}
		///end SUPPORT_SPECIFY_COLUMN_DESIGNATIONS_IN_REPORT_TABLES
	}
	
	string strFootNote2;
	string strErr;
	if (nErr == 2051 || nErr == 2004)
		strErr = _L("Fit did not converage");
	if (nErr == 2049)
		strErr = _L("Unable to calculate initial values");
	if (nErr == 2053)
		strErr = _L("All observations are censored, there are no exact observations");

	strFootNote2 = (nErr == STATS_NO_ERROR) ? _L("\\+(1)Log-Likelihood=") + ftoa(dCriterion) : strErr;
	TreeNode trFooter2 = tree_check_get_node(rtAnalysis, "Footer", IDE_FOOTNOTE_BEGIN, TREE_Footnote, "1"); // just need the TREE_Footnote attribute, value does not matter, so 1 is good
	trFooter2.strVal = strFootNote2;
}

static int wblfit_check_input(TreeNode& trGetN)
{
	int nErr = sa_check_data(trGetN.irng, SA_NONE);
	if (nErr == CER_NO_ERROR)
		nErr = check_valid_censoring(trGetN);
	
	if (!check_conf_level(trGetN.conf) && CER_NO_ERROR == nErr)
	{
		nErr = CER_INVALID_CONF_LEV;		
	}
	
	return nErr;
}
]]></header><code NodeID="45" Label="Expression" DataID="325" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="5-20"><![CDATA[
int nRet = sa_check_data(irng, SA_NONE);
if (CER_NO_ERROR != nRet)
	XF_THROW(nRet);

 int nMissing = 0;
 SASummary psSASummary;	
 SAParaEstim psSAParaEstim[4];	 
 double dCriterion;
 int  nSizeParaEstim=4;

 vector vTime, vCensor;
 irng.GetData(vTime, 0);
 irng.GetData(vCensor, 1);
 		
 nRet = trim_nanum_sa(&nMissing, vTime, vCensor, NULL, NULL, true);
 if(nRet != OE_NOERROR)
      XF_THROW_EX(CER_UNKNOWN_ERROR_EX, nRet);
 
 int nTime=vTime.GetSize();
 int nCensor=vCensor.GetSize();
 int nCensored=censor.GetSize();
 
double dConfLevel = conf / 100;	  
 nRet = ocmath_surviv_weibull_simple(vTime,
	                                 nTime,
							         vCensor,
						             nCensor, 
							         censor, 
							         nCensored, 
							         dConfLevel,
							         &dCriterion,
							         &psSASummary,
							         psSAParaEstim,
							         nSizeParaEstim);
							     
 if(nRet != OE_NOERROR && nRet != 2051 && nRet != 2049 && nRet != 2053 && nRet != 2004)
 	XF_THROW_EX(CER_UNKNOWN_ERROR_EX, nRet);
 
 //construct the report tree
 LPCSTR lpsczLabel = _L("WeiBull");
 report_tree_create(rt, lpsczLabel, "irng");
 rt_add_sa_summary(rt, psSASummary, censor);
     
 wb_update_report_tree(rt, dCriterion, psSAParaEstim, conf, nRet);
 
 ]]></code><event1 NodeID="45" Label="Event1" DataID="327" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="5-20" Show="0"><![CDATA[
TreeNode trRange = trGetN.irng;
TreeNode trCensor = trGetN.censor;
if (trRange && trCensor)
	set_censor_list(trRange, trCensor);
		
int nErr = wblfit_check_input(trGetN);	
if (CER_NO_ERROR != nErr)
{
	bOKEnable = false;
	strErrMsg = nErr;
}

return true;
]]></event1><event2 NodeID="45" Label="Event2" DataID="376" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="5-20" Show="0"><![CDATA[
return false;
]]></event2><event3 NodeID="45" Label="Event3" DataID="378" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="5-20" Show="0"><![CDATA[
//------ fisher 11/16/07 ADD_MAP_ID_TO_CHM
if(is_use_origin_chm())
	trGetN.SetAttribute(STR_HELPID_ATTRIB, IDD_XF_weibullfit);

if ( (dwCntrl&LTXF_THEME_USED) && nGetNDialog <= 0 )
{
	if ( CER_NO_ERROR != wblfit_check_input(trGetN) )
		nRet = XFEVT_PROCEED_WITH_DLG;
}
]]></event3><GetNEvent NodeID="47" Label="GetNBox Event" DataID="379" Show="0" TypeID="65543" BlobArrElementaryType="8" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">AA==</GetNEvent></codes><SaveInOpj NodeID="10" Label="Save with Object" DataID="560">0.</SaveInOpj><optargindex NodeID="14" Label="Option Argument Index" DataID="72">0.</optargindex><version NodeID="14" Label="Version" DataID="73">1</version><category NodeID="11" Label="Primary Category" DataID="74" Show="0">Statistics\Survival Analysis</category><subcategory NodeID="11" Label="Primary Subcategory" DataID="77" Show="0"></subcategory><seccategory1 NodeID="11" Label="Secondary Category" DataID="75" Show="0"></seccategory1><secsubcategory1 NodeID="11" Label="Secondary Subcategory 1" DataID="78" Show="0"></secsubcategory1><seccategory2 NodeID="11" Label="Secondary Category 2" DataID="76" Show="0"></seccategory2><secsubcategory2 NodeID="11" Label="Secondary Subcategory 2" DataID="79" Show="0"></secsubcategory2><module NodeID="11" Label="Module" DataID="80">Pro</module><subGroup NodeID="17" Label="Subgroup Index Within a Category" Combo="-10|-9|-8|-7|-6|-5|-4|-3|-2|-1|0|1|2|3|4|5|6|7|8|9" DataID="82">0.</subGroup><errmsgCount NodeID="14" Label="Number of Error Messages" DataID="412">0</errmsgCount><helpe NodeID="268435456" Label="English Help" DataID="420" RepeatID="256"><info NodeID="41" Label="Auto Complete Hint" DataID="422" RowHeightRange="2-8">Weibull Fit: Perform a Weibull fit</info><summary NodeID="47" Label="Summary" TypeID="65537" DataID="421" Show="0"><![CDATA[]]></summary><example NodeID="47" Label="Examples" TypeID="65537" DataID="431" Show="0"><![CDATA[]]></example><ref NodeID="47" Label="References" TypeID="65537" DataID="432" Show="0"><![CDATA[]]></ref><algorithm NodeID="47" Label="Algorithm" TypeID="65537" DataID="434" Show="0"><![CDATA[]]></algorithm><parameters NodeID="47" Label="Parameters" TypeID="65537" DataID="444" Show="0"><![CDATA[]]></parameters><script NodeID="41" Label="LabTalk Script Example" Show="0" DataID="436" RowHeightRange="2-12"></script><errmsgs NodeID="47" Label="Error Messages" DataID="413" Show="0"></errmsgs></helpe><helpj NodeID="268435456" Label="Japanese Help" DataID="420" RepeatID="512"><description NodeID="11" Label="Description" DataID="440" CdPg="932">Weibullフィット:生存データ上でWeibullフィットを実行する</description><customButtons NodeID="11" Label="GetN Dialog Custom Buttons" DataID="448" CdPg="932"></customButtons><info NodeID="41" Label="Auto Complete Hint" DataID="422" RowHeightRange="2-8" CdPg="932">Weibull????: Weibull???????????</info><summary NodeID="47" Label="Summary" TypeID="65537" DataID="421" Show="0" CdPg="932"><![CDATA[]]></summary><example NodeID="47" Label="Examples" TypeID="65537" DataID="431" Show="0" CdPg="932"><![CDATA[]]></example><ref NodeID="47" Label="References" TypeID="65537" DataID="432" Show="0" CdPg="932"><![CDATA[]]></ref><algorithm NodeID="47" Label="Algorithm" TypeID="65537" DataID="434" Show="0" CdPg="932"><![CDATA[]]></algorithm><parameters NodeID="47" Label="Parameters" TypeID="65537" DataID="444" Show="0" CdPg="932"><![CDATA[]]></parameters><script NodeID="41" Label="LabTalk Script Example" Show="0" DataID="436" RowHeightRange="2-12" CdPg="932"></script><errmsgs NodeID="47" Label="Error Messages" DataID="413" Show="0" CdPg="932"></errmsgs></helpj><helpg NodeID="268435456" Label="German Help" DataID="420" RepeatID="768"><description NodeID="11" Label="Description" DataID="440" CdPg="1252">Weibull-Fit:Ausführen eines Weibull-Fits auf Lebensdauerdaten</description><customButtons NodeID="11" Label="GetN Dialog Custom Buttons" DataID="448" CdPg="1252"></customButtons><info NodeID="41" Label="Auto Complete Hint" DataID="422" RowHeightRange="2-8" CdPg="1252">Weibull-Fit: Ausführen eines Weibull-Fits</info><summary NodeID="47" Label="Summary" TypeID="65537" DataID="421" Show="0" CdPg="1252"><![CDATA[]]></summary><example NodeID="47" Label="Examples" TypeID="65537" DataID="431" Show="0" CdPg="1252"><![CDATA[]]></example><ref NodeID="47" Label="References" TypeID="65537" DataID="432" Show="0" CdPg="1252"><![CDATA[]]></ref><algorithm NodeID="47" Label="Algorithm" TypeID="65537" DataID="434" Show="0" CdPg="1252"><![CDATA[]]></algorithm><parameters NodeID="47" Label="Parameters" TypeID="65537" DataID="444" Show="0" CdPg="1252"><![CDATA[]]></parameters><script NodeID="41" Label="LabTalk Script Example" Show="0" DataID="436" RowHeightRange="2-12" CdPg="1252"></script><errmsgs NodeID="47" Label="Error Messages" DataID="413" Show="0" CdPg="1252"></errmsgs></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="420" RepeatID="1024"><description NodeID="11" Label="Description" DataID="440" CdPg="936"></description><customButtons NodeID="11" Label="GetN Dialog Custom Buttons" DataID="448" CdPg="936"></customButtons><info NodeID="41" Label="Auto Complete Hint" DataID="422" RowHeightRange="2-8" CdPg="936"></info><summary NodeID="47" Label="Summary" TypeID="65537" DataID="421" Show="0" CdPg="936"><![CDATA[]]></summary><example NodeID="47" Label="Examples" TypeID="65537" DataID="431" Show="0" CdPg="936"><![CDATA[]]></example><ref NodeID="47" Label="References" TypeID="65537" DataID="432" Show="0" CdPg="936"><![CDATA[]]></ref><algorithm NodeID="47" Label="Algorithm" TypeID="65537" DataID="434" Show="0" CdPg="936"><![CDATA[]]></algorithm><parameters NodeID="47" Label="Parameters" TypeID="65537" DataID="444" Show="0" CdPg="936"><![CDATA[]]></parameters><script NodeID="41" Label="LabTalk Script Example" Show="0" DataID="436" RowHeightRange="2-12" CdPg="936"></script><errmsgs NodeID="47" Label="Error Messages" DataID="413" Show="0" CdPg="936"></errmsgs></helpc><SkipHiddenInDlg NodeID="10" Label="Skip hidden in dialog" DataID="295">0.</SkipHiddenInDlg><ClearMsg NodeID="10" Label="Auto Clear Error Message in dialog" DataID="296">1.</ClearMsg><KeepBtnStatus NodeID="10" Label="Keep Button Status for Event Handler" DataID="298">0.</KeepBtnStatus><SptApplyUndoButtonSts NodeID="10" Label="Control Apply and Undo button by User" DataID="294">0.</SptApplyUndoButtonSts><PreviewButton NodeID="10" Label="Show Preview Button" DataID="299">0.</PreviewButton><AutoApplyChkbox NodeID="10" Label="Show Auto Apply CheckBox" DataID="290">1.</AutoApplyChkbox><SkipHelpDoc NodeID="10" Label="Skip Help Document Processing" DataID="297">0.</SkipHelpDoc><seeAlso NodeID="11" Label="See Also" DataID="430"></seeAlso><relatedXF NodeID="11" Label="Related X-Functions" DataID="442">kaplanmeier, phm_Cox</relatedXF></OriginStorage>
