Now we can use different LagOrder parameters where it is important to choose the "best" possible lagOrder to return as accurate "pValue" as possible.

Normally a good way to determine what LagOrder value to choose is by calculate the

Where the lowest found AIC would be a good pValue to choose.

I am not sure how to calculate the AIC with the library in this context?

Below line is just pseudo code and that function do not exist but show the intent.

Thank you!

CalculateAIC(statistic, lagOrder)

TrendType P_1 = TrendType.CONSTANT; ADFDistribution dist = P_1.getDistribution(array_MSFT.Length); double minAIC = double.MaxValue; int bestLagOrder = 0; int maxLagOrder = 20; for (int lagOrder = 0; lagOrder <= maxLagOrder; lagOrder++) { AugmentedDickeyFuller ADFtest = new AugmentedDickeyFuller(array_MSFT, P_1, lagOrder, dist); double pValue = ADFtest.pValue(); double statistic = ADFtest.statistics(); //How to Implement AIC calculation? (Pseudo Code) double aic = CalculateAIC(statistic, lagOrder); if (aic < minAIC) { minAIC = aic; bestLagOrder = lagOrder; } }]]>

Now we can use different LagOrder parameters where it is important to choose the "best" possible lagOrder to return as accurate "pValue" as possible.

Normally a good way to determine what LagOrder value to choose is by calculate the

Where the lowest found AIC would be a good pValue to choose.

I am not sure how to calculate the AIC with the library in this context?

Below line is just pseudo code and that function do not exist but show the intent.

Thank you!

CalculateAIC(statistic, lagOrder)

TrendType P_1 = TrendType.CONSTANT; ADFDistribution dist = P_1.getDistribution(array_MSFT.Length); double minAIC = double.MaxValue; int bestLagOrder = 0; int maxLagOrder = 20; for (int lagOrder = 0; lagOrder <= maxLagOrder; lagOrder++) { AugmentedDickeyFuller ADFtest = new AugmentedDickeyFuller(array_MSFT, P_1, lagOrder, dist); double pValue = ADFtest.pValue(); double statistic = ADFtest.statistics(); //How to Implement AIC calculation? (Pseudo Code) double aic = CalculateAIC(statistic, lagOrder); if (aic < minAIC) { minAIC = aic; bestLagOrder = lagOrder; } }]]>

Now we can use different LagOrder parameters where it is important to choose the "best" possible lagOrder to return as accurate "pValue" as possible.

Normally a good way to determine what LagOrder value to choose is by calculate the

Where the lowest found AIC would be a good pValue to choose.

I am not sure how to calculate the AIC with the library in this context?

Below line is just pseudo code and that function do not exist but show the intent.

Thank you!

CalculateAIC(statistic, lagOrder)

TrendType P_1 = TrendType.CONSTANT; ADFDistribution dist = P_1.getDistribution(array_MSFT.Length); double minAIC = double.MaxValue; int bestLagOrder = 0; int maxLagOrder = 20; for (int lagOrder = 0; lagOrder <= maxLagOrder; lagOrder++) { AugmentedDickeyFuller ADFtest = new AugmentedDickeyFuller(array_MSFT, P_1, lagOrder, dist); double pValue = ADFtest.pValue(); double statistic = ADFtest.statistics(); //How to Implement AIC calculation? (Pseudo Code) double aic = CalculateAIC(statistic, lagOrder); if (aic < minAIC) { minAIC = aic; bestLagOrder = lagOrder; } }]]>

Now we can use different LagOrder parameters where it is important to choose the "best" possible lagOrder to return as accurate "pValue" as possible.

Normally a good way to determine what LagOrder value to choose is by calculate the

Where the lowest found AIC would be a good pValue to choose.

I am not sure how to calculate the AIC with the library in this context?

Below line is just pseudo code and that function do not exist but show the intent.

Thank you!

CalculateAIC(statistic, lagOrder)

Now we can use different LagOrder parameters where it is important to choose the "best" possible lagOrder to return as accurate "pValue" as possible.

Normally a good way to determine what LagOrder value to choose is by calculate the

Where the lowest found AIC would be a good pValue to choose.

I am not sure how to calculate the AIC with the library in this context?

Below line is just pseudo code and that function do not exist but show the intent.

Thank you!

CalculateAIC(statistic, lagOrder)

ADFDistribution dist = TrendType.NO_CONSTANT.getDistribution(data.Length);

Thank you!

]]>ADFDistribution dist = TrendType.NO_CONSTANT.getDistribution(data.Length);

Thank you!

]]>I am trying to understand how to create the: AugmentedDickeyFuller

The parameter I have problem to declare is the below ADFDistribution

ADFDistribution ADF_dist

How to implement that correctly for this C# code?

Thank you!

double[] array_MSFT = new double { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int lagOrder = 0; ADFDistribution ADF_dist = new ??? AugmentedDickeyFuller ADFtest = new AugmentedDickeyFuller(array_MSFT, TrendType.CONSTANT, lagOrder, ADF_dist); double pValue = ADFtest.pValue(); double statistic = ADFtest.statistics(); MessageBox.Show(pValue + "__" + statistic);]]>

Noticed indeed that Matrix operations in SuanShu have some inherit performance overhead (access patterns cause some level of indirections), but nothing that is too hard to fix for me I would imagine. Especially since mostly interested in DenseMatrix and the abstraction in SuanShu allow for easy refactoring. Of course, bugs are very undesirable. ]]>

Thank you for reaching out.

The open-source version of SuanShu is rather old. It was our first attempt at making a comprehensive library. It has subtle bugs and performance issues, e.g., matrix multiplication, that has since been improved in the new nm dev library.

NM Dev supports a library of trading strategies that may be of interest to you. They are in the packages prefixed by "tech.nmfin".

The models are supported by NM FinTech.

https://nmfin.tech/products/algoquant/quantitative-trading-models/

If your business model is only open-source and free, maybe you can use SuanShu in your product.

If you have a for-fee model, maybe there is a synergy between nmdev and the quantitative trading models in our library.

]]>