Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

New Post: Liner Regression results....

$
0
0
I've got some simple code to do linear reqression on 2 vectors (below). What I'm not sure is how to I get the results back into C#? What would the result types be? I'm particularly interested in model and coef.

Thanks
var aVec = engine.CreateIntegerVector(new []{ 1, 2, 5 });
var bVec = engine.CreateIntegerVector(new []{ 12, 15, 20 });
engine.SetSymbol("a", aVec);
engine.SetSymbol("b", bVec);
engine.Evaluate("model = lm(a~b)"); // print out in the console
engine.Evaluate("summary(model)"); // print out in the console
engine.Evaluate("formula = formula(model)"); // print out in the console
engine.Evaluate("formula"); // print out in the console
engine.Evaluate("coef<-coefficients(model)"); // print out in the console

Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>