private void DataSet(List <InitialStatisticalAnalys> ISA, List <int> IND, int k) { this.k = k; this.ISA = new List <InitialStatisticalAnalys>(); Ex = new double[IND.Count]; for (int i = 0; i < IND.Count; i++) { this.ISA.Add(ISA[IND[i]]); Ex[i] = ISA[IND[i]].Mx.Q; } n = this.ISA.Count; N = this.ISA[0].unsortl.Length; DC = DCFound(ISA, IND); K = KFound(ISA, IND); X = XFound(this.ISA, n, N, k); KTurnOn = new bool[n]; for (int i = 0; i < KTurnOn.Length; i++) { KTurnOn[i] = true; } if (k >= 0) { Y = YFound(this.ISA, n, N, k); CMC = new Data[n]; for (int i = 0; i < n; i++) { CMC[i] = new Data(); CMC[i].Name = "Коеф. багатов. корел."; CMC[i].Q = CMCFound(ISA, K, i); CMC[i].QKvant = (N - n - 1) * (Math.Pow(CMC[i].Q, 2)) / (n * (1 - Math.Pow(CMC[i].Q, 2))); CMC[i].Q0 = Distributions.FisherQuantile(1 - ISA[0].alf.Q / 2, n, N - n - 1); } SigmKv = Math.Sqrt(this.ISA[k].Dx.Q * (1 - Math.Pow(CMC[k].Q, 2)) * (N - 1) / (N - n - 1)); CoefDeter = new Data(); CoefDeter.Name = "Коефіціент Детермінації = "; CoefDeter.Q = Math.Pow(CMC[k].Q, 2); ZnachRegres = new Data(); ZnachRegres.Name = "Перевірка значущості від. регресії"; ZnachRegres.QKvant = (N - n) * ((1 / (1 - CoefDeter.Q)) - 1) / (n - 1); ZnachRegres.Q0 = Distributions.FisherQuantile(1 - ISA[0].alf.Q / 2, n - 1, N - n - 2); C = CFound(n, X); A = MuliplRegresFound(this.ISA, k); Astandart = AstndF(this.ISA, A, k); Szal = SzalFound(this.ISA, k, A); } }
public SimpleClass(List <InitialStatisticalAnalys> ML, List <int> MSelectGR, double BinSim) { this.ML = ML; this.MSelectGR = MSelectGR; N = NFound(ML, MSelectGR); Nezal = Nezalegni(); r = rFound(ML, MSelectGR); Sm2 = Sm2Found(ML, MSelectGR); Sv2 = Sv2Found(ML, MSelectGR); VarSv2Sm2[0] = Sm2 / Sv2; VarSv2Sm2[1] = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1, (int)(N - MSelectGR.Count)); var tyui = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, 10, 10); if (Nezal == true) { KrKohrena[0] = KrKohrenaFound(ML, MSelectGR, BinSim); KrKohrena[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1); T = Distributions.StudentQuantile(1 - ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count - 2); } if (MSelectGR.Count == 2) { Doubl = true; if (Nezal == true) { f = fFound(ML[MSelectGR[0]], ML[MSelectGR[1]], 15, 7); Korelation[0] = KorelationFound(ML, MSelectGR); KorelationVidnoh[0] = KorelationVidnohFound(ML, MSelectGR); RangKorelation[0] = RangKorelationFound(ML, MSelectGR); RangKorelation[1] = RangKorelation[0] * Math.Sqrt((ML[MSelectGR[0]].l.Count - 2) / (1 - Math.Pow(RangKorelation[0], 2))); X2f[0] = X2fFound(ML[MSelectGR[0]], ML[MSelectGR[1]], f); X2f[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, ML[MSelectGR[0]].l.Count - 2); RangKoefKend[0] = RangKoefKendFound(ML, MSelectGR);//slow RangKoefKend[1] = 3 * RangKoefKend[0] * Math.Sqrt((ML[MSelectGR[0]].l.Count * (ML[MSelectGR[0]].l.Count - 1)) / (2 * (2 * ML[MSelectGR[0]].l.Count + 5))); RangKoefKend[2] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2); Nij = NijFound(ML, MSelectGR, BinSim); int ti = (int)(12 * ML[MSelectGR[1]].Dx.Q / ML[MSelectGR[0]].Dx.Q); try { if (Math.Abs(ti) > 20) { ti = 20; } } catch { ti = 20; } TablPerTab(ML, MSelectGR, fFound(ML[MSelectGR[0]], ML[MSelectGR[1]], 12, ti)); RegresParam = RegresParamFound(); NachYslovRegAnal(ML[MSelectGR[0]], ML[MSelectGR[1]]); KoefDeterm = Math.Pow(Korelation[0], 2) * 100; Szal = SzalFound(AB, ML[MSelectGR[0]], ML[MSelectGR[1]]); AB[2] = Szal * Math.Sqrt(1.0 / ML[MSelectGR[0]].l.Count + Math.Pow(ML[MSelectGR[0]].Mx.Q, 2) / (ML[MSelectGR[0]].Dx.Q * (ML[MSelectGR[0]].l.Count - 1))); AB[3] = Szal / (ML[MSelectGR[0]].Gx.Q * Math.Sqrt(ML[MSelectGR[0]].l.Count - 1)); ABTailFound(ML[MSelectGR[0]], ML[MSelectGR[1]]); double op = Korelation[0] * (1 - Math.Pow(Korelation[0], 2)) / (2 * ML[MSelectGR[0]].l.Count); double oi = (1 - Math.Pow(Korelation[0], 2)) / Math.Sqrt(ML[MSelectGR[0]].l.Count - 1); double rn = Korelation[0] + op - Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2) * oi; double rv = Korelation[0] + op + Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2) * oi; if (rn < -1) { rn = 1; } if (rv > 1) { rv = 1; } Korelation[1] = rn; Korelation[2] = rv; Korelation[2] = op; SravnSred[1] = Distributions.StudentQuantile(ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count + ML[MSelectGR[1]].l.Count - 2); } else { SravnSred[1] = Distributions.StudentQuantile(ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count - 2); } SravnSred[0] = SimpleMx(ML[MSelectGR[0]], ML[MSelectGR[1]]); SravnDisper[0] = SimpleS(ML[MSelectGR[0]], ML[MSelectGR[1]]); SravnDisper[1] = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, ML[MSelectGR[0]].l.Count - 1, ML[MSelectGR[1]].l.Count - 1); KrSmirnKolmag[0] = 1.0 - LzFound(ZFound(ML[MSelectGR[0]], ML[MSelectGR[1]])); KrSmirnKolmag[1] = ML[MSelectGR[0]].alf.Q; KrsumRangVils[0] = KrsumRangVilsFound(r, ML[MSelectGR[0]], ML[MSelectGR[1]]); KrsumRangVils[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0); KrUMannaUit[0] = KrUMannaUitFound(ML[MSelectGR[0]], ML[MSelectGR[1]]); KrUMannaUit[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0); RizSerRangVib[0] = RizSerRangVibFound(r, ML[MSelectGR[0]], ML[MSelectGR[1]]); RizSerRangVib[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0); KrZnakiv[0] = KrZnakivFound(ML[MSelectGR[0]], ML[MSelectGR[1]]); } else { Doubl = false; SravnSred[0] = SimpleMx(ML, MSelectGR); SravnDisper[0] = SimpleS(ML, MSelectGR); SravnDisper[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1); KrKruskalaUolisa[0] = KrKruskalaUolisaFound(r, ML, MSelectGR); KrKruskalaUolisa[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1); } Round(); }
private bool NachYslovRegAnal(InitialStatisticalAnalys gr1, InitialStatisticalAnalys gr2) { AB[1] = Korelation[0] * gr2.Gx.Q / gr1.Gx.Q; AB[0] = gr2.Mx.Q - AB[1] * gr1.Mx.Q; bool rez = true; if (!(gr1.AvtoType == gr2.AvtoType && gr2.AvtoType == "Нормальний")) { rez = false; } int M = 18; List <double>[] yi = new List <double> [M]; for (int i = 0; i < M; i++) { yi[i] = new List <double>(); } for (int i = 0; i < ML[MSelectGR[0]].l.Count; i++) { for (int j = 0; j < M; j++) { if (gr1.unsortl[i] < (j + 1.0001) * gr1.Len.Q / M + gr1.Min.Q && gr1.unsortl[i] >= (j * gr1.Len.Q / M + gr1.Min.Q)) { yi[j].Add(gr2.unsortl[i]); break; } } } ///ProvRegr double t1 = 0, t2 = 0; /// double[] Sxj = new double[M]; double S = 0; for (int i = 0; i < M; i++) { double ysr = yi[i].Sum() / yi[i].Count; if (ysr > 0) { for (int j = 0; j < yi[i].Count; j++) { t2 += Math.Pow(yi[i][j] - ysr, 2); Sxj[i] += Math.Pow(yi[i][j] - ysr, 2); } if (yi[i].Count > 1) { Sxj[i] /= yi[i].Count - 1; } t1 += yi[i].Count * Math.Pow(ysr - AB[0] - AB[1] * ((i + 0.5) * gr1.Len.Q / M + gr1.Min.Q), 2); } } ProvRegrs[0] = (gr1.l.Count - M) * t1 / ((M - 1) * t2); ProvRegrs[1] = Distributions.FisherQuantile(gr1.alf.Q, M - 1, gr1.l.Count - M); double C = 0; for (int i = 0; i < M; i++) { S += (yi[i].Count - 1) * Sxj[i]; if (yi[i].Count != 0) { C += 1.0 / yi[i].Count - 1.0 / gr1.l.Count; } } S /= gr1.l.Count - M; //C -= 1 / gr1.l.Count; C /= 3.0 * (M - 1); C++; for (int i = 0; i < M; i++) { if (Sxj[i] != 0) { KriterBarkleta[0] += yi[i].Count * Math.Log(Sxj[i] / S); } } KriterBarkleta[0] /= -C; KriterBarkleta[1] = Hi.HIF(gr1.alf.Q, M - 1); return(rez); }
public UniformityCriteria(List <InitialStatisticalAnalys> ML, List <int> MSelectGR) { this.ML = ML; this.MSelectGR = MSelectGR; N = NFound(ML, MSelectGR); { double NezCount = ML[MSelectGR[0]].l.Count; for (int i = 0; i < MSelectGR.Count; i++) { if (ML[MSelectGR[i]].l.Count != NezCount) { Nezal = false; } } } rDvomFound(ML[MSelectGR[0]].unsortl); r = rFound(ML, MSelectGR); Sm2 = Sm2Found(ML, MSelectGR); Sv2 = Sv2Found(ML, MSelectGR); VarSv2Sm2[0] = Sm2 / Sv2; VarSv2Sm2[1] = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1, (int)(N - MSelectGR.Count)); var tyui = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, 10, 10); if (Nezal == true) { KrKohrena[0] = KrKohrenaFound(ML, MSelectGR); KrKohrena[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1); T = Distributions.StudentQuantile(1 - ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count - 2); } if (MSelectGR.Count == 2) { Doubl = true; if (Nezal == true) { SravnSred[1] = Distributions.StudentQuantile(ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count + ML[MSelectGR[1]].l.Count - 2); } else { SravnSred[1] = Distributions.StudentQuantile(ML[MSelectGR[0]].alf.Q / 2, ML[MSelectGR[0]].l.Count - 2); } SravnSred[0] = SimpleMx(ML[MSelectGR[0]], ML[MSelectGR[1]]); SravnDisper[0] = SimpleS(ML[MSelectGR[0]], ML[MSelectGR[1]]); SravnDisper[1] = Distributions.FisherQuantile(ML[MSelectGR[0]].alf.Q, ML[MSelectGR[0]].l.Count - 1, ML[MSelectGR[1]].l.Count - 1); KrSmirnKolmag[0] = 1.0 - LzFound(ZFound(ML[MSelectGR[0]], ML[MSelectGR[1]])); KrSmirnKolmag[1] = ML[MSelectGR[0]].alf.Q; KrsumRangVils[0] = KrsumRangVilsFound(r, ML[MSelectGR[0]], ML[MSelectGR[1]]); KrsumRangVils[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0); KrUMannaUit[0] = KrUMannaUitFound(ML[MSelectGR[0]], ML[MSelectGR[1]]); KrUMannaUit[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0); RizSerRangVib[0] = RizSerRangVibFound(r, ML[MSelectGR[0]], ML[MSelectGR[1]]); RizSerRangVib[1] = Distributions.NormalQuantile(1 - ML[MSelectGR[0]].alf.Q / 2.0); KrZnakiv[0] = KrZnakivFound(ML[MSelectGR[0]], ML[MSelectGR[1]]); } else { Doubl = false; SravnSred[0] = SimpleMx(ML, MSelectGR); SravnDisper[0] = SimpleS(ML, MSelectGR); SravnDisper[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1); KrKruskalaUolisa[0] = KrKruskalaUolisaFound(r, ML, MSelectGR); KrKruskalaUolisa[1] = Hi.HIF(ML[MSelectGR[0]].alf.Q, MSelectGR.Count - 1); } Round(); }