Performs regression analysis on a set of X-Y points, solving for any number of parameters for a function of any form.

For example, you may fit data to an equation with the following form:

ax^2 + Sin(2x^b) + c^x

Where ‘x’ is the independent variable and ‘a’, ‘b’, and ‘c’ are the parameters to be solved for.

The string expression is case-sensitive. For example, in the above expression, writing ‘Sin’ as ‘sin’ will not work. Similarly, the natural log should be written as ‘Ln’ instead of ‘ln’. And so on.

An initial guess must be supplied for each of the defined parameters. Note that this initial guess can have a significant impact on the solution (and whether a solution can be found). For more complex expressions, it may be necessary to iterate on the initial guesses.

Inputs

Number Name Object Type Description Optional
1 X-Values List<System.Double> List of x-values. Must contain the same number of items as y-values. No
2 Y-Values List<System.Double> List of y-values. Must contain the same number of items as x-values. Yes
3 Expression System.String First expression, as a string No
4 Ind Variable System.String The independent variable. Defaults to ‘x’. Yes
5 Parameters List<System.String> List of all parameters (other than the independent variable). No
6 Initial Values List<System.Double> Initial value (or guess) for each of the parameters. Must contain the same number of values as defined parameters. No

Outputs

Number Name Object Type Description
1 Solution List<System.Double> List of all solved parameter values, in the same order as the parameters are defined.

Regression.png