Class LinearModel
source code
Model evaluator for linear solution to Ax = y.
Computes a confidence interval (range of likely values for the
mean at x) or a prediction interval (range of likely values
seen when measuring at x). The prediction interval tells
you the width of the distribution at x. This should be the same
regardless of the number of measurements you have for the value
at x. The confidence interval tells you how well you know the
mean at x. It should get smaller as you increase the number of
measurements. Error bars in the physical sciences usually show
a 1-alpha confidence value of erfc(1/sqrt(2)), representing
a 1 sigma standandard deviation of uncertainty in the mean.
Confidence intervals for linear system are given by:
x' p +/- sqrt( Finv(1-a,1,df) var(x' p) )
where for confidence intervals:
var(x' p) = sigma^2 (x' inv(A'A) x)
and for prediction intervals:
var(x' p) = sigma^2 (1 + x' inv(A'A) x)
Stored properties:
DoF = len(y)-len(x) = degrees of freedom
rnorm = 2-norm of the residuals y-Ax
x = solution to the equation Ax = y
Computed properties:
cov = covariance matrix [ inv(A'A); O(n^3) ]
var = parameter variance [ diag(cov); O(n^2)]
std = standard deviation of parameters [ sqrt(var); O(n^2) ]
p = test statistic for chisquare goodness of fit [ chi2.sf; O(1) ]
Methods:
ci(A,sigma=1): return confidence interval evaluated at A
pi(A,alpha=0.05): return prediction interval evaluated at A
|
|
__init__(self,
x=None,
DoF=None,
SVinv=None,
rnorm=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
|
__call__(self,
A)
Return the prediction for a linear system at points in the
rows of A. |
source code
|
|
|
|
ci(self,
A,
sigma=1)
Compute the calculated values and the confidence intervals
for the linear model evaluated at A. |
source code
|
|
|
|
pi(self,
A,
p=0.05)
Compute the calculated values and the prediction intervals
for the linear model evaluated at A. |
source code
|
|
|
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__str__
|
|
|
cov
covariance matrix
|
|
|
var
result variance
|
|
|
std
result standard deviation
|
|
|
p
probability of rejection
|
|
Inherited from object:
__class__
|
__init__(self,
x=None,
DoF=None,
SVinv=None,
rnorm=None)
(Constructor)
| source code
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- Overrides:
object.__init__
|
|
Compute the calculated values and the confidence intervals
for the linear model evaluated at A.
sigma=1 corresponds to a 1-sigma confidence interval
Confidence intervals are sometimes expressed as 1-alpha values,
where alpha = erfc(sigma/sqrt(2)).
|
|
Compute the calculated values and the prediction intervals
for the linear model evaluated at A.
p = 1-alpha = 0.05 corresponds to 95% prediction interval
|
cov
covariance matrix
- Get Method:
- _cov(self)
|
var
result variance
- Get Method:
- _var(self)
|
std
result standard deviation
- Get Method:
- _std(self)
|
p
probability of rejection
- Get Method:
- _p(self)
|