WeibullDataSet.CalculateBestFit: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(28 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:APIClass|WeibullDataSet Class|WeibullDataSet}}
{{Template:API}}{{Template:APIBreadcrumb|.[[WeibullDataSet Class|WeibullDataSet]]}}


Runs the calculation and finds a distribution model that best fits the data in the WeibullDataSet.


== Method Syntax==
<onlyinclude>Determines which of the selected life distributions best fits the data set (similar to the Distribution Wizard feature in Weibull++) and creates a [[CModel Class|cModel]] object that represents the fitted model of the recommended distribution.</onlyinclude>
{{APIName|CalculateBestFit()}}


{{APIComment|Finds the distribution that fits the data best. Sets Fitted Model property if successful. Clears it (sets to Nothing) in case of an error.}}


== Usage Example ==
'''Remarks''': To specify the distributions, parameter estimation method and other criteria for evaluating the fit, use the <code>BestFitSettings</code> property of the object. To return the <code>cModel</code> object that is produced, use the <code>FittedModel</code> property of the object.


{{APIComment|Declare the WeibullDataSet. See [[New WeibullDataSet]] for additional details.}}
== Syntax  ==
        Dim WDS as New WeibullDataSet
'''.CalculateBestFit


{{APIComment|Add values to the raw data. See [[WeibullDataSet.AddFailure]] for additional details.}}
== Example ==
        WDS.AddFailure(1, 1)
'''VBA'''
        WDS.AddFailure(2, 1)
        WDS.AddFailure(3, 1)
{{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|'Use the MLE parameter estimation method.}}
  WDS.BestFitSettings.Analysis = WeibullSolverMethod_MLE
{{APIComment|'Determine which distribution best fits the data set, based on the MLE method.}}
  {{APIPrefix|Call}} WDS.CalculateBestFit()
 
{{APIComment|'Calculate the reliability at 100 hrs and display the result.}}
  {{APIPrefix|Dim}} r {{APIPrefix|As}} Double
  r = WDS.FittedModel.Reliability(100)
  MsgBox({{APIString|"Reliability at 100 hrs: "}} & r)


{{APIComment|Calculate the Fitted Model using the raw data.}}
'''VB.NET'''
        WDS.CalculateBestFit
 
{{APIComment|'Declare a new WeibullDataSet object.}}
{{APIComment|Use the Fitted Model using the raw data.}}
  {{APIPrefix|Dim}} WDS {{APIPrefix|As New}} WeibullDataSet
        Dim WDSFittedModel as cModel
        WDSFittedModel = WDS.FittedModel
{{APIComment|'Add failure times to the data set.}}
  WDS.AddFailure(100, 1)
  WDS.AddFailure(120, 1)
  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|'Use the MLE parameter estimation method.}}
  WDS.BestFitSettings.Analysis = WeibullSolverMethod.MLE
 
{{APIComment|'Determine which distribution best fits the data set, based on the MLE method.}}
  WDS.CalculateBestFit()
 
{{APIComment|'Calculate the reliability at 100 hrs and display the result.}}
  {{APIPrefix|Dim}} r {{APIPrefix|As}} Double
  r = WDS.FittedModel.Reliability(100)
  MsgBox({{APIString|"Reliability at 100 hrs: "}} & r)

Latest revision as of 16:07, 17 August 2016

APIWiki.png


Member of: SynthesisAPI.WeibullDataSet


Determines which of the selected life distributions best fits the data set (similar to the Distribution Wizard feature in Weibull++) and creates a cModel object that represents the fitted model of the recommended distribution.


Remarks: To specify the distributions, parameter estimation method and other criteria for evaluating the fit, use the BestFitSettings property of the object. To return the cModel object that is produced, use the FittedModel property of the object.

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
 
 'Use the MLE parameter estimation method. 
  WDS.BestFitSettings.Analysis = WeibullSolverMethod_MLE

 'Determine which distribution best fits the data set, based on the MLE method. 
  Call WDS.CalculateBestFit()
  
 'Calculate the reliability at 100 hrs and display the result. 
  Dim r As Double
  r = WDS.FittedModel.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

 'Use the MLE parameter estimation method. 
  WDS.BestFitSettings.Analysis = WeibullSolverMethod.MLE
 
 'Determine which distribution best fits the data set, based on the MLE method. 
  WDS.CalculateBestFit()
  
 'Calculate the reliability at 100 hrs and display the result. 
  Dim r As Double
  r = WDS.FittedModel.Reliability(100)
  MsgBox("Reliability at 100 hrs: " & r)