net.simplace.client.simulation.lap.transformer.LinearRegressionTransformer

Calculates linear Regression (slope and intercept) from two double arrays

Inputs and outputs

The transformer takes the field/column names from a resource that act as x and y values.

It outputs the slope m, intercept b as well as the mean of x and y values.

\[ \begin{eqnarray} \bar{x} &=& \frac{1}{n}\sum_{i=1}^n x_i \\ \bar{y} &=& \frac{1}{n}\sum_{i=1}^n y_i \\ u &=& \frac{1}{n}\sum_{i=1}^n x_i y_i - \bar{x} \bar{y} \\ v &=& \frac{1}{n}\sum_{i=1}^n x_i x_i - \bar{x} \bar{x} \\ m &=& \frac{u}{v} \\ b &=& \bar{y} -m \bar{x} \end{eqnarray} \]


public class LinearRegressionTransformer extends
net.simplace.simulation.io.resources.FWSimResourceTransformer {
// Public Constructors
public LinearRegressionTransformer(FWSimSession aSession, Element
aResourceElement, Integer aOrderNumber);
public LinearRegressionTransformer(FWSimSession aSession, Integer
aOrderNumber);


// Public Instance Methods
public HashMap createVariables(); // Defines
net.simplace.simulation.io.FWSimIOAdapter


public FWSimResourceCache getData(FWSimVarMap aVarMap)
throws MissingSimResourceException; // Defines
net.simplace.simulation.io.resources.FWSimInputAdapter


standard method from outside
public FWSimResourceCache getData(FWSimVarMap aVarMap, FWSimResourceCache
aResourceCache) throws MissingSimResourceException;

used by test cases
returns delivered new data from transformer
public FWSimResourceCache calculateLinearRegression(FWSimVariable aXName,
FWSimVariable aYName, String aProjectID, FWSimResourceCache aCache)
throws MissingSimResourceException;

Calculates the linear regression from two vectors X and Y by the least square approach.
returns the new created {@link FWSimResourceCache}
public void updateFields(FWObservable aObservable);
// Defines
net.simplace.simulation.io.resources.FWSimResourceTransformer




}



Hierarchy: java.lang.Object - net.simplace.simulation.io.FWSimIOAdapter (net.simplace.simulation.util.FWSimFieldContainer) - net.simplace.simulation.io.resources.FWSimInputAdapter - net.simplace.simulation.io.resources.FWSimResourceTransformer - LinearRegressionTransformer