WeibullDataSet.CalculateBestFit: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
| Chris Kahn (talk | contribs) | Kate Racaza (talk | contribs) No edit summary | ||
| Line 1: | Line 1: | ||
| {{Template: | {{Template:API}}{{Template:APIBreadcrumb|.[[WeibullDataSet Class|WeibullDataSet]]}} | ||
| {{Template:WeibullDataSet | |||
| <onlyinclude>Performs goodness of fit tests to find the distribution that best fits the data set. Returns a message box that shows the estimated parameters of the distribution that best fits the data. (Similar to the Distribution Wizard feature in Weibull++). Use the <code>BestFitSettings</code> property of the class to specify the criteria for evaluating the fit. </onlyinclude> | |||
| In addition, the method automatically creates a retrievable [[CModel Class|cModel]] object that represents the fitted model from the life data analysis.   | |||
| == Syntax  == | == Syntax  == | ||
|  '''.CalculateBestFit | |||
| ==  | == Example == | ||
|  '''VBA''' | |||
|  {{APIComment|'Declare a new WeibullDataSet object.}}  | |||
|    {{APIPrefix|Dim}} WDS {{APIPrefix|As New}} WeibullDataSet | |||
|  {{APIComment|'Add failure times to the data set.}} | |||
|    {{APIPrefix|Call}} WDS.AddFailure(100, 1) | |||
|    {{APIPrefix|Call}} WDS.AddFailure(120, 1) | |||
|    {{APIPrefix|Call}} WDS.AddFailure(130, 1)   | |||
|  {{APIComment|'Consider the normal, lognormal and 2-parameter Weibull distributions in the evaluation.}} | |||
|    WDS.BestFitSettings.AllowExponential1 = False | |||
|    WDS.BestFitSettings.AllowExponential2 = False | |||
|    WDS.BestFitSettings.AllowNormal = True | |||
|    WDS.BestFitSettings.AllowLognormal = True | |||
|    WDS.BestFitSettings.AllowWeibull2 = True | |||
|    WDS.BestFitSettings.AllowWeibull3 = False | |||
|    WDS.BestFitSettings.AllowGamma = False | |||
|    WDS.BestFitSettings.AllowGenGamma = False | |||
|    WDS.BestFitSettings.AllowLogistic = False | |||
|    WDS.BestFitSettings.AllowLoglogistic = False | |||
|    WDS.BestFitSettings.AllowGumbel = False | |||
|  {{APIComment|'Perform the goodness of fit tests.}} | |||
|    {{APIPrefix|Call}} WDS.CalculateBestFit() | |||
|  {{APIComment|'Retrieve the fitted life distribution model.}} | |||
|    {{APIPrefix|Dim}} model {{APIPrefix|As}} cModel | |||
|    {{APIPrefix|Set}} model = WDS.FittedModel | |||
|  {{APIComment|'Using the model, calculate the reliability at 100 hrs and display the result.}} | |||
|    {{APIPrefix|Dim}} r {{APIPrefix|As}} Double | |||
|    r = model.reliability(100) | |||
|    MsgBox({{APIString|"Reliability at 100 hrs: "}} & r) | |||
|   {{APIComment|'Declare a new WeibullDataSet object |  '''VB.NET''' | ||
|   {{APIComment|'Declare a new WeibullDataSet object.}}   | |||
|    {{APIPrefix|Dim}} WDS {{APIPrefix|As New}} WeibullDataSet | |||
|   {{APIComment|'Add failure times to the data set.}} |   {{APIComment|'Add failure times to the data set.}} | ||
|    WDS.AddFailure(100, 1) | |||
|    WDS.AddFailure(120, 1) | |||
|    WDS.AddFailure(130, 1)    | |||
|   {{APIComment|' |   {{APIComment|'Consider the normal, lognormal and 2-parameter Weibull distributions in the evaluation.}} | ||
|    WDS.BestFitSettings.AllowExponential1 = False | |||
|    WDS.BestFitSettings.AllowExponential2 = False | |||
|    WDS.BestFitSettings.AllowNormal = True | |||
|    WDS.BestFitSettings.AllowLognormal = True | |||
|    WDS.BestFitSettings.AllowWeibull2 = True | |||
|    WDS.BestFitSettings.AllowWeibull3 = False | |||
|    WDS.BestFitSettings.AllowGamma = False | |||
|    WDS.BestFitSettings.AllowGenGamma = False | |||
|    WDS.BestFitSettings.AllowLogistic = False | |||
|    WDS.BestFitSettings.AllowLoglogistic = False | |||
|    WDS.BestFitSettings.AllowGumbel = False | |||
|   {{APIComment|' |   {{APIComment|'Perform the goodness of fit tests.}} | ||
|    WDS.CalculateBestFit() | |||
|   {{APIComment|'Retrieve the fitted life distribution model |   {{APIComment|'Retrieve the fitted life distribution model.}} | ||
|    {{APIPrefix|Dim}} model {{APIPrefix|As}} cModel | |||
|    model = WDS.FittedModel | |||
|  {{APIComment|'Using the model, calculate the reliability at 100 hrs and display the result.}} | |||
|    {{APIPrefix|Dim}} r {{APIPrefix|As}} Double | |||
|    r = model.reliability(100) | |||
|    MsgBox({{APIString|"Reliability at 100 hrs: "}} & r) | |||
Revision as of 22:38, 30 March 2016
|  | 
Member of:  SynthesisAPI.WeibullDataSet   
Performs goodness of fit tests to find the distribution that best fits the data set. Returns a message box that shows the estimated parameters of the distribution that best fits the data. (Similar to the Distribution Wizard feature in Weibull++). Use the BestFitSettings property of the class to specify the criteria for evaluating the fit. 
In addition, the method automatically creates a retrievable cModel object that represents the fitted model from the life data analysis.
Syntax
.CalculateBestFit
Example
VBA 'Declare a new WeibullDataSet object. Dim WDS As New WeibullDataSet 'Add failure times to the data set. Call WDS.AddFailure(100, 1) Call WDS.AddFailure(120, 1) Call WDS.AddFailure(130, 1) 'Consider the normal, lognormal and 2-parameter Weibull distributions in the evaluation. WDS.BestFitSettings.AllowExponential1 = False WDS.BestFitSettings.AllowExponential2 = False WDS.BestFitSettings.AllowNormal = True WDS.BestFitSettings.AllowLognormal = True WDS.BestFitSettings.AllowWeibull2 = True WDS.BestFitSettings.AllowWeibull3 = False WDS.BestFitSettings.AllowGamma = False WDS.BestFitSettings.AllowGenGamma = False WDS.BestFitSettings.AllowLogistic = False WDS.BestFitSettings.AllowLoglogistic = False WDS.BestFitSettings.AllowGumbel = False 'Perform the goodness of fit tests. Call WDS.CalculateBestFit() 'Retrieve the fitted life distribution model. Dim model As cModel Set model = WDS.FittedModel 'Using the model, calculate the reliability at 100 hrs and display the result. Dim r As Double r = model.reliability(100) MsgBox("Reliability at 100 hrs: " & r)
VB.NET 'Declare a new WeibullDataSet object. Dim WDS As New WeibullDataSet 'Add failure times to the data set. WDS.AddFailure(100, 1) WDS.AddFailure(120, 1) WDS.AddFailure(130, 1) 'Consider the normal, lognormal and 2-parameter Weibull distributions in the evaluation. WDS.BestFitSettings.AllowExponential1 = False WDS.BestFitSettings.AllowExponential2 = False WDS.BestFitSettings.AllowNormal = True WDS.BestFitSettings.AllowLognormal = True WDS.BestFitSettings.AllowWeibull2 = True WDS.BestFitSettings.AllowWeibull3 = False WDS.BestFitSettings.AllowGamma = False WDS.BestFitSettings.AllowGenGamma = False WDS.BestFitSettings.AllowLogistic = False WDS.BestFitSettings.AllowLoglogistic = False WDS.BestFitSettings.AllowGumbel = False 'Perform the goodness of fit tests. WDS.CalculateBestFit() 'Retrieve the fitted life distribution model. Dim model As cModel model = WDS.FittedModel 'Using the model, calculate the reliability at 100 hrs and display the result. Dim r As Double r = model.reliability(100) MsgBox("Reliability at 100 hrs: " & r)