Advertisement
tomdodd4598

Untitled

Apr 22nd, 2021
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 KB | None | 0 0
  1. "MANIPULATE";
  2.  
  3. NString[v_] := ToString[ScientificForm[v], TraditionalForm];
  4. CIValue[f_, c_, n_, v_] := f @@ Transpose[c][[n]] /. x -> v;
  5. FitMean[f_, c_, v_] := NString[N[CIValue[f, c, 2, v]]];
  6. FitStatistic[f_, c_, v_] :=
  7. NString[N[CIValue[f, c, 2, v]]] <> "(+" <>
  8. NString[N[CIValue[f, c, 3, v] - CIValue[f, c, 2, v]]] <> ")(-" <>
  9. NString[N[CIValue[f, c, 2, v] - CIValue[f, c, 1, v]]] <> ")";
  10. FitInterval[f_, c_, v_] :=
  11. NString[{N[CIValue[f, c, 1, v]], N[CIValue[f, c, 2, v]],
  12. N[CIValue[f, c, 3, v]]}];
  13.  
  14. Manipulate[
  15. FitComparePlot[profitBeforeTaxFit["Linear"], linear,
  16. profitBeforeTaxCI["Linear", confidenceLevel], 0,
  17. endYear + Length[profitBeforeTaxData] - 1],
  18. Style["PROFIT BEFORE TAX LINEAR FIT PLOT", Bold,
  19. Medium], {{endYear, 5, "Forecast Distance"}, 0, 10, 1,
  20. Appearance -> "Labeled"}, {{confidenceLevel, 70,
  21. "Confidence Level"}, 50, 99, 1, Appearance -> "Labeled"},
  22. SaveDefinitions -> True]
  23.  
  24. Manipulate[
  25. "R^2 Value: " <>
  26. ToString[N[profitBeforeTaxFit["Linear"]["RSquared"]]] <> "\n" <>
  27. "Mean: " <>
  28. FitMean[linear, profitBeforeTaxCI["Linear", confidenceLevel],
  29. endYear + Length[profitBeforeTaxData] - 1] <> "\n" <>
  30. "Statistic: " <>
  31. FitStatistic[linear, profitBeforeTaxCI["Linear", confidenceLevel],
  32. endYear + Length[profitBeforeTaxData] - 1] <> "\n" <>
  33. "Interval: " <>
  34. FitInterval[linear, profitBeforeTaxCI["Linear", confidenceLevel],
  35. endYear + Length[profitBeforeTaxData] - 1],
  36. Style["PROFIT BEFORE TAX LINEAR FIT INFO", Bold,
  37. Medium], {{endYear, 5, "Forecast Distance"}, 0, 10, 1,
  38. Appearance -> "Labeled"}, {{confidenceLevel, 70,
  39. "Confidence Level"}, 50, 99, 1, Appearance -> "Labeled"},
  40. SaveDefinitions -> True]
  41.  
  42. Manipulate[
  43. FitComparePlot[profitBeforeTaxFit["Exponential"], exponential,
  44. profitBeforeTaxCI["Exponential", confidenceLevel], 0,
  45. endYear + Length[profitBeforeTaxData] - 1],
  46. Style["PROFIT BEFORE TAX EXPONENTIAL FIT PLOT", Bold,
  47. Medium], {{endYear, 5, "Forecast Distance"}, 0, 10, 1,
  48. Appearance -> "Labeled"}, {{confidenceLevel, 70,
  49. "Confidence Level"}, 50, 99, 1, Appearance -> "Labeled"},
  50. SaveDefinitions -> True]
  51.  
  52. Manipulate[
  53. "R^2 Value: " <>
  54. ToString[N[profitBeforeTaxFit["Exponential"]["RSquared"]]] <> "\n" <>
  55. "Mean: " <>
  56. FitMean[exponential,
  57. profitBeforeTaxCI["Exponential", confidenceLevel],
  58. endYear + Length[profitBeforeTaxData] - 1] <> "\n" <>
  59. "Statistic: " <>
  60. FitStatistic[exponential,
  61. profitBeforeTaxCI["Exponential", confidenceLevel],
  62. endYear + Length[profitBeforeTaxData] - 1] <> "\n" <>
  63. "Interval: " <>
  64. FitInterval[exponential,
  65. profitBeforeTaxCI["Exponential", confidenceLevel],
  66. endYear + Length[profitBeforeTaxData] - 1],
  67. Style["PROFIT BEFORE TAX EXPONENTIAL FIT INFO", Bold,
  68. Medium], {{endYear, 5, "Forecast Distance"}, 0, 10, 1,
  69. Appearance -> "Labeled"}, {{confidenceLevel, 70,
  70. "Confidence Level"}, 50, 99, 1, Appearance -> "Labeled"},
  71. SaveDefinitions -> True]
  72.  
  73. Manipulate[
  74. FitComparePlot[turnoverFit["Linear"], linear,
  75. turnoverCI["Linear", confidenceLevel], 0,
  76. endYear + Length[turnoverData] - 1],
  77. Style["TURNOVER LINEAR FIT PLOT", Bold,
  78. Medium], {{endYear, 5, "Forecast Distance"}, 0, 10, 1,
  79. Appearance -> "Labeled"}, {{confidenceLevel, 70,
  80. "Confidence Level"}, 50, 99, 1, Appearance -> "Labeled"},
  81. SaveDefinitions -> True]
  82.  
  83. Manipulate[
  84. "R^2 Value: " <> ToString[N[turnoverFit["Linear"]["RSquared"]]] <>
  85. "\n" <> "Mean: " <>
  86. FitMean[linear, turnoverCI["Linear", confidenceLevel],
  87. endYear + Length[profitBeforeTaxData] - 1] <> "\n" <>
  88. "Statistic: " <>
  89. FitStatistic[linear, turnoverCI["Linear", confidenceLevel],
  90. endYear + Length[profitBeforeTaxData] - 1] <> "\n" <>
  91. "Interval: " <>
  92. FitInterval[linear, turnoverCI["Linear", confidenceLevel],
  93. endYear + Length[turnoverData] - 1],
  94. Style["TURNOVER LINEAR FIT INFO", Bold,
  95. Medium], {{endYear, 5, "Forecast Distance"}, 0, 10, 1,
  96. Appearance -> "Labeled"}, {{confidenceLevel, 70,
  97. "Confidence Level"}, 50, 99, 1, Appearance -> "Labeled"},
  98. SaveDefinitions -> True]
  99.  
  100. Manipulate[
  101. FitComparePlot[turnoverFit["Exponential"], exponential,
  102. turnoverCI["Exponential", confidenceLevel], 0,
  103. endYear + Length[turnoverData] - 1],
  104. Style["TURNOVER EXPONENTIAL FIT PLOT", Bold,
  105. Medium], {{endYear, 5, "Forecast Distance"}, 0, 10, 1,
  106. Appearance -> "Labeled"}, {{confidenceLevel, 70,
  107. "Confidence Level"}, 50, 99, 1, Appearance -> "Labeled"},
  108. SaveDefinitions -> True]
  109.  
  110. Manipulate[
  111. "R^2 Value: " <>
  112. ToString[N[turnoverFit["Exponential"]["RSquared"]]] <> "\n" <>
  113. "Mean: " <>
  114. FitMean[exponential, turnoverCI["Exponential", confidenceLevel],
  115. endYear + Length[profitBeforeTaxData] - 1] <> "\n" <>
  116. "Statistic: " <>
  117. FitStatistic[exponential,
  118. turnoverCI["Exponential", confidenceLevel],
  119. endYear + Length[profitBeforeTaxData] - 1] <> "\n" <>
  120. "Interval: " <>
  121. FitInterval[exponential, turnoverCI["Exponential", confidenceLevel],
  122. endYear + Length[turnoverData] - 1],
  123. Style["TURNOVER EXPONENTIAL FIT INFO", Bold,
  124. Medium], {{endYear, 5, "Forecast Distance"}, 0, 10, 1,
  125. Appearance -> "Labeled"}, {{confidenceLevel, 70,
  126. "Confidence Level"}, 50, 99, 1, Appearance -> "Labeled"},
  127. SaveDefinitions -> True]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement