Returning Multiple Output Parameters from Optim

Im running an optimisation routine using optim in R and im telling the programme what i want returned. for example, if i put return(op1$par), it will return all 4 of my variable values. Thats fine, and if i run return(op1), I obviously get all the information from the optimisation routine (par, value, convergence etc). However, in this format, the par values arent accessible in the output, it simply details that there are 4 values.

Now what i need is to the get the parameter values and the convergence information at the same time. R wont let me call this return(op1$par, op1$convergence) so im looking for the best way to get these two entities in one run?

I should specify that im writing this to a file for 1000s of iterations and not just looking to call it up once on screen.

Cheers

Answers


Try something like this:

return(c(Parameters=op1$par, Convergence=op1$convergence))

The names Parameters and Convergence are only for identifying what are the parameters and what is the convergence, since this result will be a vector.


Need Your Help

Tortoisesvn doesn't recognize changed files after update

svn tortoisesvn

After I updated my tortoise-svn client, I haven't been able to commit.

Android build with Proguard DX SimException local 0000: invalid

android exception ant proguard

I am using Ant > 1.8 + Proguard 4.6 to build my Android project and I've got an Exception during the build process:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.