public final class Regression
extends java.lang.Object
implements java.io.Serializable
InputData
you provided and, typically, HDD and/or CDD as well.Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.
Modifier and Type | Class and Description |
---|---|
static class |
Regression.Builder
A builder class for creating immutable
Regression objects
e.g. for testing purposes. |
Modifier and Type | Method and Description |
---|---|
double |
adjustedRSquared()
Returns the adjusted-R-squared value for this
Regression . |
BaseloadRegressionComponent |
baseload()
Returns the non-null
BaseloadRegressionComponent object
representing the baseload component (b*days ) of this
Regression . |
double |
crossValidatedRSquared()
Returns the cross-validated-R-squared value for this
Regression . |
double |
cvrmse()
Returns the CVRMSE of this
Regression . |
boolean |
equals(java.lang.Object o)
Returns
true if o is a Regression
object with identical values for everything apart from the
tags() (which are not considered in the equality test). |
java.util.Set<java.lang.String> |
extraPredictorKeys()
Returns the non-null, possibly-empty, immutable set of extra-predictor
keys that this
Regression has extra components for. |
DegreeDaysRegressionComponent |
getCoolingDegreeDays()
Returns the non-null
DegreeDaysRegressionComponent object
representing the cooling-degree-days component (c*CDD ) of
this Regression , or throws an
IllegalStateException if no such component exists (check
hasCoolingDegreeDays() before calling this). |
ExtraRegressionComponent |
getExtraComponent(java.lang.String extraPredictorKey)
Returns the non-null
ExtraRegressionComponent object with
the specified extraPredictorKey , or throws an
IllegalStateException if no such component exists in this
Regression (check hasExtraComponent(java.lang.String) before calling
this). |
DegreeDaysRegressionComponent |
getHeatingDegreeDays()
Returns the non-null
DegreeDaysRegressionComponent object
representing the heating-degree-days component (h*HDD ) of
this Regression , or throws an
IllegalStateException if no such component exists (check
hasHeatingDegreeDays() before calling this). |
boolean |
hasCoolingDegreeDays()
Returns
true if this Regression has a
cooling-degree-days component (c*CDD ); false
otherwise. |
boolean |
hasExtraComponent(java.lang.String extraPredictorKey)
Returns
true if this Regression has an
extra-predictor component with the specified
extraPredictorKey ; false otherwise. |
int |
hashCode()
Overridden to ensure consistency with
equals . |
boolean |
hasHeatingDegreeDays()
Returns
true if this Regression has a
heating-degree-days component (h*HDD ); false
otherwise. |
boolean |
hasTag(RegressionTag tag)
Returns
true if this Regression contains the
specified tag ; false otherwise. |
double |
rSquared()
Returns the the R-squared value for this
Regression . |
int |
sampleDays()
Returns the number of days covered by the sample of data used for this
Regression , excluding any gaps between input periods. |
int |
sampleSize()
Returns the number of energy-usage figures used for this
Regression . |
DayRange |
sampleSpan()
Returns a non-null
DayRange representing the full period
covered by the sample (including any gaps) that was used for this
Regression . |
int |
sampleSpanDays()
Returns the number of days covered by the sample (including any gaps)
that was used for this
Regression . |
RegressionSpec |
spec()
Returns the non-null
RegressionSpec specifying the
components that this Regression contains, such that an
equivalent Regression can be requested in another API
request. |
double |
standardError()
Returns the standard error of this
Regression . |
java.util.Set<RegressionTag> |
tags()
Returns a non-null immutable set of the tags that describe how this
Regression came to be included in the response from the API. |
java.lang.String |
toString()
Returns a non-null, non-empty string representation of this object for logging and debugging purposes.
|
public boolean hasHeatingDegreeDays()
true
if this Regression
has a
heating-degree-days component (h*HDD
); false
otherwise.
If this returns true
, it is safe to call
getHeatingDegreeDays()
.
getHeatingDegreeDays()
public boolean hasCoolingDegreeDays()
true
if this Regression
has a
cooling-degree-days component (c*CDD
); false
otherwise.
If this returns true
, it is safe to call
getCoolingDegreeDays()
.
getCoolingDegreeDays()
public java.util.Set<java.lang.String> extraPredictorKeys()
Regression
has extra components for.
Remember that, in the usual case, if you provide extra-predictor data to the API, it will test regressions both with and without each extra predictor, and this will be reflected in the regressions you get back in the response.
getExtraComponent(java.lang.String)
public boolean hasExtraComponent(java.lang.String extraPredictorKey)
true
if this Regression
has an
extra-predictor component with the specified
extraPredictorKey
; false
otherwise.
Remember that, in the usual case, if you provide extra-predictor data to the API, it will test regressions both with and without each extra predictor, and this will be reflected in the regressions you get back in the response.
extraPredictorKey
- the String key that you used to identify the
extra predictor in the InputData
of your request. Cannot
be null
.java.lang.NullPointerException
- if extraPredictorKey
is
null
.getExtraComponent(java.lang.String)
,
extraPredictorKeys()
public BaseloadRegressionComponent baseload()
BaseloadRegressionComponent
object
representing the baseload component (b*days
) of this
Regression
.public DegreeDaysRegressionComponent getHeatingDegreeDays()
DegreeDaysRegressionComponent
object
representing the heating-degree-days component (h*HDD
) of
this Regression
, or throws an
IllegalStateException
if no such component exists (check
hasHeatingDegreeDays()
before calling this).java.lang.IllegalStateException
- if this Regression
does not
have a heating-degree-days component (i.e. if
hasHeatingDegreeDays()
returns false
).hasHeatingDegreeDays()
public DegreeDaysRegressionComponent getCoolingDegreeDays()
DegreeDaysRegressionComponent
object
representing the cooling-degree-days component (c*CDD
) of
this Regression
, or throws an
IllegalStateException
if no such component exists (check
hasCoolingDegreeDays()
before calling this).java.lang.IllegalStateException
- if this Regression
does not
have a cooling-degree-days component (i.e. if
hasCoolingDegreeDays()
returns false
).hasCoolingDegreeDays()
public ExtraRegressionComponent getExtraComponent(java.lang.String extraPredictorKey)
ExtraRegressionComponent
object with
the specified extraPredictorKey
, or throws an
IllegalStateException
if no such component exists in this
Regression
(check hasExtraComponent(java.lang.String)
before calling
this).
Remember that, in the usual case, if you provide extra-predictor data to the API, it will test regressions both with and without each extra predictor, and this will be reflected in the regressions you get back in the response.
extraPredictorKey
- the String key that you used to identify the
extra predictor in the InputData
of your request. Cannot
be null
.java.lang.NullPointerException
- if extraPredictorKey
is
null
.java.lang.IllegalStateException
- if this regression does not have an
extra-predictor component with the specified
extraPredictorKey
.hasExtraComponent(java.lang.String)
,
extraPredictorKeys()
public int sampleSize()
Regression
. This could be less than the number of input
periods included in your request if the location could not provide
enough weather data to cover all of them.public int sampleDays()
Regression
, excluding any gaps between input periods.public DayRange sampleSpan()
DayRange
representing the full period
covered by the sample (including any gaps) that was used for this
Regression
. This could be shorter than the full range of the
InputData
sent in your request, if the location could not provide
enough weather data to cover it all.public int sampleSpanDays()
Regression
. This could be shorter
than the number of days covered by the InputData
sent in your
request, if the location could not provide enough weather data to cover
it all.public double rSquared()
Regression
.
You can read more about this and the other statistics in the docs for our online regression tool (which uses this API internally).
public double adjustedRSquared()
Regression
.
You can read more about this and the other statistics in the docs for our online regression tool (which uses this API internally).
public double crossValidatedRSquared()
Regression
.
You can read more about this and the other statistics in the docs for our online regression tool (which uses this API internally).
public double standardError()
Regression
.
You can read more about this and the other statistics in the docs for our online regression tool (which uses this API internally).
public double cvrmse()
Regression
.
You can read more about this and the other statistics in the docs for our online regression tool (which uses this API internally).
public java.util.Set<RegressionTag> tags()
Regression
came to be included in the response from the API.public boolean hasTag(RegressionTag tag)
true
if this Regression
contains the
specified tag
; false
otherwise.tag
- the RegressionTag
that's presence in this
Regression
is to be tested. Cannot be
null
.java.lang.NullPointerException
- if tag
is null
.tags()
public RegressionSpec spec()
RegressionSpec
specifying the
components that this Regression
contains, such that an
equivalent Regression
can be requested in another API
request.public boolean equals(java.lang.Object o)
true
if o
is a Regression
object with identical values for everything apart from the
tags()
(which are not considered in the equality test).equals
in class java.lang.Object
public int hashCode()
equals
.hashCode
in class java.lang.Object
public java.lang.String toString()
The exact details of the representation are unspecified and subject to change.
toString
in class java.lang.Object
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.