Examples

Practical examples of basic methods for data analysis. It is performed in the format of Matlab reports. It collects examples of forecasting, linear and logistic regression, model selection and useful utilities.

intro.m An introduction to the MatLab programming, the most useful codes

Regression analysis

Least Squares Linear Fit, demo Least Squares Linear Fit, demo
Logistic regression and Newton-Raphson algorithm, demo Logistic regression and Newton-Raphson algorithm, demo
Classification using logistic regression, demo Classification using logistic regression, demo
Linear model generation example Linear model generation example
Least Angle regression example Least Angle regression example
Generalized linear models example Generalized linear models example
The simpliest Singular Structure Analysis forecasting algorithm, demo The simpliest Singular Structure Analysis forecasting algorithm, demo , requires ssaMtick
The Principal Component Analysis, demo The Principal Component Analysis, demo
Write a target function for optimisation in regression analysis Write a target function for optimisation in regression analysis , requires target_function
Mark up time series Mark up time series, requires demo_markup, mark_lin, mark_exp, mark_any and the data file xMarkUp.csv
Volatility smile modelling: two-dimensional linear regression demo Volatility smile modelling: two-dimensional linear regression demo , requires data fileoption_AP04.csv
Receiver Operating Characteristic, calculation example Receiver Operating Characteristic, calculation example.

Miscellaneous

How to make reports on computational experiments How to make reports on computational experiments? An example.
An example how to use indexes to sort and unsort a set An example how to use indexes to sort and unsort a set.
Combinatorcs: how to search all combinations for the feature selection Combinatorcs: how to search all combinations for the feature selection?
A special case of distance caclulation in N-dim space A special case of distance caclulation in N-dim space, distance2curve.m
mixedup_observations.m, image1, image2, image3 What if one will mix-up the observations? A simple example

Utilities

func2TeXtree.m Convert a superposition of functions to TeX format (ecltree)
subdir.m Gather filenames from subfolders
tex2txt.m, file Clear the most of the TeX markup from the tex file
regresplot.m Show regression data

How to write Matlab codes

Devoted to C++ and VS programmers

  1. Matlab is very simple. There are no projects, no compilations and no libraries.
  2. There are command window, m-code window, path list and help.
  3. If you want to use a toolbox function, just use the function name in your code.
  4. There are no name collisions. The old name just dies when reloaded. Remember this pity fact.
  5. And keep the path list (see the main menu) up to date.
  6. Please search the help before making an algorithm. You will save lot of time.
  7. Then please search internet (special-purpose cites and wikipedia are highly recommended). There are the other researchers who make code, too.
  8. Do not afraid of using complicated algorithms. Often classification, scaling, regression, optimization is no more than one line of the code. It is not expensive.
  9. Your function help must be bright.
    • The first line shortly explains the purpose of the function.
    • The second one may name the function with in-out arguments.
    • The next describes variants of usage or arguments formats.

    And the example is essential. One can run your function using your help example.

  10. Make short examples of what you are doing and keep it to the future.
  11. Store useful functions in a repository. And comment them well.
  12. If you are making a large project, think how to organize functions in a proper way.
  13. Study all data structures of Matlab. There are plenty.
  14. Avoid ‘for’ when possible. Say, to multilply each column of a matrix A by constants x is A*diag(x), there is no ‘for’.
  15. To be continued. Good luck!

Disclaimer of warranty

We make no warranties, express or implied, that the programs contained in this resource and calculated indices are free of error, or are consistent of any particular standard of merchantability, or that they met your requirements for any particular application. They should not be relied on for solving a problem whose incorrect solution could result in injury to a person or loss of property. If you do use the programs and the indices in such manner, it is at your own risk. The authors and disclaim all liability for direct or consequential damages resulting from your use of the programs and indices.

You may also like...