/gradientmethodsexamples-YunheLiuMCMC

tamu-stat-600-schafer-classroom-7090a3-gradientmethodsexamples-GradientMethodsExamples created by GitHub Classroom

Primary LanguageR

Some examples for the use of gradient methods

R scripts that contain source functions:

SteepestDescent.R - starter code to implement steepest descent (1) for function of a scalar; (2) for function of a vector

NewtonsMethod.R - starter code to implement Newton's method (1) for function of a scalar

FunctionsBinaryLogistic.R - starter code to implement functions for binary logistic regression that calculate (1) objective value; (2) gradient; (3) customized steepest descent solver; (4) customized Newton's method with variations

R scripts that contain examples that use the source functions.

Example1.R - toy example with function $f$ that takes scalar argument; goes through default optimization methods in R, effect of step size in steepest descent, effect of starting point in Newton's method

Example2.R - finding $\beta$ for binary logistic regression using steepest descent and Newton's method