find covariance using ejml

J

jimgardener

hi
I have two double arrays as below
double[] x=new double[]{2.5,0.5,2.2,1.9,3.1,2.3,2.0,1.0,1.5,1.1};
double[] y=new double[]{2.4,0.7,2.9,2.2,3.0,2.7,1.6,1.1,1.6,0.9};

How do you find the covariance between them using ejml library?
Any code snippet most welcom
thanks
jim
 
L

Lew

jimgardener said:
I have two double arrays as below
double[] x=new double[]{2.5,0.5,2.2,1.9,3.1,2.3,2.0,1.0,1.5,1.1};
double[] y=new double[]{2.4,0.7,2.9,2.2,3.0,2.7,1.6,1.1,1.6,0.9};

How do you find the covariance between them using ejml [sic] library?
Any code snippet most welcom

I've never used EJML, but the formula for matrix covariance
<http://stattrek.com/matrix-algebra/variance.aspx>
looks like it can be implemented using
<http://efficient-java-matrix-librar...Mult.html#innerProd(org.ejml.data.D1Matrix64F,
org.ejml.data.D1Matrix64F)>

or some higher-level method, given that that particular method warns, "These
functions are often used inside of highly optimized code and therefor sanity
checks are kept to a minimum. It is not recommended that any of these
functions be used directly."

I just snooped around the EJML Javadocs for a minute. You can likely do better.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top