Файл: Анализ и оценка средств реализации структурных методов и проектирования экономической информационной системы.pdf

ВУЗ: Не указан

Категория: Курсовая работа

Дисциплина: Не указана

Добавлен: 25.04.2023

Просмотров: 691

Скачиваний: 2

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

2017

X1

1446960

1216882

1044917

950492

991760

1104982

995649

950947

990521

X2

814056

465041

643135

1284391

853825

426591

445704

543218

804533

X3

2105321

1533192

1467763

2005942

1635197

1270295

1184868

1321292

1531856

X4

92418

92418

89186

89042

97500

103686

107168

113578

104531

X5

63277

56313

130103

132388

112888

157592

149316

59296

158667

X6

2309390

2342607

2629496

2475244

2013565

1891381

1559686

1535110

1744527

X7

1053550

1121022

1361354

1198932

1132643

1188448

1120866

1092577

1216493

X8

711359

616652

571931

914640

597585

447258

185276

177225

250954

X9

705694

630541

575927

935177

628878

457639

197569

169885

264081

X10

589748

529870

484572

788178

529255

385097

164573

136423

210566

Y

0,97201

0,96652

0,922336

0,937403

0,938831

0,89710

0,89640

0,96031

0,91160

Приложение Б. UML-диаграммы

Рисунок Б.1. Диаграмма активности прецедента «Ввод данных»

Рисунок Б.2. Диаграмма активности прецедента «Просмотр данных»

Рисунок Б.3. Диаграмма активности прецедента «Выбор доп.функции»

Рисунок Б.4. Диаграмма активности прецедента «Выбор моделей»

Рисунок Б.5. Диаграмма активности прецедента «Ввод дополнительных данных»

Рисунок Б.6. Диаграмма последовательности прецедента «Ввод данных»

Рисунок Б.7.Диаграмма последовательности прецедента «Просмотр данных»

Рисунок Б.8.Диаграмма последовательности прецедента «Выбор доп.функции2

Рисунок Б.9. Диаграмма последовательности прецедента «Выбор модели»

Рисунок Б.10. Диаграмма последовательности прецедента «Ввод дополнительных данных»

Рисунок Б.11. Схема классов

Приложение В. Исходный код программы

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.IO;

using System.Data.OleDb;

using System.Data;

using MetroFramework.Components;

using MetroFramework.Forms;

using System.Windows;

namespace WebApplication1

