0% found this document useful (0 votes)
78 views

Linear and Nonlinear Regression in Mathcad: Scalar Case

This document discusses linear and nonlinear regression techniques in MathCad. It provides examples of using linear regression to fit a line to data and polynomial regression to fit higher-order polynomial curves. For nonlinear regression, it describes defining a model function and using the genfit() or Minerr() functions to optimize the model parameters to minimize residuals between model and data. Key steps covered are setting up initial parameter guesses, defining the model function, and using fitting functions to optimize parameters for best fit.

Uploaded by

partho143
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Linear and Nonlinear Regression in Mathcad: Scalar Case

This document discusses linear and nonlinear regression techniques in MathCad. It provides examples of using linear regression to fit a line to data and polynomial regression to fit higher-order polynomial curves. For nonlinear regression, it describes defining a model function and using the genfit() or Minerr() functions to optimize the model parameters to minimize residuals between model and data. Key steps covered are setting up initial parameter guesses, defining the model function, and using fitting functions to optimize parameters for best fit.

Uploaded by

partho143
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Linear and Nonlinear Regression in MathCad: Scalar Case (Dr. Tom Co 10/11/2008) Introduction.

Mathematical models (empirical or theoretical) need to fit with experimental data. However, experimental data often contain measurement noise and error. Thus, the models do not need to pass through all the data points. Instead, the models need to just be close to the data. One criteria is to use minimize the sum of squared residual errors. Partial Glossary and Notation of Terms 1. Experimental data: , , , , often given in tabular form, where is the th independent variable data and is the th dependent variable data. 2. Model: a function relating the dependent variable ( with independent variable . 3. Model parameters: constants in a model that are adjusted to improve the fit of the model to experimental data. 4. Regressed data: the value of the dependent variable evaluated at . Example: a) Linear model: is the dependent variable, is the independent variable, and are model parameters. is the th regressed data. b) Nonlinear model: exp

5. Residuals ( or residual error ): the difference between the th regressed data and the th experimental data: 6. Coefficient of Determination: (closer to 1 means fit is better than simple mean) where is the average of . 7. Correlation Coefficient: Linear Regression Model: Model parameters: is the slope and is the -intercept.

is the dependent variable, is the independent variable, and are model parameters. (Note: is the universal gas constant, it is not a model parameter) exp is the th regressed data.

MathCad Procedure:

Polynomial Regression

a) , b) , c)

Model: Model parameters: , , are the polynomial coefficients.

MathCad Procedure:

a) , , b) , , , Note: -

the coefficients are , , (assuming vector starts at index 0) does not support units

Nonlinear Regression a) Define the nonlinear function: , , , , b) Set up initial guesses for model parameters: c) Use genfit( ) to optimize parameters for best fit: , , , Correlation Coefficients MathCad Functions: , MathCad Procedure:

Note: the arrow above is the vectorization symbol. This can be achieved by first selecting the group of terms to be vectorized, then click [CTRL minus]. Alternative Approach using Minerr( ) Function

[Right Click]

here,

then select [Nonlinear]


[Levenberg-Marquardt]

Remarks: 1. This approach can use units 2. One can include add constraints inside the Given - Minerr block. 3. It can handle multivariable problems: multiple dependent and multiple independent variables.

You might also like