Nonlinear parameter optimization and modeling in R