Optimizing a multivariable function parameters using a random method, genetic algorithm and simulated annealing in R

October 19, 2013
By

(This article was first published on Computational Biology Blog in fasta format, and kindly contributed to R-bloggers)

Say that you are implementing a non-linear regression analysis, which is shortly described by wikipedia as:

“In statistics, nonlinear regression is a form of regression analysis in which observational data are modeled by a function which is a nonlinear combination of the model parameters and depends on one or more independent variables.”

For the training set, we have the following:

And the function to optimize the parameters is:

Which leads us to the following equality:

In other words, we want to optimize the value of theta in order to minimize the sum of the error among y and predicted.y:

Given theta (each parameter a0,..a3 has a range from 0 to 15):

And the error function:

finally, the goal function:

In other words, the goal function searches for the value of theta that minimizes the error.

COMPUTATIONS BEGIN

This is the scatter plot of the training set:

Here is the implementation in R, you can download the file clicking here

Here is a result plot using the genetic algorithm:

Benjamin

To leave a comment for the author, please follow the link and comment on their blog: Computational Biology Blog in fasta format.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)