# PowerFitInterval

Advanced Analysis Library Only

AnalysisLibErrType PowerFitInterval (double arrayX[], double arrayY[], double weight[], int numberOfElements, int intervalType, double confidenceLevel, double amplitude, double power, double upperBound[], double lowerBound[], double *deltaAmplitude, double *deltaPower);

## Purpose

Calculates the confidence interval for the best power fitting function or the prediction interval for the observations. The confidence interval refers to the interval within which the actual function is expected to fall. The prediction interval refers to the interval within which the y values are expected to fall in repeated measurements.

## Parameters

Input
Name | Type | Description
arrayX | double-precision array | The x value of the data set (x, y).
arrayY | double-precision array | The y value of the data set (x, y).
weight | double-precision array | The weight of each data point. If weight is NULL, the function sets all the elements of weight to 1.
numberOfElements | integer | The length of arrayX, arrayY, and weight.
intervalType | integer | The type of interval. intervalType must be one of the following values: CONFIDENCE_INTVL (0) PREDICTION_INTVL (1) deltaAmplitude and deltaPower are not referenced if intervalType is PREDICTION_INTVL.
confidenceLevel | double-precision | The level of certainty for the confidence interval or prediction interval. For the confidence interval, confidenceLevel specifies the probability that the actual function lies within the confidence interval. For the prediction interval, confidenceLevel specifies the probability that the y values lie within the prediction interval in repeated measurements. confidenceLevel must be between 0 and 1.
amplitude | double-precision | The amplitude of the fitted power model calculated using the Least Square method.
power | double-precision | The power of the fitted power model calculated using the Least Square method.
Output
Name | Type | Description
upperBound | double-precision array | The upper bound for the confidence interval or prediction interval.
lowerBound | double-precision array | The lower bound for the confidence interval or prediction interval.
deltaAmplitude | double-precision | The uncertainty radius of amplitude. deltaAmplitude is available only when intervalType is CONFIDENCE_INTVL.
deltaPower | double-precision | The uncertainty radius of power. deltaPower is available only when intervalType is CONFIDENCE_INTVL.

## Return Value

Name | Type | Description
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.