{

public partial class Загрузка_данных : System.Web.UI.Page

{

public DataSet objDataset1 = new DataSet();

public DataSet objDataset2 = new DataSet();

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)

{

}

protected void Page_Load(object sender, EventArgs e)

{

}

protected void Button1_Click(object sender, EventArgs e)

{

if (FileUpload1.HasFile)

{

FileUpload1.PostedFile.SaveAs(Server.MapPath("~/App_Data/") + "FinCond_file");

}

// Create connection string variable. Modify the "Data Source"

// parameter as appropriate for your environment.

String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +

"Data Source=" + Server.MapPath("~/App_Data/FinCond_file") + ";" +

"Extended Properties=Excel 8.0;";

// Create connection object by using the preceding connection string.


OleDbConnection objConn = new OleDbConnection(sConnectionString);

// Open connection with the database.

objConn.Open();

// The code to follow uses a SQL SELECT command to display the data from the worksheet.

// Create new OleDbCommand to return data from worksheet.

OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM Данные", objConn);

OleDbCommand objCmdSelect2 = new OleDbCommand("SELECT * FROM Данные2", objConn);

// Create new OleDbDataAdapter that is used to build a DataSet

// based on the preceding SQL SELECT statement.

OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();

OleDbDataAdapter objAdapter2 = new OleDbDataAdapter();

// Pass the Select command to the adapter.

objAdapter1.SelectCommand = objCmdSelect;

objAdapter2.SelectCommand = objCmdSelect2;

// Create new DataSet to hold information from the worksheet.

// Fill the DataSet with the information from the worksheet.

objAdapter1.Fill(objDataset1, "XLData");

objAdapter2.Fill(objDataset2, "XLData2");

// Bind data to DataGrid control.

GridView1.DataSource = objDataset1.Tables[0].DefaultView;

GridView1.DataBind();

// Clean up objects.

objConn.Close();

Label2.Visible = true;

Label3.Visible = true;

Label4.Visible = true;

Label8.Text = "Для данных моделей необходимо ввести дополнительные данные за " + ((double)objDataset2.Tables["XLData2"].Rows[0][0] - 1).ToString();

Econometric_model ec = new Econometric_model();

WebApplication1.Controllers.Class1 cl = new WebApplication1.Controllers.Class1();

cl.Save_data(objDataset2);

double SUR = Math.Round(ec.SUR_data(objDataset1, objDataset2), 4);

double REG = Math.Round(ec.Regres_data(objDataset2), 4);

Label lb = new Label();

lb.Text = "Я ТУТ";

this.Controls.Add(lb);

Label2.Text = "Значение прогноза коэффициента финансовой стабильности:";

Label3.Text = "по SUR-модели: " + SUR.ToString() + " или " + (SUR * 100).ToString() + "%";

Label4.Text = "по регрессионной модели: " + REG.ToString() + " или " + (REG * 100).ToString() + "%";

Button2.Visible = true;

}

protected void LinkButton1_Click(object sender, EventArgs e)

{

}

protected void MultiView1_ActiveViewChanged(object sender, EventArgs e)

{

}

protected void HiddenField1_ValueChanged(object sender, EventArgs e)

{

}

protected void Button2_Click(object sender, EventArgs e)

{

CheckBoxList1.Visible = true;

Label5.Visible = true;

Econometric_model ec = new Econometric_model();

WebApplication1.Controllers.Class1 cl = new WebApplication1.Controllers.Class1();

DataSet my_data = cl.Return_data();

Label6.Visible = false;

Label7.Visible = false;

Label14.Visible = false;

Label15.Visible = false;

TextBox1.Visible = false;

TextBox2.Visible = false;

TextBox3.Visible = false;

TextBox4.Visible = false;

if (CheckBoxList1.Items[0].Selected == true)

{

Label8.Visible = true;

Label6.Visible = true;

Label6.Text = "Нераспределенная прибыль";

TextBox1.Visible = true;

if (TextBox1.Text!="")

{

double pr=Convert.ToDouble(TextBox1.Text);

Label9.Text = "По Лису: " + ec.Lis(my_data, pr);

Label9.Visible = true;

Label13.Visible = true;

}

}

if (CheckBoxList1.Items[1].Selected == true)

{

Label8.Visible = true;

if (CheckBoxList1.Items[0].Selected != true)

{

Label6.Visible = true;

Label6.Text = "Текущие обязательства";

TextBox1.Visible = true;

if (TextBox1.Text != "")

{

double tek = Convert.ToDouble(TextBox1.Text);

Label9.Text = "По Спрингейту: " + ec.Sprin(my_data, tek);

Label9.Visible = true;

Label13.Visible = true;

}

}

else

{

Label7.Visible = true;

Label7.Text = "Текущие обязательства";


TextBox2.Visible = true;

if (TextBox2.Text != "")

{

double tek = Convert.ToDouble(TextBox2.Text);

Label10.Text = "По Спрингейту: " + ec.Sprin(my_data, tek);

Label10.Visible = true;

Label13.Visible = true;

}

}

}

if (CheckBoxList1.Items[2].Selected == true)

{

Label8.Visible = true;

if (CheckBoxList1.Items[1].Selected != true)

{

if (CheckBoxList1.Items[0].Selected != true)

{

Label6.Visible = true;

Label6.Text = "Средняя стоимость активов";

TextBox1.Visible = true;

Label7.Visible = true;

Label7.Text = "Затраты компании";

TextBox2.Visible = true;

if (TextBox1.Text != "" && TextBox2.Text != "")

{

double act = Convert.ToDouble(TextBox1.Text);

double zat = Convert.ToDouble(TextBox2.Text);

Label9.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label9.Visible = true;

Label13.Visible = true;

}

}

else

{

Label7.Visible = true;

Label7.Text = "Средняя стоимость активов";

TextBox2.Visible = true;

Label14.Visible = true;

Label14.Text = "Затраты компании";

TextBox3.Visible = true;

if (TextBox2.Text != "" && TextBox3.Text != "")

{

double act = Convert.ToDouble(TextBox2.Text);

double zat = Convert.ToDouble(TextBox3.Text);

Label10.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label10.Visible = true;

Label13.Visible = true;

}

}

}

else

{

if (CheckBoxList1.Items[0].Selected != true)

{

Label7.Visible = true;

Label7.Text = "Средняя стоимость активов";

TextBox2.Visible = true;

Label14.Visible = true;

Label14.Text = "Затраты компании";

TextBox3.Visible = true;

if (TextBox2.Text != "" && TextBox3.Text != "")

{

double act = Convert.ToDouble(TextBox2.Text);

double zat = Convert.ToDouble(TextBox3.Text);

Label11.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label10.Visible = true;

Label13.Visible = true;

}

}

else

{

Label14.Visible = true;

Label14.Text = "Средняя стоимость активов";

TextBox3.Visible = true;

Label15.Visible = true;

Label15.Text = "Затраты компании";

TextBox4.Visible = true;

if (TextBox3.Text != "" && TextBox4.Text != "")

{

double act = Convert.ToDouble(TextBox3.Text);

double zat = Convert.ToDouble(TextBox4.Text);

Label11.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label11.Visible = true;

Label13.Visible = true;

}

}

}

}

if (CheckBoxList1.Items[3].Selected == true)

{

Label8.Visible = true;

if (CheckBoxList1.Items[2].Selected != true)

{

if (CheckBoxList1.Items[1].Selected != true)

{

if (CheckBoxList1.Items[0].Selected != true)

{

Label6.Visible = true;

Label6.Text = "Средняя стоимость активов";

TextBox1.Visible = true;

Label7.Visible = true;

Label7.Text = "Текущие обязательства";

TextBox2.Visible = true;

if (TextBox1.Text != "" && TextBox2.Text != "")

{

double act = Convert.ToDouble(TextBox1.Text);

double zat = Convert.ToDouble(TextBox2.Text);

Label9.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label9.Visible = true;

Label13.Visible = true;

}

}

else

{

Label7.Visible = true;

Label7.Text = "Средняя стоимость активов";

TextBox2.Visible = true;

Label14.Visible = true;

Label14.Text = "Текущие обязательства";

TextBox3.Visible = true;

if (TextBox2.Text != "" && TextBox3.Text != "")

{

double act = Convert.ToDouble(TextBox2.Text);

double zat = Convert.ToDouble(TextBox3.Text);

Label10.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label10.Visible = true;


Label13.Visible = true;

}

}

}

else

{

if (CheckBoxList1.Items[0].Selected != true)

{

Label7.Visible = true;

Label7.Text = "Средняя стоимость активов";

TextBox2.Visible = true;

if (TextBox2.Text != "" && TextBox1.Text != "")

{

double act = Convert.ToDouble(TextBox2.Text);

double zat = Convert.ToDouble(TextBox1.Text);

Label10.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label10.Visible = true;

Label13.Visible = true;

}

}

else

{

Label14.Visible = true;

Label14.Text = "Средняя стоимость активов";

TextBox3.Visible = true;

if (TextBox3.Text != "" && TextBox2.Text != "")

{

double act = Convert.ToDouble(TextBox3.Text);

double zat = Convert.ToDouble(TextBox2.Text);

Label11.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label11.Visible = true;

Label13.Visible = true;

}

}

}

}

else

{

if (CheckBoxList1.Items[1].Selected != true)

{

if (CheckBoxList1.Items[0].Selected != true)

{

Label14.Visible = true;

Label14.Text = "Текущие обязательства";

TextBox3.Visible = true;

if (TextBox1.Text != "" && TextBox3.Text != "")

{

double act = Convert.ToDouble(TextBox1.Text);

double zat = Convert.ToDouble(TextBox3.Text);

Label10.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label13.Visible = true;

}

}

else

{

Label15.Visible = true;

Label15.Text = "Текущие обязательства";

TextBox4.Visible = true;

if (TextBox2.Text != "" && TextBox4.Text != "")

{

double act = Convert.ToDouble(TextBox2.Text);

double zat = Convert.ToDouble(TextBox4.Text);

Label11.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label11.Visible = true;

Label13.Visible = true;

}

}

}

else

{

if (CheckBoxList1.Items[0].Selected != true)

{

if (TextBox1.Text != "" && TextBox2.Text != "")

{

double act = Convert.ToDouble(TextBox2.Text);

double zat = Convert.ToDouble(TextBox1.Text);

Label11.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label11.Visible = true;

Label13.Visible = true;

}

}

else

{

if (TextBox2.Text != "" && TextBox3.Text != "")

{

double act = Convert.ToDouble(TextBox3.Text);

double zat = Convert.ToDouble(TextBox2.Text);

Label12.Text="По Сайфулина-Кадыкова:"+ec.Say(my_data,act,zat);

Label12.Visible = true;

Label13.Visible = true;

}

}

}

}

}

}

}

}

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Data;

