|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
vec_math.AbstractFit
vec_math.PhaseRegression
public class PhaseRegression
An analyser that fits a cosine wave with phase shift, but fixed period to the input data. If writtn as
y_fit=c_0+a_0*cos(ωt)+b_0*sin(ωt),the fitting function y_fit is linear in all its three parameters a_0, b_0, and c_0. This fit can be performed using
GeneralRegression#harmonic.
We assign variable names according to OFFSET, AMPLITUDE,
and PHASE, where phase and amplitude are calculated from the
linear parameters as
amplitude²=a_0²+b_0² tan(ωt_0)=b_0/a_0;
| Nested Class Summary | |
|---|---|
private static class |
PhaseRegression.PhaseModel
Our data model. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
static String |
AMPLITUDE
The name of the amplitude constant. |
private static int |
DEFERRORINDEX
Default error index. |
private static int |
DEFTINDEX
Default time index. |
private static String |
DEFUNITAMPLITUDE
Default units of the parameters. |
private static String |
DEFUNITOFFSET
Default units of the parameters. |
private static String |
DEFUNITPHASE
Default units of the parameters. |
private static int |
DEFYINDEX
Default y index. |
private List<Variable> |
fitted
The fitted values to C+A*cos(2pi/P*t+PHI). |
static String |
KEY_ERRORINDEX
The index of the measure error, defaults to none. |
static String |
KEY_PERIOD
This is the main fitting parameter. |
static String |
KEY_TINDEX
The index of the time, defaults to zero. |
static String |
KEY_UNITAMPLITUDE
The units of the parameters. |
static String |
KEY_UNITOFFSET
The units of the parameters. |
static String |
KEY_UNITPHASE
The units of the parameters. |
static String |
KEY_YINDEX
The index of the measure, defaults to one. |
static String |
OFFSET
The name of the offset constant. |
static String |
PERIOD
period constant. |
static String |
PHASE
The name of the phase constant. |
private PhaseRegression.PhaseModel |
phasemodel
The model. |
private double |
q
The q-value of the fit, available after fit(). |
| Fields inherited from class vec_math.AbstractFit |
|---|
KEY_DEFAULTERROR, KEY_DEFAULTFORMAT, KEY_ERRORFORMAT, KEY_PARAMETERFORMAT |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
PhaseRegression(Map<String,String> prop)
Constructs a new regression analyser. |
|
| Method Summary | |
|---|---|
List<Variable> |
fit()
We fit the amplitude and phase plus mgnitude offset only, the period stays constant. |
DataModel |
getDataModel()
Returns the phase model. |
List<Variable> |
getFittedParameters()
Returns the fitted parameters. |
DataModel |
prepareFit(VectorG[] in)
Visualization means performing a linear Regression using GeneralRegression#harmonic. |
double |
qualityOfFit()
Significance is the q-value of the regression. |
boolean |
setConstant(Variable p)
We need tthe period as a constant. |
| Methods inherited from class vec_math.AbstractFit |
|---|
formatError, formatValue, getChi2, getModelParameterErrors, getModelParameterValues, getR2, getRms, init, setInitialCondition |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Field Detail |
|---|
public static final String PERIOD
public static final String AMPLITUDE
public static final String OFFSET
public static final String PHASE
public static final String KEY_UNITAMPLITUDE
public static final String KEY_UNITPHASE
public static final String KEY_UNITOFFSET
public static final String KEY_PERIOD
public static final String KEY_TINDEX
public static final String KEY_YINDEX
public static final String KEY_ERRORINDEX
private static final int DEFTINDEX
private static final int DEFYINDEX
private static final int DEFERRORINDEX
private static final String DEFUNITAMPLITUDE
private static final String DEFUNITPHASE
private static final String DEFUNITOFFSET
private double q
fit().
private List<Variable> fitted
private PhaseRegression.PhaseModel phasemodel
| Constructor Detail |
|---|
public PhaseRegression(Map<String,String> prop)
| Method Detail |
|---|
public boolean setConstant(Variable p)
setConstant in interface ModelFittingsetConstant in class AbstractFitpublic DataModel prepareFit(VectorG[] in)
GeneralRegression#harmonic. The three linear parameters are fit
into three fitting parameters OFFSET, AMPLITUDE,
and PHASE, where phase and amplitude are calculated from the
linear parameters as
amplitude²=a_0²+b_0²
tan(ωt_0)=b_0/a_0;
The order of the returned array is at index zero amplitude, sigma
amplitude, at index one, offset plus sigma, and at index two phase plus
sigma.
in - An array of measurements. Each vector contains dependant
and independant variables and eventually their errors.
public List<Variable> fit()
PhaseFit. This fit has
the advantage that by transforming the amplitude, phase function into
a sin and cosine wave, we get a pure linear regression. This is done
here, the result is transformed back to match the original (non-linear)
model (holds also for parameter errors).
public DataModel getDataModel()
public List<Variable> getFittedParameters()
public double qualityOfFit()
qualityOfFit in interface ModelFittingqualityOfFit in class AbstractFit
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||