c#,excel,statistics,distribution,mathnet

I was very close. My Math.NET example was equivalent to (1 - TDIST(0.84, 8009, 2)), so I merely needed to subtract that from 1: double result = 1 - (2 * (1 - StudentT.CDF(0, 1, 8009, 0.84))) ...

You can convert your double matrix argument to a float matrix using the Map function: Matrix<double> m1 = Matrix<double>.Build.Random(6000000,3); Matrix<float> m2 = m1.Map(x => (float)x); Or alternatively Matrix<float> m2 = m1.Map(Convert.ToSingle); ...

Here's a solution similar to the one using PowerPack: let percentageTheSame (a:Matrix<float>) (b:Matrix<float>) = let z,t = Matrix.fold (fun (z,t) e -> (if e = 0. then z+1 else z), t+1) (0,0) (a-b) float z / float t Or using foldi, instead of subtracting matrices, might be more efficient for...

c#,arrays,list,multidimensional-array,mathnet

Percentile is an extension method with following calling sequence: public static double Percentile(this IEnumerable<double> data, int p) So you can use Linq to transform your 2d array into an appropriate sequence to pass to Percentile. However, results.GetLength(2) will throw an exception because the dimension argument of GetLength() is zero-based. You...

c#,math,linear-regression,mathnet

The exception text is really bad in this case, we should fix this. There are two concrete problems causing this to fail: The system with 3 unknowns but only 2 equations/samples (2x3 matrix) is under-defined; Applying a regression to such a problem does not actually make any sense as there...

The code snippet in the question computes a regression with 3 sample points (each one of them with 5704 values), so it expects weekReturnList to be of length 3. However, if weekReturnList has length 5704 as well and your data actually represents 5704 data points with 3 values each (short,...

I think it would be better to split this into two: Firstly, calculate the lower triangle, then in a separate loop assign the values from the lower triangle to the upper triangle. It's likely to be more performant. You might also be able to use Parallel.For for the outer loop...

The equation you want looks like this: y = a*x^b Take the natural log of both sides: ln(y) = ln(a*x^b) = ln(a) + b*ln(x) Now you can use linear regression on the new transformed variables (ln(x), ln(y)) and calculate the two parameters you want: ln(a) and b....

I'm assuming you want to get a reduced version of the matrix A. This is done by using PCA, search it. For example, if you want the reduced matrix A to have K dimensions: [m, ~] = size(A); Sigma = 1.0/m .* A' * A; [U, S, ~] = svd(Sigma);...

L2Norm is only available in v3: using MathNet.Numerics.LinearAlgebra; Vector<double>.Build.Random(10).L2Norm(); In v2 you can use the Norm function (which is available in v3 as well) with p=2 as argument: using MathNet.Numerics.LinearAlgebra.Double; using MathNet.Numerics.Distributions; DenseVector.CreateRandom(10, new Normal()).Norm(2); ...

c#,.net,signal-processing,mathnet

The ProcessSamples method doesn't appear to modify the input array, instead returning a new, filtered array. You need: postProcessedData = bandPass.ProcessSamples(preProcessedData); (Here's the documentation.) Incidentally, this line from your code: postProcessedData = preProcessedData; probably doesn't do what you're thinking. It doesn't make a copy of the data; it merely points...