namespace WebApplication1

{

public class Econometric_model

{

double[] Zh_y = new double[8] { 0.03037293, 0.004508092, 0.012287257, 0.014187398, 0.014491574, -0.076430333, -0.069947505, 0.004129624 };

double[] Tr_y = new double[8] { 0.388894539, 0.468095538, 0.439915323, 0.616140321, 0.418361232, 0.359315784, 0.38452303, 0.399975509 };

double [,] Zh_x = new double [8, 3] { { 1, 2989, 95422 }, { 1, 849, 187479 }, { 1, 2913, 241075 }, { 1, 4167, 300523 }, { 1, 3195, 327039 }, { 1, -25463, 356588 }, { 1, -25389, 386235 }, { 1, 1572, 413577 } };

double[,] Tr_x = new double [8, 5] { { 1, 3232, 801, -22617, 1689 }, { 1, 5091, 800, -49382, 5092 }, { 1, 9883, 1000, -39331, 3430 }, { 1, 13305, 6224, -24388, 2439 }, { 1, 11843, 4579, -42729, 1471 }, { 1, 12667, 99, -42514, 1086 }, { 1, 11706, 700, -46679, 2384 }, { 1, 14908, 700, -34238, 36 } };

double[] Zh_uhat_full = new double[8] { 0.007175, -0.007661, -0.003023, -0.001617, 0.002891, -0.003684, 0.004145, 0.001774 };

double[] Tr_uhat_full = new double[8] { -0.00411, 0.02496, -0.02875, 0.006275, - 0.006795, -0.005897, -0.00892, 0.02324 };

double[] Beta = new double[12] { 0.985599, 2.02E-08, -6.71E-07, 1.94E-08, 0.0195856, 2.89E-06, -5.26E-08, 0.380329, 1.11E-05, 1.42E-05, 5.27E-06, 5.01E-05 };


public double SUR_data(DataSet data, DataSet prog)

{

int count = data.Tables["XLData"].Rows.Count;

double[] y = new double[count];

double[] y_raschet = new double[count];

double [,] x = new double [count, 4];

double[] uhat = new double[count];

for (int i = 0; i < count; i++)

x[i, 0] = 1;

for (int i = 0; i < count; i++)

{

y[i] = (double)data.Tables["XLData"].Rows[i][11];

x[i, 1] = (double)data.Tables["XLData"].Rows[i][2];

x[i, 2] = (double)data.Tables["XLData"].Rows[i][5];

x[i, 3] = (double)data.Tables["XLData"].Rows[i][10];

y_raschet[i] = 0.985599 + x[i, 1] * 2.02E-08 - 6.71E-07 * x[i, 2] + 1.94E-08 * x[i, 3];

uhat[i] = y[i] - y_raschet[i];

}

double [] result=Matrix(y, x, count, uhat);

double x2 = (double)prog.Tables["XLData2"].Rows[0][2];

double x5 = (double)prog.Tables["XLData2"].Rows[0][5];

double x10 = (double)prog.Tables["XLData2"].Rows[0][10];

double res = result[0] + x2 * result[1] + result[2] * x5 + result[3] * x10;

return res;

}

public double Regres_data(DataSet data)

{

double x1 = (double)data.Tables["XLData2"].Rows[0][1];

double x3 = (double)data.Tables["XLData2"].Rows[0][3];

double x5 = (double)data.Tables["XLData2"].Rows[0][5];

double res = 0.987 - 2.57E-08 * x1 + 3.06E-08 * x3 - 6.51E-07 * x5;

return res;

}

public double[] Matrix(double[] y, double [,] x, int count, double[] uhat)

{

double[] Sur_y = new double[count * 3];

double [,] Sur_x = new double [count * 3, 12];

double[] Zh_uhat = uhat_correct(Zh_uhat_full, count);

double[] Tr_uhat = uhat_correct(Tr_uhat_full, count);

for (int i = 0; i < Sur_y.Length; i++)

{

if (i < count) Sur_y[i] = y[i];

else if (i < count * 2) Sur_y[i] = Zh_y[i-count];

else Sur_y[i] = Tr_y[i-count*2];

}

for (int i = 0; i < Sur_y.Length; i++)

for (int j = 0; j < 12; j++)

{

if (i < count)

{

if (j < 4) Sur_x[i, j] = x[i, j];

else Sur_x[i, j] = 0;

}

else if (i < count * 2)

{

if (j < 4) Sur_x[i, j] = 0;

else if (j < 7) Sur_x[i, j] = Zh_x[i-count, j-4];

else Sur_x[i, j] = 0;

}

else

{

if (j < 7) Sur_x[i, j] = 0;

else Sur_x[i, j] = Tr_x[i-count*2, j-7];

}

}

double[,] cov = new double[3, 3] { { Cov(uhat, uhat), Cov(uhat, Zh_uhat), Cov(uhat, Tr_uhat) }, { Cov(Zh_uhat, uhat), Cov(Zh_uhat, Zh_uhat), Cov(Zh_uhat, Tr_uhat) }, { Cov(Tr_uhat, uhat), Cov(Tr_uhat, Zh_uhat), Cov(Tr_uhat, Tr_uhat) } };

double[,] inverse_cov = inverse_matrix(cov);

double[,] one_matr = new double[count, count];

for (int i = 0; i < count; i++)

for (int j = 0; j < count; j++)

if (i == j) one_matr[i, j] = 1;

else one_matr[i, j] = 0;

double[,] kroneker = Kroneker(count, inverse_cov, one_matr);

double[,] Sur_x_trans = Transp(Sur_x, count);

double[,] first = Multipl(Sur_x_trans, kroneker);

double[,] second = Multipl(first, Sur_x);

double[,] third = inverse_matrix(second);

double[,] fourth = Multipl(third, Sur_x_trans);

double[,] fifth = Multipl(fourth, kroneker);

double[] resultmatrix = Multipl_1(fifth, Sur_y);

return resultmatrix;

}

public double Cov(double[] arr1, double[] arr2)

{

double x_y = 0;

double x = 0;

double y = 0;

for (int i = 0; i < arr1.Length; i++)

x_y += arr1[i] * arr2[i];

x_y = x_y / arr1.Length;

for (int i = 0; i < arr1.Length; i++)

x += arr1[i];

x = x / arr1.Length;

for (int i = 0; i < arr2.Length; i++)

y += arr2[i];

y = y / arr2.Length;

double cov = x_y - x * y;

return cov;

}

public double[] uhat_correct(double[] arr, int count)

{

double[] temp = new double[count];

for (int i = 0; i < count; i++)

temp[i] = arr[i];

return temp;

}

public double[,] Kroneker(int count, double[,] inverse_cov, double[,] one_matr)

{

double[,] kroneker = new double[count * 3, count * 3];

int str = 0;

int stl = 0;

int kroneker_icount = count;

int kroneker_jcount = count;