def computeDetectionSize(self, probabilityLevel, confidenceLevel=None): defectMin = self._defects.getMin()[0] defectMax = self._defects.getMax()[0] # compute 'a90' model = self._buildModel(1. - probabilityLevel) try: detectionSize = ot.NumericalPointWithDescription(1, ot.Brent().solve( model, self._detectionBoxCox, defectMin, defectMax)) except: raise Exception('The POD model does not contain, for the given ' + \ 'defect interval, the wanted probability level.') description = ['a'+str(int(probabilityLevel*100))] # compute 'a90_95' if confidenceLevel is not None: modelCl = self.getPODCLModel(confidenceLevel) if not (modelCl([defectMin])[0] <= probabilityLevel <= modelCl([defectMax])[0]): raise Exception('The POD model at the confidence level does not '+\ 'contain, for the given defect interval, the '+\ 'wanted probability level.') detectionSize.add(ot.Brent().solve(modelCl, probabilityLevel, defectMin, defectMax)) description.append('a'+str(int(probabilityLevel*100))+'/'\ +str(int(confidenceLevel*100))) # add description to the NumericalPoint detectionSize.setDescription(description) return detectionSize
def _computeDetectionSize(self, model, modelCl=None, probabilityLevel=None, confidenceLevel=None, defectMin=None, defectMax=None): """ Compute the detection size for a given probability level. Parameters ---------- probabilityLevel : float The probability level for which the defect size is computed. confidenceLevel : float The confidence level associated to the given probability level the defect size is computed. Default is None. Returns ------- result : collection of :py:class:`openturns.NumericalPointWithDescription` A NumericalPointWithDescription containing the detection size computed at the given probability level and confidence level if provided. """ if defectMin is None: defectMin = self._inputSample.getMin()[0] if defectMax is None: defectMax = self._inputSample.getMax()[0] # compute 'a90' if not (model([defectMin])[0] <= probabilityLevel <= model([defectMax ])[0]): raise Exception('The POD model does not contain, for the given ' + \ 'defect interval, the wanted probability level.') detectionSize = ot.NumericalPointWithDescription( 1, ot.Brent().solve(model, probabilityLevel, defectMin, defectMax)) description = ['a' + str(int(probabilityLevel * 100))] # compute 'a90_95' if confidenceLevel is not None: if not (modelCl([defectMin])[0] <= probabilityLevel <= modelCl( [defectMax])[0]): raise Exception('The POD model at the confidence level does not '+\ 'contain, for the given defect interval, the '+\ 'wanted probability level.') detectionSize.add(ot.Brent().solve(modelCl, probabilityLevel, defectMin, defectMax)) description.append('a'+str(int(probabilityLevel*100))+'/'\ +str(int(confidenceLevel*100))) # add description to the NumericalPoint detectionSize.setDescription(description) return detectionSize
def getStandardError(self): """ Accessor to the standard error of the estimate. Returns ------- stderr : :py:class:`openturns.NumericalPoint` The standard error of the estimate for the uncensored and censored (if so) linear regression model. """ if self._censored: stderr = ot.NumericalPointWithDescription([ ('Stderr for uncensored case', self._resultsUnc.stderr), ('Stderr for censored case', self._resultsCens.stderr) ]) else: stderr = ot.NumericalPointWithDescription([ ('Stderr for uncensored case', self._resultsUnc.stderr) ]) return stderr
def getSlope(self): """ Accessor to the slope of the linear regression model. Returns ------- slope : :py:class:`openturns.NumericalPoint` The slope parameter for the uncensored and censored (if so) linear regression model. """ if self._censored: slope = ot.NumericalPointWithDescription([ ('Slope for uncensored case', self._resultsUnc.slope), ('Slope for censored case', self._resultsCens.slope) ]) else: slope = ot.NumericalPointWithDescription([ ('Slope for uncensored case', self._resultsUnc.slope) ]) return slope
def getIntercept(self): """ Accessor to the intercept of the linear regression model. Returns ------- intercept : :py:class:`openturns.NumericalPoint` The intercept parameter for the uncensored and censored (if so) linear regression model. """ if self._censored: intercept = ot.NumericalPointWithDescription([ ('Intercept for uncensored case', self._resultsUnc.intercept), ('Intercept for censored case', self._resultsCens.intercept) ]) else: intercept = ot.NumericalPointWithDescription([ ('Intercept for uncensored case', self._resultsUnc.intercept) ]) return intercept
def _getResultValue(self, test, description): """ Generalized accessor method for the R2 or p-values. Parameters ---------- test : string name of the keys for the dictionnary. description : string name the test to be displayed. """ if self._censored: pValue = ot.NumericalPointWithDescription([ (description + ' for uncensored case', self._resultsUnc.testResults[test]), (description + ' for censored case', self._resultsCens.testResults[test]) ]) else: pValue = ot.NumericalPointWithDescription([ (description + ' for uncensored case', self._resultsUnc.testResults[test]) ]) return pValue
p2[1] = 200. s1[0] = p2 p3 = ot.NumericalPoint(2, 0.) p3.setName("Two") p3[0] = 101. p3[1] = 201. s1[1] = p3 p4 = ot.NumericalPoint(2, 0.) p4.setName("Three") p4[0] = 102. p4[1] = 202. s1[2] = p4 myStudy.add("mySample", s1) # Add a point with a description pDesc = ot.NumericalPointWithDescription(p1) desc = pDesc.getDescription() desc[0] = "x" desc[1] = "y" desc[2] = "z" pDesc.setDescription(desc) myStudy.add(pDesc) # Add a matrix matrix = ot.Matrix(2, 3) matrix[0, 0] = 0 matrix[0, 1] = 1 matrix[0, 2] = 2 matrix[1, 0] = 3 matrix[1, 1] = 4 matrix[1, 2] = 5