From 9324c279749c004066f42bd84f8e5b0e467a4629 Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Tue, 31 Jul 2018 10:16:59 +0300 Subject: [PATCH 1/8] Adding Initial code --- instat/dlgModelling.Designer.vb | 128 +-- instat/dlgModelling.resx | 1347 ++++++++++++++++--------------- instat/dlgModelling.vb | 120 ++- 3 files changed, 858 insertions(+), 737 deletions(-) diff --git a/instat/dlgModelling.Designer.vb b/instat/dlgModelling.Designer.vb index ce168383274..e7af4fc2f7b 100644 --- a/instat/dlgModelling.Designer.vb +++ b/instat/dlgModelling.Designer.vb @@ -23,11 +23,7 @@ Partial Class dlgModelling _ Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(dlgModelling)) - Me.ucrBase = New instat.ucrButtons() - Me.ucrSelectorModelling = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrInputComboRPackage = New instat.ucrInputComboBox() Me.lblTest = New System.Windows.Forms.Label() - Me.ucrReceiverForTestColumn = New instat.ucrReceiverExpression() Me.cmdspline = New System.Windows.Forms.Button() Me.cmdarima = New System.Windows.Forms.Button() Me.cmdloglin = New System.Windows.Forms.Button() @@ -50,8 +46,6 @@ Partial Class dlgModelling Me.cmdZero = New System.Windows.Forms.Button() Me.cmdMinus = New System.Windows.Forms.Button() Me.grpFirstCalc = New System.Windows.Forms.GroupBox() - Me.ucrSaveResult = New instat.ucrSave() - Me.ucrInputTryMessage = New instat.ucrInputTextBox() Me.cmdTry = New System.Windows.Forms.Button() Me.cmdDisplayOptions = New System.Windows.Forms.Button() Me.cmdPredict = New System.Windows.Forms.Button() @@ -68,10 +62,16 @@ Partial Class dlgModelling Me.cmdglmnb = New System.Windows.Forms.Button() Me.cmdrlm = New System.Windows.Forms.Button() Me.grpMASS = New System.Windows.Forms.GroupBox() - Me.ucrReceiverMultiple = New instat.ucrReceiverMultiple() Me.cmdHelp = New System.Windows.Forms.Button() Me.lblRpackage = New System.Windows.Forms.Label() Me.ucrChkIncludeArguments = New instat.ucrCheck() + Me.ucrReceiverMultiple = New instat.ucrReceiverMultiple() + Me.ucrSaveResult = New instat.ucrSave() + Me.ucrInputTryMessage = New instat.ucrInputTextBox() + Me.ucrInputComboRPackage = New instat.ucrInputComboBox() + Me.ucrReceiverForTestColumn = New instat.ucrReceiverExpression() + Me.ucrSelectorModelling = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrBase = New instat.ucrButtons() Me.grpStats.SuspendLayout() Me.grpFirstCalc.SuspendLayout() Me.grpextRemes.SuspendLayout() @@ -79,41 +79,12 @@ Partial Class dlgModelling Me.grpMASS.SuspendLayout() Me.SuspendLayout() ' - 'ucrBase - ' - resources.ApplyResources(Me.ucrBase, "ucrBase") - Me.ucrBase.Name = "ucrBase" - ' - 'ucrSelectorModelling - ' - Me.ucrSelectorModelling.bDropUnusedFilterLevels = False - Me.ucrSelectorModelling.bShowHiddenColumns = False - Me.ucrSelectorModelling.bUseCurrentFilter = True - resources.ApplyResources(Me.ucrSelectorModelling, "ucrSelectorModelling") - Me.ucrSelectorModelling.Name = "ucrSelectorModelling" - ' - 'ucrInputComboRPackage - ' - Me.ucrInputComboRPackage.AddQuotesIfUnrecognised = True - Me.ucrInputComboRPackage.IsReadOnly = False - resources.ApplyResources(Me.ucrInputComboRPackage, "ucrInputComboRPackage") - Me.ucrInputComboRPackage.Name = "ucrInputComboRPackage" - ' 'lblTest ' resources.ApplyResources(Me.lblTest, "lblTest") Me.lblTest.Name = "lblTest" Me.lblTest.Tag = "Test" ' - 'ucrReceiverForTestColumn - ' - Me.ucrReceiverForTestColumn.frmParent = Me - resources.ApplyResources(Me.ucrReceiverForTestColumn, "ucrReceiverForTestColumn") - Me.ucrReceiverForTestColumn.Name = "ucrReceiverForTestColumn" - Me.ucrReceiverForTestColumn.Selector = Nothing - Me.ucrReceiverForTestColumn.strNcFilePath = "" - Me.ucrReceiverForTestColumn.ucrSelector = Nothing - ' 'cmdspline ' resources.ApplyResources(Me.cmdspline, "cmdspline") @@ -176,9 +147,9 @@ Partial Class dlgModelling Me.grpStats.Controls.Add(Me.cmdloess) Me.grpStats.Controls.Add(Me.cmdlowess) Me.grpStats.Controls.Add(Me.cmdglm) - Me.grpStats.Controls.Add(Me.cmdar) - Me.grpStats.Controls.Add(Me.cmdaov) Me.grpStats.Controls.Add(Me.cmdlm) + Me.grpStats.Controls.Add(Me.cmdaov) + Me.grpStats.Controls.Add(Me.cmdar) resources.ApplyResources(Me.grpStats, "grpStats") Me.grpStats.Name = "grpStats" Me.grpStats.TabStop = False @@ -266,19 +237,6 @@ Partial Class dlgModelling Me.grpFirstCalc.Name = "grpFirstCalc" Me.grpFirstCalc.TabStop = False ' - 'ucrSaveResult - ' - resources.ApplyResources(Me.ucrSaveResult, "ucrSaveResult") - Me.ucrSaveResult.Name = "ucrSaveResult" - ' - 'ucrInputTryMessage - ' - Me.ucrInputTryMessage.AddQuotesIfUnrecognised = True - Me.ucrInputTryMessage.IsMultiline = False - Me.ucrInputTryMessage.IsReadOnly = True - resources.ApplyResources(Me.ucrInputTryMessage, "ucrInputTryMessage") - Me.ucrInputTryMessage.Name = "ucrInputTryMessage" - ' 'cmdTry ' resources.ApplyResources(Me.cmdTry, "cmdTry") @@ -337,7 +295,6 @@ Partial Class dlgModelling ' 'grplme4 ' - Me.grplme4.Controls.Add(Me.grpextRemes) Me.grplme4.Controls.Add(Me.cmdlmer) Me.grplme4.Controls.Add(Me.cmdglmer) Me.grplme4.Controls.Add(Me.cmdnlmer) @@ -377,7 +334,6 @@ Partial Class dlgModelling ' 'grpMASS ' - Me.grpMASS.Controls.Add(Me.grplme4) Me.grpMASS.Controls.Add(Me.cmdpolr) Me.grpMASS.Controls.Add(Me.cmdglmmPQL) Me.grpMASS.Controls.Add(Me.cmdglmnb) @@ -387,15 +343,6 @@ Partial Class dlgModelling Me.grpMASS.Name = "grpMASS" Me.grpMASS.TabStop = False ' - 'ucrReceiverMultiple - ' - Me.ucrReceiverMultiple.frmParent = Me - resources.ApplyResources(Me.ucrReceiverMultiple, "ucrReceiverMultiple") - Me.ucrReceiverMultiple.Name = "ucrReceiverMultiple" - Me.ucrReceiverMultiple.Selector = Nothing - Me.ucrReceiverMultiple.strNcFilePath = "" - Me.ucrReceiverMultiple.ucrSelector = Nothing - ' 'cmdHelp ' resources.ApplyResources(Me.cmdHelp, "cmdHelp") @@ -413,16 +360,69 @@ Partial Class dlgModelling resources.ApplyResources(Me.ucrChkIncludeArguments, "ucrChkIncludeArguments") Me.ucrChkIncludeArguments.Name = "ucrChkIncludeArguments" ' + 'ucrReceiverMultiple + ' + Me.ucrReceiverMultiple.frmParent = Me + resources.ApplyResources(Me.ucrReceiverMultiple, "ucrReceiverMultiple") + Me.ucrReceiverMultiple.Name = "ucrReceiverMultiple" + Me.ucrReceiverMultiple.Selector = Nothing + Me.ucrReceiverMultiple.strNcFilePath = "" + Me.ucrReceiverMultiple.ucrSelector = Nothing + ' + 'ucrSaveResult + ' + resources.ApplyResources(Me.ucrSaveResult, "ucrSaveResult") + Me.ucrSaveResult.Name = "ucrSaveResult" + ' + 'ucrInputTryMessage + ' + Me.ucrInputTryMessage.AddQuotesIfUnrecognised = True + Me.ucrInputTryMessage.IsMultiline = False + Me.ucrInputTryMessage.IsReadOnly = True + resources.ApplyResources(Me.ucrInputTryMessage, "ucrInputTryMessage") + Me.ucrInputTryMessage.Name = "ucrInputTryMessage" + ' + 'ucrInputComboRPackage + ' + Me.ucrInputComboRPackage.AddQuotesIfUnrecognised = True + Me.ucrInputComboRPackage.IsReadOnly = False + resources.ApplyResources(Me.ucrInputComboRPackage, "ucrInputComboRPackage") + Me.ucrInputComboRPackage.Name = "ucrInputComboRPackage" + ' + 'ucrReceiverForTestColumn + ' + Me.ucrReceiverForTestColumn.frmParent = Me + resources.ApplyResources(Me.ucrReceiverForTestColumn, "ucrReceiverForTestColumn") + Me.ucrReceiverForTestColumn.Name = "ucrReceiverForTestColumn" + Me.ucrReceiverForTestColumn.Selector = Nothing + Me.ucrReceiverForTestColumn.strNcFilePath = "" + Me.ucrReceiverForTestColumn.ucrSelector = Nothing + ' + 'ucrSelectorModelling + ' + Me.ucrSelectorModelling.bDropUnusedFilterLevels = False + Me.ucrSelectorModelling.bShowHiddenColumns = False + Me.ucrSelectorModelling.bUseCurrentFilter = True + resources.ApplyResources(Me.ucrSelectorModelling, "ucrSelectorModelling") + Me.ucrSelectorModelling.Name = "ucrSelectorModelling" + ' + 'ucrBase + ' + resources.ApplyResources(Me.ucrBase, "ucrBase") + Me.ucrBase.Name = "ucrBase" + ' 'dlgModelling ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.grplme4) + Me.Controls.Add(Me.grpextRemes) + Me.Controls.Add(Me.grpStats) + Me.Controls.Add(Me.grpMASS) Me.Controls.Add(Me.ucrChkIncludeArguments) Me.Controls.Add(Me.lblRpackage) Me.Controls.Add(Me.cmdHelp) Me.Controls.Add(Me.ucrReceiverMultiple) - Me.Controls.Add(Me.grpStats) - Me.Controls.Add(Me.grpMASS) Me.Controls.Add(Me.cmdDisplayOptions) Me.Controls.Add(Me.cmdPredict) Me.Controls.Add(Me.ucrSaveResult) diff --git a/instat/dlgModelling.resx b/instat/dlgModelling.resx index 26093acba04..efe9f595866 100644 --- a/instat/dlgModelling.resx +++ b/instat/dlgModelling.resx @@ -117,81 +117,15 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 24, 393 - - - 410, 52 - - - 0 - - - ucrBase - - - instat.ucrButtons, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 16 - - - 9, 66 - - - - 0, 0, 0, 0 - - - 210, 180 - - - 1 - - - ucrSelectorModelling - - - instat.ucrSelectorByDataFrameAddRemove, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 15 - - - 311, 39 - - - 123, 21 - - - 8 - - - ucrInputComboRPackage - - - instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 12 - True + NoControl + 13, 17 @@ -217,115 +151,7 @@ $this - 13 - - - True - - - 6, 13 - - - 582, 452 - - - 442, 13 - - - 131, 20 - - - 24 - - - ucrChkIncludeArguments - - - instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 0 - - - True - - - 242, 43 - - - 63, 13 - - - 23 - - - R package: - - - lblRpackage - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - - - NoControl - - - 473, 181 - - - 75, 23 - - - 22 - - - Help - - - cmdHelp - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - - - 293, 220 - - - 0, 0, 0, 0 - - - 113, 100 - - - 21 - - - ucrReceiverMultiple - - - instat.ucrReceiverMultiple, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 3 + 15 NoControl @@ -535,7 +361,7 @@ grpStats - 6 + 8 NoControl @@ -595,10 +421,10 @@ grpStats - 8 + 6 - 332, 66 + 301, 66 2, 3, 2, 3 @@ -625,391 +451,388 @@ $this - 4 + 2 - + NoControl - - 5, 14 + + 67, 10 - + 2, 3, 2, 3 - - 69, 30 + + 29, 30 - - 169 + + 2 - - fevd + + * - - cmdfevd + + cmdMultiply - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpextRemes + + grpFirstCalc - + 0 - + NoControl - - 73, 14 + + 37, 10 - + 2, 3, 2, 3 - - 77, 30 + + 29, 30 - - 129 + + 1 - - levd + + : - - cmdlevd + + cmdColon - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpextRemes + + grpFirstCalc - + 1 - - 0, 2 - - - 155, 51 + + NoControl - - 18 + + 7, 10 - - extRemes + + 2, 3, 2, 3 - - grpextRemes + + 29, 30 - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 0 - - grplme4 + + + - - 0 + + cmdPlus - + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpFirstCalc + + + 2 + + NoControl - - 73, 14 + + 97, 41 - + 2, 3, 2, 3 - - 69, 30 + + 29, 32 - - 126 + + 7 - - lmer + + ^ - - cmdlmer + + cmdPower - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grplme4 + + grpFirstCalc - - 1 + + 3 - + NoControl - - 4, 14 + + 67, 41 - + 2, 3, 2, 3 - - 69, 30 + + 29, 32 - - 124 + + 6 - - glmer + + ) - - cmdglmer + + cmdClosingBracket - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grplme4 + + grpFirstCalc - - 2 + + 4 - + NoControl - - 142, 14 + + 37, 41 - + 2, 3, 2, 3 - - 69, 30 + + 29, 32 - - 153 + + 5 - - nlmer + + ( - - cmdnlmer + + cmdOpeningBracket - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grplme4 + + grpFirstCalc - - 3 + + 5 - - 1, -2 + + NoControl - - 2, 3, 2, 3 + + 97, 10 - + 2, 3, 2, 3 - - 216, 53 + + 29, 30 - - 19 + + 3 - - lme4 + + / - - grplme4 + + cmdDiv - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpMASS + + grpFirstCalc - - 0 + + 6 - + NoControl - - 4, 44 + + 7, 41 - + 2, 3, 2, 3 - - 69, 30 + + 29, 32 - - 158 + + 4 - - polr + + ( ) - - cmdpolr + + cmdDoubleBracket - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpMASS + + grpFirstCalc - - 1 + + 7 - + NoControl - - 73, 14 + + 67, 74 - + 2, 3, 2, 3 - - 69, 30 + + 60, 30 - - 126 + + 10 - - glmmPQL + + Clear - - cmdglmmPQL + + cmdClear - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpMASS + + grpFirstCalc - - 2 + + 8 - + NoControl - - 3, 14 + + 37, 74 - + 2, 3, 2, 3 - - 69, 30 + + 29, 30 - - 124 + + 9 - - glm.nb + + [ ] - - cmdglmnb + + cmdZero - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpMASS + + grpFirstCalc - - 3 + + 9 - + NoControl - - 73, 44 + + 7, 74 - + 2, 3, 2, 3 - - 69, 30 + + 29, 30 - - 121 + + 8 - - rlm + + - - - cmdrlm + + cmdMinus - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpMASS - - - 4 - - - NoControl - - - 142, 12 + + grpFirstCalc - - 2, 3, 2, 3 + + 10 - - 69, 30 + + 416, 209 - - 153 + + 131, 111 - - loglm + + 10 - - cmdloglm + + grpFirstCalc - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpMASS + + $this - - 5 + + 13 - - 331, 66 + + NoControl - - 2, 3, 2, 3 + + 11, 331 - + 2, 3, 2, 3 - - 216, 109 + + 74, 23 - - 20 + + 13 - - MASS + + Try - - grpMASS + + cmdTry - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 5 + + 12 NoControl @@ -1036,7 +859,7 @@ $this - 6 + 8 NoControl @@ -1063,445 +886,544 @@ $this - 7 + 9 - - 9, 363 + + NoControl - - 277, 24 + + 5, 14 - - 15 + + 2, 3, 2, 3 - - ucrSaveResult + + 69, 30 - - instat.ucrSave, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + 169 - - $this + + fevd - - 8 + + cmdfevd - - 88, 332 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 2, 3, 2, 3 + + grpextRemes - - 321, 22 + + 0 - - 14 + + NoControl - - ucrInputTryMessage + + 73, 14 - - instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + 2, 3, 2, 3 - - $this + + 77, 30 - - 9 + + 129 - - NoControl + + levd - - 11, 331 + + cmdlevd - - 2, 3, 2, 3 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 74, 23 + + grpextRemes - - 13 + + 1 - - Try + + 306, 66 - - cmdTry + + 155, 51 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 18 - + + extRemes + + + grpextRemes + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + $this - - 10 + + 1 - + NoControl - - 67, 10 + + 142, 14 - + 2, 3, 2, 3 - - 29, 30 + + 69, 30 - - 2 + + 153 - - * + + nlmer - - cmdMultiply + + cmdnlmer - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + grplme4 - - 0 + + 2 - + NoControl - - 37, 10 + + 73, 14 - + 2, 3, 2, 3 - - 29, 30 + + 69, 30 - - 1 + + 126 - - : + + lmer - - cmdColon + + cmdlmer - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + grplme4 - - 1 + + 0 - + NoControl - - 7, 10 + + 4, 14 - + 2, 3, 2, 3 - - 29, 30 + + 69, 30 - - 0 + + 124 - - + + + glmer - - cmdPlus + + cmdglmer - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + grplme4 - - 2 + + 1 - - NoControl + + 293, 66 - - 97, 41 + + 2, 3, 2, 3 - + 2, 3, 2, 3 - - 29, 32 + + 216, 53 - - 7 + + 19 - - ^ + + lme4 - - cmdPower + + grplme4 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + $this - - 3 + + 0 - + NoControl - - 67, 41 + + 142, 12 - + 2, 3, 2, 3 - - 29, 32 + + 69, 30 - - 6 + + 153 - - ) + + loglm - - cmdClosingBracket + + cmdloglm - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + grpMASS - + 4 - + NoControl - - 37, 41 + + 4, 44 - + 2, 3, 2, 3 - - 29, 32 + + 69, 30 - - 5 + + 158 - - ( + + polr - - cmdOpeningBracket + + cmdpolr - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + grpMASS - - 5 + + 0 - + NoControl - - 97, 10 + + 73, 14 - + 2, 3, 2, 3 - - 29, 30 + + 69, 30 - - 3 + + 126 - - / + + glmmPQL - - cmdDiv + + cmdglmmPQL - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + grpMASS - - 6 + + 1 - + NoControl - - 7, 41 + + 3, 14 - + 2, 3, 2, 3 - - 29, 32 + + 69, 30 - - 4 + + 124 - - ( ) + + glm.nb - - cmdDoubleBracket + + cmdglmnb - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + grpMASS - - 7 + + 2 - + NoControl - - 67, 74 - - + + 73, 44 + + 2, 3, 2, 3 - - 60, 30 + + 69, 30 - - 10 + + 121 - - Clear + + rlm - - cmdClear + + cmdrlm - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + grpMASS - - 8 + + 3 - - NoControl + + 296, 66 - - 37, 74 + + 2, 3, 2, 3 - + 2, 3, 2, 3 - - 29, 30 + + 216, 109 - - 9 + + 20 - - [ ] + + MASS - - cmdZero + + grpMASS - + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + NoControl + + + 473, 181 + + + 75, 23 + + + 22 + + + Help + + + cmdHelp + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - grpFirstCalc + + $this - - 9 + + 6 - + + True + + NoControl - - 7, 74 + + 242, 43 - - 2, 3, 2, 3 + + 63, 13 - - 29, 30 + + 23 - - 8 + + R package: - - - + + lblRpackage - - cmdMinus + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + $this - - grpFirstCalc + + 5 - - 10 + + 442, 13 - - 416, 209 + + 131, 20 - - 131, 111 + + 24 - + + ucrChkIncludeArguments + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 4 + + + True + + + 6, 13 + + + 582, 452 + + + 9, 363 + + + 277, 24 + + + 15 + + + ucrSaveResult + + + instat.ucrSave, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + 10 - - grpFirstCalc + + 88, 332 - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 2, 3, 2, 3 - + + 321, 22 + + + 14 + + + ucrInputTryMessage + + + instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + $this - + 11 - - CenterScreen + + 311, 39 - - Modelling + + 123, 21 - - dlgModelling + + 8 - - System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ucrInputComboRPackage + + + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 14 44, 13 @@ -1525,6 +1447,87 @@ $this - 14 + 16 + + + 9, 66 + + + 0, 0, 0, 0 + + + 210, 180 + + + 1 + + + ucrSelectorModelling + + + instat.ucrSelectorByDataFrameAddRemove, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 17 + + + 24, 393 + + + 410, 52 + + + 0 + + + ucrBase + + + instat.ucrButtons, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 18 + + + CenterScreen + + + Modelling + + + dlgModelling + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 293, 220 + + + 0, 0, 0, 0 + + + 113, 100 + + + 21 + + + ucrReceiverMultiple + + + instat.ucrReceiverMultiple, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 7 \ No newline at end of file diff --git a/instat/dlgModelling.vb b/instat/dlgModelling.vb index a7046bb6074..cb68f2b2d04 100644 --- a/instat/dlgModelling.vb +++ b/instat/dlgModelling.vb @@ -1,3 +1,121 @@ -Public Class dlgModelling +' R- Instat +' Copyright (C) 2015-2017 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program. If not, see . +Imports instat.Translations +Imports RDotNet + +Public Class dlgModelling + Public bFirstLoad As Boolean = True + Private bReset As Boolean = True + Private strPackageName As String + + Private Sub dlgModelling_Load(sender As Object, e As EventArgs) Handles Me.Load + If bFirstLoad Then + InitialiseDialog() + SetDefaults() + bFirstLoad = False + End If + TestOkEnabled() + SetRCodeForControls(bReset) + bReset = False + autoTranslate(Me) + End Sub + + Private Sub InitialiseDialog() + ucrReceiverForTestColumn.Selector = ucrSelectorModelling + ucrReceiverMultiple.Selector = ucrSelectorModelling + 'ucrReceiverForTestColumn.SetMeAsReceiver() + ucrChkIncludeArguments.SetText("Include Arguments") + ucrBase.clsRsyntax.SetCommandString("") + ucrSaveResult.SetPrefix("Model") + ucrSaveResult.SetIsComboBox() + ucrSaveResult.SetSaveTypeAsModel() + ucrSaveResult.SetCheckBoxText("Save Model") + ucrSaveResult.SetAssignToIfUncheckedValue("Last_Model") + ucrSaveResult.SetDataFrameSelector(ucrSelectorModelling.ucrAvailableDataFrames) + + ucrInputComboRPackage.SetItems({"Stats", "extRemes", "lme4", "MASS"}) + ucrInputComboRPackage.SetDropDownStyleAsNonEditable() + + End Sub + + Private Sub SetDefaults() + ucrSelectorModelling.Reset() + ucrReceiverForTestColumn.SetMeAsReceiver() + ucrSaveResult.Reset() + ucrSaveResult.ucrChkSave.Checked = False + ucrBase.clsRsyntax.SetAssignTo("Last_Model", strTempModel:="Last_Model", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem) + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False + ucrBase.clsRsyntax.iCallType = 2 + ucrChkIncludeArguments.Checked = False + ucrInputComboRPackage.SetName("Stats") + + End Sub + + Private Sub SetRCodeForControls(bReset) + + End Sub + + Private Sub TestOkEnabled() + If ucrSaveResult.IsComplete AndAlso Not ucrReceiverForTestColumn.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + End Sub + + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + SetRCodeForControls(True) + TestOkEnabled() + End Sub + + Private Sub ucrInputComboRPackage_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputComboRPackage.ControlValueChanged + Select Case ucrInputComboRPackage.GetText + Case "Stats" + strPackageName = "stat" + grpStats.Visible = True + grpextRemes.Visible = False + grplme4.Visible = False + grpMASS.Visible = False + + Case "extRemes" + strPackageName = "extRemes" + grpStats.Visible = False + grpextRemes.Visible = True + grplme4.Visible = False + grpMASS.Visible = False + + Case "lme4" + strPackageName = "lme4" + grpStats.Visible = False + grpextRemes.Visible = False + grplme4.Visible = True + grpMASS.Visible = False + + Case "MASS" + strPackageName = "MASS" + grpStats.Visible = False + grpextRemes.Visible = False + grplme4.Visible = False + grpMASS.Visible = True + End Select + End Sub + + Private Sub ucrSaveResult_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlContentsChanged, ucrReceiverForTestColumn.ControlContentsChanged + TestOkEnabled() + End Sub End Class \ No newline at end of file From db6ffee5c299c4c702b5242e62326254eebea3ec Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Tue, 31 Jul 2018 15:00:36 +0300 Subject: [PATCH 2/8] More code additons and designer edits --- instat/dlgModelling.Designer.vb | 14 +- instat/dlgModelling.resx | 31 ++-- instat/dlgModelling.vb | 251 +++++++++++++++++++++++++++++++- 3 files changed, 274 insertions(+), 22 deletions(-) diff --git a/instat/dlgModelling.Designer.vb b/instat/dlgModelling.Designer.vb index e7af4fc2f7b..a5ac048a4c6 100644 --- a/instat/dlgModelling.Designer.vb +++ b/instat/dlgModelling.Designer.vb @@ -43,7 +43,7 @@ Partial Class dlgModelling Me.cmdDiv = New System.Windows.Forms.Button() Me.cmdDoubleBracket = New System.Windows.Forms.Button() Me.cmdClear = New System.Windows.Forms.Button() - Me.cmdZero = New System.Windows.Forms.Button() + Me.cmdSquareBrackets = New System.Windows.Forms.Button() Me.cmdMinus = New System.Windows.Forms.Button() Me.grpFirstCalc = New System.Windows.Forms.GroupBox() Me.cmdTry = New System.Windows.Forms.Button() @@ -208,11 +208,11 @@ Partial Class dlgModelling Me.cmdClear.Name = "cmdClear" Me.cmdClear.UseVisualStyleBackColor = True ' - 'cmdZero + 'cmdSquareBrackets ' - resources.ApplyResources(Me.cmdZero, "cmdZero") - Me.cmdZero.Name = "cmdZero" - Me.cmdZero.UseVisualStyleBackColor = True + resources.ApplyResources(Me.cmdSquareBrackets, "cmdSquareBrackets") + Me.cmdSquareBrackets.Name = "cmdSquareBrackets" + Me.cmdSquareBrackets.UseVisualStyleBackColor = True ' 'cmdMinus ' @@ -231,7 +231,7 @@ Partial Class dlgModelling Me.grpFirstCalc.Controls.Add(Me.cmdDiv) Me.grpFirstCalc.Controls.Add(Me.cmdDoubleBracket) Me.grpFirstCalc.Controls.Add(Me.cmdClear) - Me.grpFirstCalc.Controls.Add(Me.cmdZero) + Me.grpFirstCalc.Controls.Add(Me.cmdSquareBrackets) Me.grpFirstCalc.Controls.Add(Me.cmdMinus) resources.ApplyResources(Me.grpFirstCalc, "grpFirstCalc") Me.grpFirstCalc.Name = "grpFirstCalc" @@ -473,7 +473,7 @@ Partial Class dlgModelling Friend WithEvents cmdDiv As Button Friend WithEvents cmdDoubleBracket As Button Friend WithEvents cmdClear As Button - Friend WithEvents cmdZero As Button + Friend WithEvents cmdSquareBrackets As Button Friend WithEvents cmdMinus As Button Friend WithEvents ucrSaveResult As ucrSave Friend WithEvents ucrInputTryMessage As ucrInputTextBox diff --git a/instat/dlgModelling.resx b/instat/dlgModelling.resx index efe9f595866..f9a83423779 100644 --- a/instat/dlgModelling.resx +++ b/instat/dlgModelling.resx @@ -424,7 +424,7 @@ 6 - 301, 66 + 291, 68 2, 3, 2, 3 @@ -723,34 +723,34 @@ 8 - + NoControl - + 37, 74 - + 2, 3, 2, 3 - + 29, 30 - + 9 - + [ ] - - cmdZero + + cmdSquareBrackets - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + grpFirstCalc - + 9 @@ -949,7 +949,7 @@ 1 - 306, 66 + 292, 68 155, 51 @@ -1096,7 +1096,7 @@ NoControl - 142, 12 + 142, 14 2, 3, 2, 3 @@ -1494,6 +1494,9 @@ 18 + + NoControl + CenterScreen diff --git a/instat/dlgModelling.vb b/instat/dlgModelling.vb index cb68f2b2d04..a0601729390 100644 --- a/instat/dlgModelling.vb +++ b/instat/dlgModelling.vb @@ -22,6 +22,8 @@ Public Class dlgModelling Private bReset As Boolean = True Private strPackageName As String + + Private Sub dlgModelling_Load(sender As Object, e As EventArgs) Handles Me.Load If bFirstLoad Then InitialiseDialog() @@ -37,7 +39,7 @@ Public Class dlgModelling Private Sub InitialiseDialog() ucrReceiverForTestColumn.Selector = ucrSelectorModelling ucrReceiverMultiple.Selector = ucrSelectorModelling - 'ucrReceiverForTestColumn.SetMeAsReceiver() + ucrReceiverForTestColumn.SetMeAsReceiver() ucrChkIncludeArguments.SetText("Include Arguments") ucrBase.clsRsyntax.SetCommandString("") ucrSaveResult.SetPrefix("Model") @@ -83,6 +85,252 @@ Public Class dlgModelling TestOkEnabled() End Sub + 'stats + Private Sub cmdaov_Click(sender As Object, e As EventArgs) Handles cmdaov.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov( )", 1) + End If + End Sub + + Private Sub cmdar_Click(sender As Object, e As EventArgs) Handles cmdar.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar( )", 1) + End If + End Sub + + Private Sub cmdarima_Click(sender As Object, e As EventArgs) Handles cmdarima.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima( )", 1) + End If + End Sub + + Private Sub cmdglm_Click(sender As Object, e As EventArgs) Handles cmdglm.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm( )", 1) + End If + End Sub + + Private Sub cmdlm_Click(sender As Object, e As EventArgs) Handles cmdlm.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm( )", 1) + End If + End Sub + + Private Sub cmdloess_Click(sender As Object, e As EventArgs) Handles cmdloess.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess( )", 1) + End If + End Sub + + Private Sub cmdlowess_Click(sender As Object, e As EventArgs) Handles cmdlowess.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess( )", 1) + End If + End Sub + + Private Sub cmdloglin_Click(sender As Object, e As EventArgs) Handles cmdloglin.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin( )", 1) + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin( )", 1) + End If + End Sub + + Private Sub cmdspline_Click(sender As Object, e As EventArgs) Handles cmdspline.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline( )", 1) + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline( )", 1) + End If + End Sub + + 'extRemes + Private Sub cmdfevd_Click(sender As Object, e As EventArgs) Handles cmdfevd.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd( )", 1) + End If + End Sub + + Private Sub cmdlevd_Click(sender As Object, e As EventArgs) Handles cmdlevd.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd( )", 1) + End If + End Sub + + 'lmer4 + Private Sub cmdglmer_Click(sender As Object, e As EventArgs) Handles cmdglmer.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer( )", 1) + End If + End Sub + + Private Sub cmdlmer_Click(sender As Object, e As EventArgs) Handles cmdlmer.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer( )", 1) + End If + End Sub + + Private Sub cmdnlmer_Click(sender As Object, e As EventArgs) Handles cmdnlmer.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer( )", 1) + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer( )", 1) + End If + End Sub + + 'MASS + Private Sub cmdglmmPQL_Click(sender As Object, e As EventArgs) Handles cmdglmmPQL.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmPQL( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmPQL( )", 1) + End If + End Sub + + Private Sub cmdglmnb_Click(sender As Object, e As EventArgs) Handles cmdglmnb.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb( )", 1) + End If + End Sub + + Private Sub cmdloglm_Click(sender As Object, e As EventArgs) Handles cmdloglm.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm( )", 1) + End If + End Sub + + Private Sub cmdpolr_Click(sender As Object, e As EventArgs) Handles cmdpolr.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr( )", 1) + End If + End Sub + + Private Sub cmdrlm_Click(sender As Object, e As EventArgs) Handles cmdrlm.Click + clear() + If ucrChkIncludeArguments.Checked Then + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm( )") + Else + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm( )", 1) + End If + End Sub + + 'FirstCalc + + Private Sub cmdMinus_Click(sender As Object, e As EventArgs) Handles cmdMinus.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("-") + End Sub + + Private Sub cmdMultiply_Click(sender As Object, e As EventArgs) Handles cmdMultiply.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("*") + End Sub + + Private Sub cmdOpeningBracket_Click(sender As Object, e As EventArgs) Handles cmdOpeningBracket.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("(") + End Sub + + Private Sub cmdPlus_Click(sender As Object, e As EventArgs) Handles cmdPlus.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("+") + End Sub + + Private Sub cmdPower_Click(sender As Object, e As EventArgs) Handles cmdPower.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("^") + End Sub + + Private Sub cmdDiv_Click(sender As Object, e As EventArgs) Handles cmdDiv.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("/") + End Sub + + Private Sub cmdDoubleBracket_Click(sender As Object, e As EventArgs) Handles cmdDoubleBracket.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("( )") + End Sub + + Private Sub cmdSquareBrackets_Click(sender As Object, e As EventArgs) Handles cmdSquareBrackets.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("[ ]") + End Sub + + Private Sub cmdClosingBracket_Click(sender As Object, e As EventArgs) Handles cmdClosingBracket.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition(")") + End Sub + + Private Sub cmdColon_Click(sender As Object, e As EventArgs) Handles cmdColon.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition(":") + End Sub + + Private Sub cmdClear_Click(sender As Object, e As EventArgs) Handles cmdClear.Click + ucrReceiverForTestColumn.Clear() + End Sub + + Private Sub cmdDisplayOptions_Click(sender As Object, e As EventArgs) Handles cmdDisplayOptions.Click + + End Sub + + Private Sub cmdPredict_Click(sender As Object, e As EventArgs) Handles cmdPredict.Click + + End Sub + + Private Sub cmdTry_Click(sender As Object, e As EventArgs) Handles cmdTry.Click + + End Sub + + Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click + Dim clsHelp As New RFunction + clsHelp.SetPackageName("utils") + clsHelp.SetRCommand("help") + clsHelp.AddParameter("package", Chr(34) & strPackageName & Chr(34)) + clsHelp.AddParameter("help_type", Chr(34) & "html" & Chr(34)) + frmMain.clsRLink.RunScript(clsHelp.ToScript, strComment:="Opening help page for" & " " & strPackageName & " " & "Package. Generated from dialog Hypothesis Tests", iCallType:=2, bSeparateThread:=False, bUpdateGrids:=False) + End Sub + + Private Sub clear() + ucrReceiverForTestColumn.Clear() + End Sub + Private Sub ucrInputComboRPackage_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputComboRPackage.ControlValueChanged Select Case ucrInputComboRPackage.GetText Case "Stats" @@ -118,4 +366,5 @@ Public Class dlgModelling Private Sub ucrSaveResult_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlContentsChanged, ucrReceiverForTestColumn.ControlContentsChanged TestOkEnabled() End Sub + End Class \ No newline at end of file From 769f5cf0014d75b54bc559295c1f5eb8b2bc8be0 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Mon, 17 Sep 2018 15:00:34 +0300 Subject: [PATCH 3/8] implementing tests --- instat/dlgModelling.Designer.vb | 8 +- instat/dlgModelling.resx | 112 ++++++++--------- instat/dlgModelling.vb | 205 +++++++++++++++++++++----------- 3 files changed, 197 insertions(+), 128 deletions(-) diff --git a/instat/dlgModelling.Designer.vb b/instat/dlgModelling.Designer.vb index a5ac048a4c6..b0966c55836 100644 --- a/instat/dlgModelling.Designer.vb +++ b/instat/dlgModelling.Designer.vb @@ -362,8 +362,8 @@ Partial Class dlgModelling ' 'ucrReceiverMultiple ' - Me.ucrReceiverMultiple.frmParent = Me resources.ApplyResources(Me.ucrReceiverMultiple, "ucrReceiverMultiple") + Me.ucrReceiverMultiple.frmParent = Me Me.ucrReceiverMultiple.Name = "ucrReceiverMultiple" Me.ucrReceiverMultiple.Selector = Nothing Me.ucrReceiverMultiple.strNcFilePath = "" @@ -415,10 +415,8 @@ Partial Class dlgModelling ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.Controls.Add(Me.grplme4) - Me.Controls.Add(Me.grpextRemes) Me.Controls.Add(Me.grpStats) - Me.Controls.Add(Me.grpMASS) + Me.Controls.Add(Me.grpextRemes) Me.Controls.Add(Me.ucrChkIncludeArguments) Me.Controls.Add(Me.lblRpackage) Me.Controls.Add(Me.cmdHelp) @@ -434,6 +432,8 @@ Partial Class dlgModelling Me.Controls.Add(Me.ucrReceiverForTestColumn) Me.Controls.Add(Me.ucrSelectorModelling) Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.grpMASS) + Me.Controls.Add(Me.grplme4) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False diff --git a/instat/dlgModelling.resx b/instat/dlgModelling.resx index f9a83423779..d01986db699 100644 --- a/instat/dlgModelling.resx +++ b/instat/dlgModelling.resx @@ -127,7 +127,7 @@ - 13, 17 + 10, 17 2, 0, 2, 0 @@ -151,13 +151,13 @@ $this - 15 + 13 NoControl - 142, 74 + 140, 72 2, 3, 2, 3 @@ -187,7 +187,7 @@ NoControl - 142, 14 + 140, 14 2, 3, 2, 3 @@ -217,7 +217,7 @@ NoControl - 4, 74 + 4, 72 2, 3, 2, 3 @@ -247,7 +247,7 @@ NoControl - 142, 44 + 140, 43 2, 3, 2, 3 @@ -277,7 +277,7 @@ NoControl - 73, 74 + 72, 72 2, 3, 2, 3 @@ -307,7 +307,7 @@ NoControl - 4, 44 + 4, 43 2, 3, 2, 3 @@ -337,7 +337,7 @@ NoControl - 73, 14 + 72, 14 2, 3, 2, 3 @@ -397,7 +397,7 @@ NoControl - 73, 44 + 72, 43 2, 3, 2, 3 @@ -433,13 +433,13 @@ 2, 3, 2, 3 - 216, 109 + 213, 107 9 - Stats + stats grpStats @@ -451,7 +451,7 @@ $this - 2 + 0 NoControl @@ -784,7 +784,7 @@ 10 - 416, 209 + 416, 205 131, 111 @@ -802,13 +802,13 @@ $this - 13 + 11 NoControl - 11, 331 + 10, 313 2, 3, 2, 3 @@ -832,13 +832,16 @@ $this - 12 + 10 + + + False NoControl - 426, 332 + 426, 320 105, 23 @@ -859,13 +862,16 @@ $this - 8 + 6 + + + False NoControl - 426, 361 + 426, 345 105, 23 @@ -886,7 +892,7 @@ $this - 9 + 7 NoControl @@ -952,7 +958,7 @@ 292, 68 - 155, 51 + 155, 53 18 @@ -1072,7 +1078,7 @@ 2, 3, 2, 3 - 216, 53 + 216, 55 19 @@ -1090,13 +1096,13 @@ $this - 0 + 18 NoControl - 142, 14 + 139, 14 2, 3, 2, 3 @@ -1126,7 +1132,7 @@ NoControl - 4, 44 + 3, 43 2, 3, 2, 3 @@ -1156,7 +1162,7 @@ NoControl - 73, 14 + 71, 14 2, 3, 2, 3 @@ -1216,7 +1222,7 @@ NoControl - 73, 44 + 71, 43 2, 3, 2, 3 @@ -1243,7 +1249,7 @@ 3 - 296, 66 + 296, 68 2, 3, 2, 3 @@ -1252,7 +1258,7 @@ 2, 3, 2, 3 - 216, 109 + 209, 82 20 @@ -1270,13 +1276,13 @@ $this - 3 + 17 NoControl - 473, 181 + 471, 178 75, 23 @@ -1297,7 +1303,7 @@ $this - 6 + 4 True @@ -1327,7 +1333,7 @@ $this - 5 + 3 442, 13 @@ -1348,7 +1354,10 @@ $this - 4 + 2 + + + False True @@ -1357,10 +1366,10 @@ 6, 13 - 582, 452 + 556, 427 - 9, 363 + 10, 341 277, 24 @@ -1378,10 +1387,10 @@ $this - 10 + 8 - 88, 332 + 88, 314 2, 3, 2, 3 @@ -1402,7 +1411,7 @@ $this - 11 + 9 311, 39 @@ -1423,10 +1432,10 @@ $this - 14 + 12 - 44, 13 + 41, 13 2, 3, 2, 3 @@ -1447,10 +1456,10 @@ $this - 16 + 14 - 9, 66 + 10, 66 0, 0, 0, 0 @@ -1471,10 +1480,10 @@ $this - 17 + 15 - 24, 393 + 10, 371 410, 52 @@ -1492,10 +1501,7 @@ $this - 18 - - - NoControl + 16 CenterScreen @@ -1510,13 +1516,13 @@ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 293, 220 + 293, 210 0, 0, 0, 0 - 113, 100 + 120, 100 21 @@ -1531,6 +1537,6 @@ $this - 7 + 5 \ No newline at end of file diff --git a/instat/dlgModelling.vb b/instat/dlgModelling.vb index a0601729390..4fd89ef4d39 100644 --- a/instat/dlgModelling.vb +++ b/instat/dlgModelling.vb @@ -16,14 +16,11 @@ Imports instat.Translations Imports RDotNet - Public Class dlgModelling Public bFirstLoad As Boolean = True Private bReset As Boolean = True Private strPackageName As String - - - + Private clsAttach, clsDetach As New RFunction Private Sub dlgModelling_Load(sender As Object, e As EventArgs) Handles Me.Load If bFirstLoad Then InitialiseDialog() @@ -42,16 +39,21 @@ Public Class dlgModelling ucrReceiverForTestColumn.SetMeAsReceiver() ucrChkIncludeArguments.SetText("Include Arguments") ucrBase.clsRsyntax.SetCommandString("") - ucrSaveResult.SetPrefix("Model") + ucrSaveResult.SetPrefix("model") ucrSaveResult.SetIsComboBox() ucrSaveResult.SetSaveTypeAsModel() ucrSaveResult.SetCheckBoxText("Save Model") - ucrSaveResult.SetAssignToIfUncheckedValue("Last_Model") + ucrSaveResult.SetAssignToIfUncheckedValue("last_model") ucrSaveResult.SetDataFrameSelector(ucrSelectorModelling.ucrAvailableDataFrames) - ucrInputComboRPackage.SetItems({"Stats", "extRemes", "lme4", "MASS"}) + ucrInputComboRPackage.SetItems({"stats", "extRemes", "lme4", "MASS"}) ucrInputComboRPackage.SetDropDownStyleAsNonEditable() + clsAttach.SetRCommand("attach") + clsDetach.SetRCommand("detach") + clsAttach.AddParameter("what", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame) + clsDetach.AddParameter("name", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame) + clsDetach.AddParameter("unload", "TRUE") End Sub Private Sub SetDefaults() @@ -59,16 +61,11 @@ Public Class dlgModelling ucrReceiverForTestColumn.SetMeAsReceiver() ucrSaveResult.Reset() ucrSaveResult.ucrChkSave.Checked = False - ucrBase.clsRsyntax.SetAssignTo("Last_Model", strTempModel:="Last_Model", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem) + ucrBase.clsRsyntax.SetAssignTo("last_model", strTempModel:="last_model", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem) ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.clsRsyntax.iCallType = 2 ucrChkIncludeArguments.Checked = False - ucrInputComboRPackage.SetName("Stats") - - End Sub - - Private Sub SetRCodeForControls(bReset) - + ucrInputComboRPackage.SetName("stats") End Sub Private Sub TestOkEnabled() @@ -85,183 +82,177 @@ Public Class dlgModelling TestOkEnabled() End Sub - 'stats Private Sub cmdaov_Click(sender As Object, e As EventArgs) Handles cmdaov.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov(formula = , data = NULL, projections = FALSE, qr = TRUE, contrasts = NULL))", 64) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov()", 1) End If End Sub Private Sub cmdar_Click(sender As Object, e As EventArgs) Handles cmdar.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar()", 1) End If End Sub Private Sub cmdarima_Click(sender As Object, e As EventArgs) Handles cmdarima.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima()", 1) End If End Sub Private Sub cmdglm_Click(sender As Object, e As EventArgs) Handles cmdglm.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm()", 1) End If End Sub Private Sub cmdlm_Click(sender As Object, e As EventArgs) Handles cmdlm.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm()", 1) End If End Sub Private Sub cmdloess_Click(sender As Object, e As EventArgs) Handles cmdloess.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess()", 1) End If End Sub Private Sub cmdlowess_Click(sender As Object, e As EventArgs) Handles cmdlowess.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess()", 1) End If End Sub Private Sub cmdloglin_Click(sender As Object, e As EventArgs) Handles cmdloglin.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin()", 1) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin()", 1) End If End Sub Private Sub cmdspline_Click(sender As Object, e As EventArgs) Handles cmdspline.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline()", 1) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline()", 1) End If End Sub - 'extRemes Private Sub cmdfevd_Click(sender As Object, e As EventArgs) Handles cmdfevd.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd()", 1) End If End Sub Private Sub cmdlevd_Click(sender As Object, e As EventArgs) Handles cmdlevd.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd()", 1) End If End Sub - 'lmer4 Private Sub cmdglmer_Click(sender As Object, e As EventArgs) Handles cmdglmer.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer()", 1) End If End Sub Private Sub cmdlmer_Click(sender As Object, e As EventArgs) Handles cmdlmer.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer()", 1) End If End Sub Private Sub cmdnlmer_Click(sender As Object, e As EventArgs) Handles cmdnlmer.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer()", 1) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer()", 1) End If End Sub - 'MASS Private Sub cmdglmmPQL_Click(sender As Object, e As EventArgs) Handles cmdglmmPQL.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmPQL( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmPQL()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmPQL( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmPQL()", 1) End If End Sub Private Sub cmdglmnb_Click(sender As Object, e As EventArgs) Handles cmdglmnb.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb()", 1) End If End Sub Private Sub cmdloglm_Click(sender As Object, e As EventArgs) Handles cmdloglm.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm()", 1) End If End Sub Private Sub cmdpolr_Click(sender As Object, e As EventArgs) Handles cmdpolr.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr()", 1) End If End Sub Private Sub cmdrlm_Click(sender As Object, e As EventArgs) Handles cmdrlm.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm( )") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm()") Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm( )", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm()", 1) End If End Sub - 'FirstCalc - Private Sub cmdMinus_Click(sender As Object, e As EventArgs) Handles cmdMinus.Click ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("-") End Sub @@ -306,16 +297,8 @@ Public Class dlgModelling ucrReceiverForTestColumn.Clear() End Sub - Private Sub cmdDisplayOptions_Click(sender As Object, e As EventArgs) Handles cmdDisplayOptions.Click - - End Sub - - Private Sub cmdPredict_Click(sender As Object, e As EventArgs) Handles cmdPredict.Click - - End Sub - Private Sub cmdTry_Click(sender As Object, e As EventArgs) Handles cmdTry.Click - + TryScript() End Sub Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click @@ -324,7 +307,7 @@ Public Class dlgModelling clsHelp.SetRCommand("help") clsHelp.AddParameter("package", Chr(34) & strPackageName & Chr(34)) clsHelp.AddParameter("help_type", Chr(34) & "html" & Chr(34)) - frmMain.clsRLink.RunScript(clsHelp.ToScript, strComment:="Opening help page for" & " " & strPackageName & " " & "Package. Generated from dialog Hypothesis Tests", iCallType:=2, bSeparateThread:=False, bUpdateGrids:=False) + frmMain.clsRLink.RunScript(clsHelp.ToScript, strComment:="Opening help page for" & " " & strPackageName & " " & "Package. Generated from dialog Modelling", iCallType:=2, bSeparateThread:=False, bUpdateGrids:=False) End Sub Private Sub clear() @@ -333,8 +316,8 @@ Public Class dlgModelling Private Sub ucrInputComboRPackage_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputComboRPackage.ControlValueChanged Select Case ucrInputComboRPackage.GetText - Case "Stats" - strPackageName = "stat" + Case "stats" + strPackageName = "stats" grpStats.Visible = True grpextRemes.Visible = False grplme4.Visible = False @@ -363,8 +346,88 @@ Public Class dlgModelling End Select End Sub - Private Sub ucrSaveResult_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlContentsChanged, ucrReceiverForTestColumn.ControlContentsChanged + Private Sub SetRcodeForControls(bReset As Boolean) + ucrSaveResult.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) + End Sub + + Private Sub TryScript() + Dim strOutPut As String + Dim strAttach As String + Dim strDetach As String + Dim strTempScript As String = "" + Dim strVecOutput As CharacterVector + Dim bIsAssigned As Boolean + Dim bToBeAssigned As Boolean + Dim strAssignTo As String + Dim strAssignToColumn As String + Dim strAssignToDataFrame As String + + bIsAssigned = ucrBase.clsRsyntax.GetbIsAssigned() + bToBeAssigned = ucrBase.clsRsyntax.GetbToBeAssigned() + strAssignTo = ucrBase.clsRsyntax.GetstrAssignTo() + + strAssignToColumn = ucrBase.clsRsyntax.GetstrAssignToColumn() + strAssignToDataFrame = ucrBase.clsRsyntax.GetstrAssignToDataFrame() + + Try + If ucrReceiverForTestColumn.IsEmpty Then + ucrInputTryMessage.SetName("") + Else + 'get strScript here + strAttach = clsAttach.ToScript(strTempScript) + frmMain.clsRLink.RunInternalScript(strTempScript & strAttach, bSilent:=True) + ucrBase.clsRsyntax.RemoveAssignTo() + strOutPut = ucrBase.clsRsyntax.GetScript + strVecOutput = frmMain.clsRLink.RunInternalScriptGetOutput(strOutPut, bSilent:=True) + If strVecOutput IsNot Nothing Then + If strVecOutput.Length > 1 Then + ucrInputTryMessage.SetName(Mid(strVecOutput(0), 5) & "...") + Else + ucrInputTryMessage.SetName(Mid(strVecOutput(0), 5)) + End If + Else + ucrInputTryMessage.SetName("Command produced an error or no output to display.") + End If + End If + Catch ex As Exception + ucrInputTryMessage.SetName("Command produced an error. Modify input before running.") + Finally + strTempScript = "" + strDetach = clsDetach.ToScript(strTempScript) + frmMain.clsRLink.RunInternalScript(strTempScript & strDetach, bSilent:=True) + ucrBase.clsRsyntax.SetbIsAssigned(bIsAssigned) + ucrBase.clsRsyntax.SetbToBeAssigned(bToBeAssigned) + ucrBase.clsRsyntax.SetstrAssignTo(strAssignTo) + + ucrBase.clsRsyntax.SetstrAssignToColumn(strAssignToColumn) + ucrBase.clsRsyntax.SetstrAssignToDataFrame(strAssignToDataFrame) + End Try + End Sub + + Private Sub ucrReceiverForTestColumn_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverForTestColumn.SelectionChanged + ucrBase.clsRsyntax.SetCommandString(ucrReceiverForTestColumn.GetVariableNames(False)) + ucrInputTryMessage.SetName("") + cmdTry.Enabled = Not ucrReceiverForTestColumn.IsEmpty() TestOkEnabled() End Sub + Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk + Dim strScript As String = "" + Dim strFunc As String + clsAttach.AddParameter("what", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame) + strFunc = clsAttach.ToScript(strScript) + frmMain.clsRLink.RunScript(strScript & strFunc) + ucrBase.clsRsyntax.SetAssignTo(ucrSaveResult.GetText(), strTempModel:=ucrSaveResult.GetText(), strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem) + End Sub + + Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk + Dim strScript As String = "" + Dim strFunc As String + strFunc = clsDetach.ToScript(strScript) + frmMain.clsRLink.RunScript(strScript & strFunc) + End Sub + + Private Sub ucrSaveResult_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlContentsChanged, ucrReceiverForTestColumn.ControlContentsChanged + TestOkEnabled() + End Sub End Class \ No newline at end of file From 622a7f180136c98551263e81edbfa94cd854563d Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Sat, 22 Sep 2018 22:10:59 +0300 Subject: [PATCH 4/8] adding tests parameters and positions --- instat/dlgModelling.Designer.vb | 6 ++--- instat/dlgModelling.resx | 36 +++++++++++++------------- instat/dlgModelling.vb | 45 ++++++++++++++++++--------------- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/instat/dlgModelling.Designer.vb b/instat/dlgModelling.Designer.vb index b0966c55836..089d6e166cd 100644 --- a/instat/dlgModelling.Designer.vb +++ b/instat/dlgModelling.Designer.vb @@ -415,8 +415,9 @@ Partial Class dlgModelling ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.Controls.Add(Me.grpStats) + Me.Controls.Add(Me.grpMASS) Me.Controls.Add(Me.grpextRemes) + Me.Controls.Add(Me.grplme4) Me.Controls.Add(Me.ucrChkIncludeArguments) Me.Controls.Add(Me.lblRpackage) Me.Controls.Add(Me.cmdHelp) @@ -432,8 +433,7 @@ Partial Class dlgModelling Me.Controls.Add(Me.ucrReceiverForTestColumn) Me.Controls.Add(Me.ucrSelectorModelling) Me.Controls.Add(Me.ucrBase) - Me.Controls.Add(Me.grpMASS) - Me.Controls.Add(Me.grplme4) + Me.Controls.Add(Me.grpStats) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False diff --git a/instat/dlgModelling.resx b/instat/dlgModelling.resx index d01986db699..2083a6bc185 100644 --- a/instat/dlgModelling.resx +++ b/instat/dlgModelling.resx @@ -151,7 +151,7 @@ $this - 13 + 14 NoControl @@ -451,7 +451,7 @@ $this - 0 + 18 NoControl @@ -802,7 +802,7 @@ $this - 11 + 12 NoControl @@ -832,7 +832,7 @@ $this - 10 + 11 False @@ -862,7 +862,7 @@ $this - 6 + 7 False @@ -892,7 +892,7 @@ $this - 7 + 8 NoControl @@ -1096,7 +1096,7 @@ $this - 18 + 2 NoControl @@ -1276,7 +1276,7 @@ $this - 17 + 0 NoControl @@ -1303,7 +1303,7 @@ $this - 4 + 5 True @@ -1333,7 +1333,7 @@ $this - 3 + 4 442, 13 @@ -1354,7 +1354,7 @@ $this - 2 + 3 False @@ -1387,7 +1387,7 @@ $this - 8 + 9 88, 314 @@ -1411,7 +1411,7 @@ $this - 9 + 10 311, 39 @@ -1432,7 +1432,7 @@ $this - 12 + 13 41, 13 @@ -1456,7 +1456,7 @@ $this - 14 + 15 10, 66 @@ -1480,7 +1480,7 @@ $this - 15 + 16 10, 371 @@ -1501,7 +1501,7 @@ $this - 16 + 17 CenterScreen @@ -1537,6 +1537,6 @@ $this - 5 + 6 \ No newline at end of file diff --git a/instat/dlgModelling.vb b/instat/dlgModelling.vb index 4fd89ef4d39..bbf06aca589 100644 --- a/instat/dlgModelling.vb +++ b/instat/dlgModelling.vb @@ -85,7 +85,7 @@ Public Class dlgModelling Private Sub cmdaov_Click(sender As Object, e As EventArgs) Handles cmdaov.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov(formula = , data = NULL, projections = FALSE, qr = TRUE, contrasts = NULL))", 64) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov(formula = , data = NULL, projections = FALSE, qr = TRUE, contrasts = NULL)", 65) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov()", 1) End If @@ -94,7 +94,8 @@ Public Class dlgModelling Private Sub cmdar_Click(sender As Object, e As EventArgs) Handles cmdar.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar()") + + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar(x = , aic = TRUE, order.max = NULL, method = c(""yule-walker"", ""burg"", ""ols"", ""mle"", ""yw""), na.action, series)", 106) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar()", 1) End If @@ -103,7 +104,7 @@ Public Class dlgModelling Private Sub cmdarima_Click(sender As Object, e As EventArgs) Handles cmdarima.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima(x = , order = c(0L, 0L, 0L), seasonal = list(order = c(0L, 0L, 0L), period = NA), xreg = NULL, include.mean = TRUE, transform.pars = TRUE, fixed = NULL, init = NULL, method = c(""CSS-ML"", ""ML"", ""CSS""), n.cond,SSinit = c(""Gardner1980"", ""Rossignol2011""), optim.method = ""BFGS"", optim.control = list(), kappa = 1e6)", 308) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima()", 1) End If @@ -112,7 +113,7 @@ Public Class dlgModelling Private Sub cmdglm_Click(sender As Object, e As EventArgs) Handles cmdglm.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm(formula = , family = gaussian, data, weights, subset,na.action, start = NULL, etastart, mustart, offset, control = list(...), model = TRUE, method = ""glm.fit"" ,x = FALSE, y = TRUE, contrasts = NULL)", 188) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm()", 1) End If @@ -121,7 +122,7 @@ Public Class dlgModelling Private Sub cmdlm_Click(sender As Object, e As EventArgs) Handles cmdlm.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm(formula = , data, subset, weights, na.action,method = ""qr"", model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE, contrasts = NULL, offset)", 143) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm()", 1) End If @@ -130,7 +131,7 @@ Public Class dlgModelling Private Sub cmdloess_Click(sender As Object, e As EventArgs) Handles cmdloess.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess(formula = , data, weights, subset, na.action, model = FALSE,span = 0.75, enp.target, degree = 2,parametric = FALSE, drop.square = FALSE, normalize = TRUE,family = c(""gaussian"", ""symmetric""),method = c(""loess"", ""model.frame""), control = loess.control(...))", 246) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess()", 1) End If @@ -139,7 +140,7 @@ Public Class dlgModelling Private Sub cmdlowess_Click(sender As Object, e As EventArgs) Handles cmdlowess.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess(x = , y = NULL, f = 2/3, iter = 3, delta = 0.01 * diff(range(x)))", 61) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess()", 1) End If @@ -148,7 +149,7 @@ Public Class dlgModelling Private Sub cmdloglin_Click(sender As Object, e As EventArgs) Handles cmdloglin.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin(table = , margin, start = rep(1, length(table)), fit = FALSE, eps = 0.1, iter = 20, param = FALSE, print = TRUE)", 104) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin()", 1) End If @@ -157,7 +158,7 @@ Public Class dlgModelling Private Sub cmdspline_Click(sender As Object, e As EventArgs) Handles cmdspline.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline(x = , y = NULL, n = 3*length(x), method = ""fmm"",xmin = min(x), xmax = max(x), xout, ties = mean)", 92) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline()", 1) End If @@ -166,7 +167,7 @@ Public Class dlgModelling Private Sub cmdfevd_Click(sender As Object, e As EventArgs) Handles cmdfevd.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd(x = , data, threshold = NULL, threshold.fun = ~1, location.fun = ~1, scale.fun = ~1, shape.fun = ~1, use.phi = FALSE, type = c(""GEV"", ""GP"", ""PP"", ""Gumbel"", ""Exponential""), method = c(""MLE"", ""GMLE"", ""Bayesian"", ""Lmoments""), initial = NULL, span, units = NULL, time.units = ""days"", period.basis = ""year"", na.action = na.fail, optim.args = NULL, priorFun = NULL, priorParams = NULL, proposalFun = NULL, proposalParams = NULL, iter = 9999, weights = 1, blocks = NULL, verbose = FALSE)", 476) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd()", 1) End If @@ -175,7 +176,7 @@ Public Class dlgModelling Private Sub cmdlevd_Click(sender As Object, e As EventArgs) Handles cmdlevd.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd(x = , threshold, location, scale, shape, type = c(""GEV"", ""GP"", ""PP"", ""Gumbel"", ""Weibull"", ""Frechet"",""Exponential"", ""Beta"", ""Pareto""), log = TRUE, negative = TRUE, span, npy = 365.25, infval = Inf, weights = 1, blocks = NULL)", 220) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd()", 1) End If @@ -184,7 +185,7 @@ Public Class dlgModelling Private Sub cmdglmer_Click(sender As Object, e As EventArgs) Handles cmdglmer.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer(formula = , data = NULL, family = gaussian, control = glmerControl(), start = NULL, verbose = 0L, nAGQ = 1L, subset, weights, na.action, offset, contrasts = NULL, mustart, etastart, devFunOnly = FALSE)", 192) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer()", 1) End If @@ -193,7 +194,7 @@ Public Class dlgModelling Private Sub cmdlmer_Click(sender As Object, e As EventArgs) Handles cmdlmer.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer(formula = , data = NULL, REML = TRUE, control = lmerControl(), start = NULL, verbose = 0L, subset, weights, na.action, offset, contrasts = NULL, devFunOnly = FALSE)", 154) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer()", 1) End If @@ -202,7 +203,7 @@ Public Class dlgModelling Private Sub cmdnlmer_Click(sender As Object, e As EventArgs) Handles cmdnlmer.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer(formula = , data = NULL, control = nlmerControl(), start = NULL, verbose = 0L, nAGQ = 1L, subset, weights, na.action, offset, contrasts = NULL, devFunOnly = FALSE)", 153) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer()", 1) End If @@ -211,16 +212,16 @@ Public Class dlgModelling Private Sub cmdglmmPQL_Click(sender As Object, e As EventArgs) Handles cmdglmmPQL.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmPQL()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmmPQL(fixed = , random, family, data, correlation, weights,control, niter = 10, verbose = TRUE)", 82) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmPQL()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmmPQL()", 1) End If End Sub Private Sub cmdglmnb_Click(sender As Object, e As EventArgs) Handles cmdglmnb.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb(formula = , data, weights, subset, na.action,start = NULL, etastart, mustart,control = glm.control(...), method = ""glm.fit"",model = TRUE, x = FALSE, y = TRUE, contrasts = NULL, ...,init.theta, link = log)", 194) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb()", 1) End If @@ -229,7 +230,7 @@ Public Class dlgModelling Private Sub cmdloglm_Click(sender As Object, e As EventArgs) Handles cmdloglm.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm(formula = , data, subset, na.action)", 27) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm()", 1) End If @@ -238,7 +239,7 @@ Public Class dlgModelling Private Sub cmdpolr_Click(sender As Object, e As EventArgs) Handles cmdpolr.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr(formula = , data, weights, start, ..., subset, na.action,contrasts = NULL, Hess = FALSE, model = TRUE, method = c(""logistic"", ""probit"", ""loglog"", ""cloglog"", ""cauchit""))", 158) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr()", 1) End If @@ -247,7 +248,7 @@ Public Class dlgModelling Private Sub cmdrlm_Click(sender As Object, e As EventArgs) Handles cmdrlm.Click clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm()") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm(formula = , data, weights, ..., subset, na.action, method = c(""M"", ""MM"", ""model.frame""), wt.method = c(""inv.var"", ""case""), model = TRUE, x.ret = TRUE, y.ret = FALSE, contrasts = NULL)", 173) Else ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm()", 1) End If @@ -427,6 +428,10 @@ Public Class dlgModelling frmMain.clsRLink.RunScript(strScript & strFunc) End Sub + Private Sub ucrSelectorModelling_Load(sender As Object, e As EventArgs) Handles ucrSelectorModelling.Load + + End Sub + Private Sub ucrSaveResult_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlContentsChanged, ucrReceiverForTestColumn.ControlContentsChanged TestOkEnabled() End Sub From d95dd746088b9770a6d57275b6ba1c90cac82301 Mon Sep 17 00:00:00 2001 From: shadrack kibet Date: Sat, 22 Sep 2018 22:15:30 +0300 Subject: [PATCH 5/8] desiner fixes --- instat/dlgModelling.Designer.vb | 2 +- instat/dlgModelling.resx | 74 ++++++++++++++++----------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/instat/dlgModelling.Designer.vb b/instat/dlgModelling.Designer.vb index 089d6e166cd..6270221b44e 100644 --- a/instat/dlgModelling.Designer.vb +++ b/instat/dlgModelling.Designer.vb @@ -415,9 +415,9 @@ Partial Class dlgModelling ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.grplme4) Me.Controls.Add(Me.grpMASS) Me.Controls.Add(Me.grpextRemes) - Me.Controls.Add(Me.grplme4) Me.Controls.Add(Me.ucrChkIncludeArguments) Me.Controls.Add(Me.lblRpackage) Me.Controls.Add(Me.cmdHelp) diff --git a/instat/dlgModelling.resx b/instat/dlgModelling.resx index 2083a6bc185..e85f641e05b 100644 --- a/instat/dlgModelling.resx +++ b/instat/dlgModelling.resx @@ -136,7 +136,7 @@ 28, 13 - 6 + 0 Test @@ -424,7 +424,7 @@ 6 - 291, 68 + 292, 68 2, 3, 2, 3 @@ -457,7 +457,7 @@ NoControl - 67, 10 + 63, 10 2, 3, 2, 3 @@ -487,7 +487,7 @@ NoControl - 37, 10 + 35, 10 2, 3, 2, 3 @@ -547,7 +547,7 @@ NoControl - 97, 41 + 91, 39 2, 3, 2, 3 @@ -577,7 +577,7 @@ NoControl - 67, 41 + 63, 39 2, 3, 2, 3 @@ -607,7 +607,7 @@ NoControl - 37, 41 + 35, 39 2, 3, 2, 3 @@ -637,7 +637,7 @@ NoControl - 97, 10 + 91, 10 2, 3, 2, 3 @@ -667,7 +667,7 @@ NoControl - 7, 41 + 7, 39 2, 3, 2, 3 @@ -697,13 +697,13 @@ NoControl - 67, 74 + 63, 70 2, 3, 2, 3 - 60, 30 + 57, 30 10 @@ -727,7 +727,7 @@ NoControl - 37, 74 + 35, 70 2, 3, 2, 3 @@ -757,7 +757,7 @@ NoControl - 7, 74 + 7, 70 2, 3, 2, 3 @@ -787,7 +787,7 @@ 416, 205 - 131, 111 + 115, 105 10 @@ -817,7 +817,7 @@ 74, 23 - 13 + 9 Try @@ -847,7 +847,7 @@ 105, 23 - 17 + 11 Display Options @@ -877,7 +877,7 @@ 105, 23 - 16 + 12 Predict @@ -976,13 +976,13 @@ $this - 1 + 2 NoControl - 142, 14 + 140, 14 2, 3, 2, 3 @@ -1012,7 +1012,7 @@ NoControl - 73, 14 + 72, 14 2, 3, 2, 3 @@ -1069,7 +1069,7 @@ 1 - 293, 66 + 292, 68 2, 3, 2, 3 @@ -1078,10 +1078,10 @@ 2, 3, 2, 3 - 216, 55 + 213, 47 - 19 + 6 lme4 @@ -1096,7 +1096,7 @@ $this - 2 + 0 NoControl @@ -1249,7 +1249,7 @@ 3 - 296, 68 + 293, 68 2, 3, 2, 3 @@ -1258,7 +1258,7 @@ 2, 3, 2, 3 - 209, 82 + 209, 73 20 @@ -1276,7 +1276,7 @@ $this - 0 + 1 NoControl @@ -1288,7 +1288,7 @@ 75, 23 - 22 + 7 Help @@ -1318,7 +1318,7 @@ 63, 13 - 23 + 3 R package: @@ -1342,7 +1342,7 @@ 131, 20 - 24 + 2 ucrChkIncludeArguments @@ -1375,7 +1375,7 @@ 277, 24 - 15 + 13 ucrSaveResult @@ -1399,7 +1399,7 @@ 321, 22 - 14 + 10 ucrInputTryMessage @@ -1420,7 +1420,7 @@ 123, 21 - 8 + 4 ucrInputComboRPackage @@ -1444,7 +1444,7 @@ 390, 27 - 7 + 1 ucrReceiverForTestColumn @@ -1468,7 +1468,7 @@ 210, 180 - 1 + 5 ucrSelectorModelling @@ -1489,7 +1489,7 @@ 410, 52 - 0 + 14 ucrBase @@ -1525,7 +1525,7 @@ 120, 100 - 21 + 8 ucrReceiverMultiple From 390433af7fb3f246276031355870c8fa6bd3b2ae Mon Sep 17 00:00:00 2001 From: Lazarus Kioko Muthenya Date: Sat, 3 Nov 2018 11:47:47 +0300 Subject: [PATCH 6/8] Initial linkking ofmodelling dialog to the display subdialog --- instat/dlgModelling.resx | 103 ++++++++++++++++----------- instat/dlgModelling.vb | 147 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 207 insertions(+), 43 deletions(-) diff --git a/instat/dlgModelling.resx b/instat/dlgModelling.resx index e85f641e05b..f404785d808 100644 --- a/instat/dlgModelling.resx +++ b/instat/dlgModelling.resx @@ -457,7 +457,7 @@ NoControl - 63, 10 + 59, 10 2, 3, 2, 3 @@ -487,7 +487,7 @@ NoControl - 35, 10 + 31, 10 2, 3, 2, 3 @@ -517,7 +517,7 @@ NoControl - 7, 10 + 3, 10 2, 3, 2, 3 @@ -547,7 +547,7 @@ NoControl - 91, 39 + 87, 39 2, 3, 2, 3 @@ -577,7 +577,7 @@ NoControl - 63, 39 + 59, 39 2, 3, 2, 3 @@ -607,7 +607,7 @@ NoControl - 35, 39 + 31, 39 2, 3, 2, 3 @@ -637,7 +637,7 @@ NoControl - 91, 10 + 87, 10 2, 3, 2, 3 @@ -667,7 +667,7 @@ NoControl - 7, 39 + 3, 39 2, 3, 2, 3 @@ -697,7 +697,7 @@ NoControl - 63, 70 + 59, 70 2, 3, 2, 3 @@ -727,7 +727,7 @@ NoControl - 35, 70 + 31, 70 2, 3, 2, 3 @@ -757,7 +757,7 @@ NoControl - 7, 70 + 3, 70 2, 3, 2, 3 @@ -784,10 +784,10 @@ 10 - 416, 205 + 412, 205 - 115, 105 + 119, 103 10 @@ -834,9 +834,6 @@ 11 - - False - NoControl @@ -894,6 +891,54 @@ 8 + + cmdfevd + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpextRemes + + + 0 + + + cmdlevd + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpextRemes + + + 1 + + + 292, 68 + + + 155, 53 + + + 18 + + + extRemes + + + grpextRemes + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + NoControl @@ -954,30 +999,6 @@ 1 - - 292, 68 - - - 155, 53 - - - 18 - - - extRemes - - - grpextRemes - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - NoControl @@ -1516,7 +1537,7 @@ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 293, 210 + 289, 210 0, 0, 0, 0 diff --git a/instat/dlgModelling.vb b/instat/dlgModelling.vb index bbf06aca589..5d0bd5371f0 100644 --- a/instat/dlgModelling.vb +++ b/instat/dlgModelling.vb @@ -21,6 +21,26 @@ Public Class dlgModelling Private bReset As Boolean = True Private strPackageName As String Private clsAttach, clsDetach As New RFunction + + Public clsRModelFunction As RFunction + Public clsRYVariable, clsRXVariable As String + Public clsRLmOrGLM As RFunction + Public clsRGraphics As New RSyntax + Private clsRSyntax As New RSyntax + Private ucrAvailableDataframe As ucrDataFrame + Public clsRAovFunction, clsRAovPValFunction, clsREstPValFunction, clsAutoplot, clsRgeom_point, clsRPredFunction, clsRDFFunction, clsRFittedValues, clsRWriteFitted, clsRResiduals, clsRWriteResiduals, clsRStdResiduals, clsRWriteStdResiduals, clsRLeverage, clsRWriteLeverage As New RFunction + Public clsVisReg, clsRaesFunction, clsRStat_smooth, clsR_ribbon, clsRaes_ribbon As New RFunction + Public clsWhichFunction As RFunction + Public bRCodeSet As Boolean = True + + 'Display tab functions + Public clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As RFunction + Private clsFittedValuesFunction, clsResidualFunction, clsRstandardFunction, clsHatvaluesFunction As New RFunction + + Public clsGLM, clsLM, clsLMOrGLM As RFunction + + Private bResetDisplayOptions = False + Private Sub dlgModelling_Load(sender As Object, e As EventArgs) Handles Me.Load If bFirstLoad Then InitialiseDialog() @@ -28,7 +48,7 @@ Public Class dlgModelling bFirstLoad = False End If TestOkEnabled() - SetRCodeForControls(bReset) + SetRcodeForControls(bReset) bReset = False autoTranslate(Me) End Sub @@ -57,6 +77,33 @@ Public Class dlgModelling End Sub Private Sub SetDefaults() + clsFormulaFunction = New RFunction + clsRModelFunction = New RFunction + clsRAovFunction = New RFunction + clsRAovPValFunction = New RFunction + clsConfint = New RFunction + clsREstPValFunction = New RFunction + clsRFittedValues = New RFunction + clsRResiduals = New RFunction + clsRStdResiduals = New RFunction + clsRWriteResiduals = New RFunction + clsRWriteLeverage = New RFunction + clsRLeverage = New RFunction + clsRWriteStdResiduals = New RFunction + clsRWriteFitted = New RFunction + clsSummaryFunction = New RFunction + clsAnovaFunction = New RFunction + clsAutoplot = New RFunction + clsRgeom_point = New RFunction + clsVisReg = New RFunction + clsRstandardFunction = New RFunction + clsHatvaluesFunction = New RFunction + clsResidualFunction = New RFunction + clsFittedValuesFunction = New RFunction + + ucrBase.clsRsyntax.ClearCodes() + + ucrSelectorModelling.Reset() ucrReceiverForTestColumn.SetMeAsReceiver() ucrSaveResult.Reset() @@ -66,6 +113,91 @@ Public Class dlgModelling ucrBase.clsRsyntax.iCallType = 2 ucrChkIncludeArguments.Checked = False ucrInputComboRPackage.SetName("stats") + + 'Residual Plots + clsAutoplot = clsRegressionDefaults.clsDefaultAutoplot.Clone + clsAutoplot.bExcludeAssignedFunctionOutput = False + + clsRgeom_point = clsRegressionDefaults.clsDefaultRgeom_pointFunction.Clone + + clsRAovFunction.SetPackageName("stats") + clsRAovFunction.SetRCommand("anova") + clsRAovFunction.iCallType = 2 + + 'FitModel + clsVisReg.SetPackageName("visreg") + clsVisReg.SetRCommand("visreg") + clsVisReg.AddParameter("type", Chr(34) & "conditional" & Chr(34)) + clsVisReg.AddParameter("gg", "TRUE") + clsVisReg.iCallType = 3 + clsVisReg.bExcludeAssignedFunctionOutput = False + + 'Model + clsFormulaFunction = clsRegressionDefaults.clsDefaultFormulaFunction.Clone + clsFormulaFunction.iCallType = 2 + + 'Summary + clsSummaryFunction = clsRegressionDefaults.clsDefaultSummary.Clone + clsSummaryFunction.iCallType = 2 + + 'ANOVA + clsAnovaFunction = clsRegressionDefaults.clsDefaultAnovaFunction.Clone + clsAnovaFunction.iCallType = 2 + + 'Confidence Interval + clsConfint = clsRegressionDefaults.clsDefaultConfint.Clone + clsConfint.iCallType = 2 + + 'Anova +Pvalue + clsREstPValFunction = clsRegressionDefaults.clsDefaultRaovPValueFunction.Clone + clsREstPValFunction.AddParameter("", clsRFunctionParameter:=clsLMOrGLM) + ' clsRaovpvalFunction.AddParameter("", clsRFunctionParameter:=clsRLmOrGLM) + clsREstPValFunction.iCallType = 2 + + 'ucrSave (sdgSimpleRegOptions) Fitted Values + clsRWriteFitted = clsRegressionDefaults.clsDefaultAddColumnsToData.Clone + clsRWriteFitted.SetAssignTo(sdgSimpleRegOptions.ucrSaveFittedColumnName.GetText, strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=sdgSimpleRegOptions.ucrSaveFittedColumnName.GetText, bAssignToIsPrefix:=True) + ' clsRWriteFitted.iCallType = 3 + + 'ucrSave (sdgSimpleRegOptions) Residuals + clsRWriteResiduals = clsRegressionDefaults.clsDefaultAddColumnsToData.Clone + clsRWriteResiduals.SetAssignTo(sdgSimpleRegOptions.ucrSaveResidualsColumnName.GetText, strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=sdgSimpleRegOptions.ucrSaveResidualsColumnName.GetText, bAssignToIsPrefix:=True) + ' clsRWriteResiduals.iCallType = 3 + + 'ucrSave (sdgSimpleRegOptions) StdResiduals + clsRWriteStdResiduals = clsRegressionDefaults.clsDefaultAddColumnsToData.Clone + clsRWriteStdResiduals.SetAssignTo(sdgSimpleRegOptions.ucrSaveStdResidualsColumnName.GetText, strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=sdgSimpleRegOptions.ucrSaveStdResidualsColumnName.GetText, bAssignToIsPrefix:=True) + ' clsRWriteStdResiduals.iCallType = 3 + + 'ucrSave (sdgSimpleRegOptions) Leverage + clsRWriteLeverage = clsRegressionDefaults.clsDefaultAddColumnsToData.Clone + clsRWriteLeverage.SetAssignTo(sdgSimpleRegOptions.ucrSaveLeverageColumnName.GetText, strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=sdgSimpleRegOptions.ucrSaveLeverageColumnName.GetText, bAssignToIsPrefix:=True) + 'clsRWriteLeverage.iCallType = 3 + + + clsResidualFunction.SetRCommand("residuals") + + clsFittedValuesFunction.SetRCommand("fitted.values") + + clsRstandardFunction.SetRCommand("rstandard") + + clsHatvaluesFunction.SetRCommand("hatvalues") + + clsFormulaFunction.AddParameter("x", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + clsAnovaFunction.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + clsSummaryFunction.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + clsConfint.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + clsVisReg.AddParameter("fit", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + clsAutoplot.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + clsResidualFunction.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + clsFittedValuesFunction.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + clsRstandardFunction.AddParameter("model", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + clsHatvaluesFunction.AddParameter("model", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) + + ucrBase.clsRsyntax.AddToAfterCodes(clsAnovaFunction, 1) + ucrBase.clsRsyntax.AddToAfterCodes(clsSummaryFunction, 2) + + bResetDisplayOptions = True End Sub Private Sub TestOkEnabled() @@ -78,7 +210,7 @@ Public Class dlgModelling Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() - SetRCodeForControls(True) + SetRcodeForControls(True) TestOkEnabled() End Sub @@ -298,6 +430,13 @@ Public Class dlgModelling ucrReceiverForTestColumn.Clear() End Sub + Private Sub cmdDisplayOptions_Click(sender As Object, e As EventArgs) Handles cmdDisplayOptions.Click + sdgSimpleRegOptions.SetRCode(clsNewRSyntax:=ucrBase.clsRsyntax, clsNewFormulaFunction:=clsFormulaFunction, clsNewAnovaFunction:=clsAnovaFunction, clsNewRSummaryFunction:=clsSummaryFunction, clsNewConfint:=clsConfint, clsNewVisReg:=clsVisReg, clsNewAutoplot:=clsAutoplot, clsNewResidualFunction:=clsResidualFunction, clsNewFittedValuesRfunction:=clsFittedValuesFunction, clsNewRstandardFunction:=clsRstandardFunction, clsNewHatvaluesFunction:=clsHatvaluesFunction, ucrNewAvailableDatafrane:=ucrSelectorModelling.ucrAvailableDataFrames, bReset:=bResetDisplayOptions) + sdgSimpleRegOptions.ShowDialog() + GraphAssignTo() + bResetDisplayOptions = False + End Sub + Private Sub cmdTry_Click(sender As Object, e As EventArgs) Handles cmdTry.Click TryScript() End Sub @@ -432,6 +571,10 @@ Public Class dlgModelling End Sub + Private Sub GraphAssignTo() + clsVisReg.SetAssignTo("last_visreg", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_visreg") + clsAutoplot.SetAssignTo("last_autoplot", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_autoplot") + End Sub Private Sub ucrSaveResult_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlContentsChanged, ucrReceiverForTestColumn.ControlContentsChanged TestOkEnabled() End Sub From 19c0352fc19f323772615082ce2b90efb22682fd Mon Sep 17 00:00:00 2001 From: Danny Parsons Date: Sun, 4 Nov 2018 19:18:59 +0000 Subject: [PATCH 7/8] model dialog updates --- instat/clsRSyntax.vb | 6 +- instat/dlgModelling.Designer.vb | 12 --- instat/dlgModelling.resx | 177 ++++++++++++-------------------- instat/dlgModelling.vb | 167 ++++++++++++++++-------------- 4 files changed, 156 insertions(+), 206 deletions(-) diff --git a/instat/clsRSyntax.vb b/instat/clsRSyntax.vb index 24fbe1ec200..8162f726fc2 100644 --- a/instat/clsRSyntax.vb +++ b/instat/clsRSyntax.vb @@ -467,9 +467,9 @@ Public Class RSyntax Public Sub ClearCodes() lstBeforeCodes = New List(Of RCodeStructure) lstAfterCodes = New List(Of RCodeStructure) - clsBaseFunction = Nothing - clsBaseOperator = Nothing - clsBaseCommandString = Nothing + clsBaseFunction = New RFunction + clsBaseOperator = New ROperator + clsBaseCommandString = New RCodeStructure strCommandString = "" bUseBaseFunction = False bUseBaseOperator = False diff --git a/instat/dlgModelling.Designer.vb b/instat/dlgModelling.Designer.vb index 6270221b44e..18140dfa366 100644 --- a/instat/dlgModelling.Designer.vb +++ b/instat/dlgModelling.Designer.vb @@ -65,7 +65,6 @@ Partial Class dlgModelling Me.cmdHelp = New System.Windows.Forms.Button() Me.lblRpackage = New System.Windows.Forms.Label() Me.ucrChkIncludeArguments = New instat.ucrCheck() - Me.ucrReceiverMultiple = New instat.ucrReceiverMultiple() Me.ucrSaveResult = New instat.ucrSave() Me.ucrInputTryMessage = New instat.ucrInputTextBox() Me.ucrInputComboRPackage = New instat.ucrInputComboBox() @@ -360,15 +359,6 @@ Partial Class dlgModelling resources.ApplyResources(Me.ucrChkIncludeArguments, "ucrChkIncludeArguments") Me.ucrChkIncludeArguments.Name = "ucrChkIncludeArguments" ' - 'ucrReceiverMultiple - ' - resources.ApplyResources(Me.ucrReceiverMultiple, "ucrReceiverMultiple") - Me.ucrReceiverMultiple.frmParent = Me - Me.ucrReceiverMultiple.Name = "ucrReceiverMultiple" - Me.ucrReceiverMultiple.Selector = Nothing - Me.ucrReceiverMultiple.strNcFilePath = "" - Me.ucrReceiverMultiple.ucrSelector = Nothing - ' 'ucrSaveResult ' resources.ApplyResources(Me.ucrSaveResult, "ucrSaveResult") @@ -421,7 +411,6 @@ Partial Class dlgModelling Me.Controls.Add(Me.ucrChkIncludeArguments) Me.Controls.Add(Me.lblRpackage) Me.Controls.Add(Me.cmdHelp) - Me.Controls.Add(Me.ucrReceiverMultiple) Me.Controls.Add(Me.cmdDisplayOptions) Me.Controls.Add(Me.cmdPredict) Me.Controls.Add(Me.ucrSaveResult) @@ -493,7 +482,6 @@ Partial Class dlgModelling Friend WithEvents cmdglmmPQL As Button Friend WithEvents cmdglmnb As Button Friend WithEvents cmdrlm As Button - Friend WithEvents ucrReceiverMultiple As ucrReceiverMultiple Friend WithEvents cmdHelp As Button Friend WithEvents lblRpackage As Label Friend WithEvents ucrChkIncludeArguments As ucrCheck diff --git a/instat/dlgModelling.resx b/instat/dlgModelling.resx index f404785d808..f1bcb23a5bf 100644 --- a/instat/dlgModelling.resx +++ b/instat/dlgModelling.resx @@ -151,7 +151,7 @@ $this - 14 + 13 NoControl @@ -451,7 +451,7 @@ $this - 18 + 17 NoControl @@ -784,7 +784,7 @@ 10 - 412, 205 + 293, 181 119, 103 @@ -802,7 +802,7 @@ $this - 12 + 11 NoControl @@ -832,13 +832,13 @@ $this - 11 + 10 NoControl - 426, 320 + 426, 313 105, 23 @@ -859,7 +859,7 @@ $this - 7 + 6 False @@ -868,7 +868,7 @@ NoControl - 426, 345 + 426, 343 105, 23 @@ -889,55 +889,7 @@ $this - 8 - - - cmdfevd - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpextRemes - - - 0 - - - cmdlevd - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - grpextRemes - - - 1 - - - 292, 68 - - - 155, 53 - - - 18 - - - extRemes - - - grpextRemes - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 + 7 NoControl @@ -999,6 +951,30 @@ 1 + + 292, 68 + + + 155, 53 + + + 18 + + + extRemes + + + grpextRemes + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + NoControl @@ -1303,7 +1279,7 @@ NoControl - 471, 178 + 427, 191 75, 23 @@ -1333,7 +1309,7 @@ NoControl - 242, 43 + 292, 43 63, 13 @@ -1377,18 +1353,6 @@ 3 - - False - - - True - - - 6, 13 - - - 556, 427 - 10, 341 @@ -1408,7 +1372,7 @@ $this - 9 + 8 88, 314 @@ -1432,10 +1396,10 @@ $this - 10 + 9 - 311, 39 + 364, 39 123, 21 @@ -1453,31 +1417,16 @@ $this - 13 - - - 41, 13 - - - 2, 3, 2, 3 - - - 390, 27 - - - 1 - - - ucrReceiverForTestColumn - - - instat.ucrReceiverExpression, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + 12 - - $this + + True + + + 6, 13 - - 15 + + 556, 427 10, 66 @@ -1501,7 +1450,7 @@ $this - 16 + 15 10, 371 @@ -1522,7 +1471,7 @@ $this - 17 + 16 CenterScreen @@ -1536,28 +1485,28 @@ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 289, 210 + + 41, 13 - - 0, 0, 0, 0 + + 2, 3, 2, 3 - - 120, 100 + + 390, 27 - - 8 + + 1 - - ucrReceiverMultiple + + ucrReceiverForTestColumn - - instat.ucrReceiverMultiple, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + instat.ucrReceiverExpression, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - + $this - - 6 + + 14 \ No newline at end of file diff --git a/instat/dlgModelling.vb b/instat/dlgModelling.vb index 5d0bd5371f0..3bb7e95c82f 100644 --- a/instat/dlgModelling.vb +++ b/instat/dlgModelling.vb @@ -16,29 +16,24 @@ Imports instat.Translations Imports RDotNet + Public Class dlgModelling Public bFirstLoad As Boolean = True Private bReset As Boolean = True - Private strPackageName As String Private clsAttach, clsDetach As New RFunction Public clsRModelFunction As RFunction Public clsRYVariable, clsRXVariable As String - Public clsRLmOrGLM As RFunction - Public clsRGraphics As New RSyntax - Private clsRSyntax As New RSyntax Private ucrAvailableDataframe As ucrDataFrame Public clsRAovFunction, clsRAovPValFunction, clsREstPValFunction, clsAutoplot, clsRgeom_point, clsRPredFunction, clsRDFFunction, clsRFittedValues, clsRWriteFitted, clsRResiduals, clsRWriteResiduals, clsRStdResiduals, clsRWriteStdResiduals, clsRLeverage, clsRWriteLeverage As New RFunction Public clsVisReg, clsRaesFunction, clsRStat_smooth, clsR_ribbon, clsRaes_ribbon As New RFunction Public clsWhichFunction As RFunction - Public bRCodeSet As Boolean = True + Public bUpdating As Boolean = False 'Display tab functions Public clsFormulaFunction, clsAnovaFunction, clsSummaryFunction, clsConfint As RFunction Private clsFittedValuesFunction, clsResidualFunction, clsRstandardFunction, clsHatvaluesFunction As New RFunction - Public clsGLM, clsLM, clsLMOrGLM As RFunction - Private bResetDisplayOptions = False Private Sub dlgModelling_Load(sender As Object, e As EventArgs) Handles Me.Load @@ -54,11 +49,16 @@ Public Class dlgModelling End Sub Private Sub InitialiseDialog() + bUpdating = True + cmdPredict.Enabled = False + ucrReceiverForTestColumn.Selector = ucrSelectorModelling - ucrReceiverMultiple.Selector = ucrSelectorModelling ucrReceiverForTestColumn.SetMeAsReceiver() + ucrChkIncludeArguments.SetText("Include Arguments") + ucrBase.clsRsyntax.SetCommandString("") + ucrSaveResult.SetPrefix("model") ucrSaveResult.SetIsComboBox() ucrSaveResult.SetSaveTypeAsModel() @@ -70,10 +70,12 @@ Public Class dlgModelling ucrInputComboRPackage.SetDropDownStyleAsNonEditable() clsAttach.SetRCommand("attach") + clsAttach.AddParameter("what", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + clsDetach.SetRCommand("detach") - clsAttach.AddParameter("what", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame) - clsDetach.AddParameter("name", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame) - clsDetach.AddParameter("unload", "TRUE") + clsDetach.AddParameter("name", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + clsDetach.AddParameter("unload", "TRUE", iPosition:=1) + bUpdating = False End Sub Private Sub SetDefaults() @@ -103,14 +105,17 @@ Public Class dlgModelling ucrBase.clsRsyntax.ClearCodes() + bUpdating = True ucrSelectorModelling.Reset() ucrReceiverForTestColumn.SetMeAsReceiver() ucrSaveResult.Reset() ucrSaveResult.ucrChkSave.Checked = False + ucrBase.clsRsyntax.SetAssignTo("last_model", strTempModel:="last_model", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem) ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.clsRsyntax.iCallType = 2 + ucrChkIncludeArguments.Checked = False ucrInputComboRPackage.SetName("stats") @@ -150,7 +155,6 @@ Public Class dlgModelling 'Anova +Pvalue clsREstPValFunction = clsRegressionDefaults.clsDefaultRaovPValueFunction.Clone - clsREstPValFunction.AddParameter("", clsRFunctionParameter:=clsLMOrGLM) ' clsRaovpvalFunction.AddParameter("", clsRFunctionParameter:=clsRLmOrGLM) clsREstPValFunction.iCallType = 2 @@ -183,21 +187,10 @@ Public Class dlgModelling clsHatvaluesFunction.SetRCommand("hatvalues") - clsFormulaFunction.AddParameter("x", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - clsAnovaFunction.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - clsSummaryFunction.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - clsConfint.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - clsVisReg.AddParameter("fit", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - clsAutoplot.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - clsResidualFunction.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - clsFittedValuesFunction.AddParameter("object", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - clsRstandardFunction.AddParameter("model", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - clsHatvaluesFunction.AddParameter("model", clsRFunctionParameter:=ucrBase.clsRsyntax.clsBaseFunction) - - ucrBase.clsRsyntax.AddToAfterCodes(clsAnovaFunction, 1) ucrBase.clsRsyntax.AddToAfterCodes(clsSummaryFunction, 2) bResetDisplayOptions = True + bUpdating = False End Sub Private Sub TestOkEnabled() @@ -215,7 +208,7 @@ Public Class dlgModelling End Sub Private Sub cmdaov_Click(sender As Object, e As EventArgs) Handles cmdaov.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("aov(formula = , data = NULL, projections = FALSE, qr = TRUE, contrasts = NULL)", 65) Else @@ -224,7 +217,7 @@ Public Class dlgModelling End Sub Private Sub cmdar_Click(sender As Object, e As EventArgs) Handles cmdar.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("ar(x = , aic = TRUE, order.max = NULL, method = c(""yule-walker"", ""burg"", ""ols"", ""mle"", ""yw""), na.action, series)", 106) @@ -234,7 +227,7 @@ Public Class dlgModelling End Sub Private Sub cmdarima_Click(sender As Object, e As EventArgs) Handles cmdarima.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("arima(x = , order = c(0L, 0L, 0L), seasonal = list(order = c(0L, 0L, 0L), period = NA), xreg = NULL, include.mean = TRUE, transform.pars = TRUE, fixed = NULL, init = NULL, method = c(""CSS-ML"", ""ML"", ""CSS""), n.cond,SSinit = c(""Gardner1980"", ""Rossignol2011""), optim.method = ""BFGS"", optim.control = list(), kappa = 1e6)", 308) Else @@ -243,7 +236,7 @@ Public Class dlgModelling End Sub Private Sub cmdglm_Click(sender As Object, e As EventArgs) Handles cmdglm.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm(formula = , family = gaussian, data, weights, subset,na.action, start = NULL, etastart, mustart, offset, control = list(...), model = TRUE, method = ""glm.fit"" ,x = FALSE, y = TRUE, contrasts = NULL)", 188) Else @@ -252,7 +245,7 @@ Public Class dlgModelling End Sub Private Sub cmdlm_Click(sender As Object, e As EventArgs) Handles cmdlm.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm(formula = , data, subset, weights, na.action,method = ""qr"", model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE, contrasts = NULL, offset)", 143) Else @@ -261,7 +254,7 @@ Public Class dlgModelling End Sub Private Sub cmdloess_Click(sender As Object, e As EventArgs) Handles cmdloess.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loess(formula = , data, weights, subset, na.action, model = FALSE,span = 0.75, enp.target, degree = 2,parametric = FALSE, drop.square = FALSE, normalize = TRUE,family = c(""gaussian"", ""symmetric""),method = c(""loess"", ""model.frame""), control = loess.control(...))", 246) Else @@ -270,7 +263,7 @@ Public Class dlgModelling End Sub Private Sub cmdlowess_Click(sender As Object, e As EventArgs) Handles cmdlowess.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lowess(x = , y = NULL, f = 2/3, iter = 3, delta = 0.01 * diff(range(x)))", 61) Else @@ -279,7 +272,7 @@ Public Class dlgModelling End Sub Private Sub cmdloglin_Click(sender As Object, e As EventArgs) Handles cmdloglin.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglin(table = , margin, start = rep(1, length(table)), fit = FALSE, eps = 0.1, iter = 20, param = FALSE, print = TRUE)", 104) Else @@ -288,7 +281,7 @@ Public Class dlgModelling End Sub Private Sub cmdspline_Click(sender As Object, e As EventArgs) Handles cmdspline.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("spline(x = , y = NULL, n = 3*length(x), method = ""fmm"",xmin = min(x), xmax = max(x), xout, ties = mean)", 92) Else @@ -297,7 +290,7 @@ Public Class dlgModelling End Sub Private Sub cmdfevd_Click(sender As Object, e As EventArgs) Handles cmdfevd.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd(x = , data, threshold = NULL, threshold.fun = ~1, location.fun = ~1, scale.fun = ~1, shape.fun = ~1, use.phi = FALSE, type = c(""GEV"", ""GP"", ""PP"", ""Gumbel"", ""Exponential""), method = c(""MLE"", ""GMLE"", ""Bayesian"", ""Lmoments""), initial = NULL, span, units = NULL, time.units = ""days"", period.basis = ""year"", na.action = na.fail, optim.args = NULL, priorFun = NULL, priorParams = NULL, proposalFun = NULL, proposalParams = NULL, iter = 9999, weights = 1, blocks = NULL, verbose = FALSE)", 476) Else @@ -306,7 +299,7 @@ Public Class dlgModelling End Sub Private Sub cmdlevd_Click(sender As Object, e As EventArgs) Handles cmdlevd.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd(x = , threshold, location, scale, shape, type = c(""GEV"", ""GP"", ""PP"", ""Gumbel"", ""Weibull"", ""Frechet"",""Exponential"", ""Beta"", ""Pareto""), log = TRUE, negative = TRUE, span, npy = 365.25, infval = Inf, weights = 1, blocks = NULL)", 220) Else @@ -315,7 +308,7 @@ Public Class dlgModelling End Sub Private Sub cmdglmer_Click(sender As Object, e As EventArgs) Handles cmdglmer.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer(formula = , data = NULL, family = gaussian, control = glmerControl(), start = NULL, verbose = 0L, nAGQ = 1L, subset, weights, na.action, offset, contrasts = NULL, mustart, etastart, devFunOnly = FALSE)", 192) Else @@ -324,7 +317,7 @@ Public Class dlgModelling End Sub Private Sub cmdlmer_Click(sender As Object, e As EventArgs) Handles cmdlmer.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer(formula = , data = NULL, REML = TRUE, control = lmerControl(), start = NULL, verbose = 0L, subset, weights, na.action, offset, contrasts = NULL, devFunOnly = FALSE)", 154) Else @@ -333,7 +326,7 @@ Public Class dlgModelling End Sub Private Sub cmdnlmer_Click(sender As Object, e As EventArgs) Handles cmdnlmer.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer(formula = , data = NULL, control = nlmerControl(), start = NULL, verbose = 0L, nAGQ = 1L, subset, weights, na.action, offset, contrasts = NULL, devFunOnly = FALSE)", 153) Else @@ -342,7 +335,7 @@ Public Class dlgModelling End Sub Private Sub cmdglmmPQL_Click(sender As Object, e As EventArgs) Handles cmdglmmPQL.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmmPQL(fixed = , random, family, data, correlation, weights,control, niter = 10, verbose = TRUE)", 82) Else @@ -351,7 +344,7 @@ Public Class dlgModelling End Sub Private Sub cmdglmnb_Click(sender As Object, e As EventArgs) Handles cmdglmnb.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb(formula = , data, weights, subset, na.action,start = NULL, etastart, mustart,control = glm.control(...), method = ""glm.fit"",model = TRUE, x = FALSE, y = TRUE, contrasts = NULL, ...,init.theta, link = log)", 194) Else @@ -360,7 +353,7 @@ Public Class dlgModelling End Sub Private Sub cmdloglm_Click(sender As Object, e As EventArgs) Handles cmdloglm.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm(formula = , data, subset, na.action)", 27) Else @@ -369,7 +362,7 @@ Public Class dlgModelling End Sub Private Sub cmdpolr_Click(sender As Object, e As EventArgs) Handles cmdpolr.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr(formula = , data, weights, start, ..., subset, na.action,contrasts = NULL, Hess = FALSE, model = TRUE, method = c(""logistic"", ""probit"", ""loglog"", ""cloglog"", ""cauchit""))", 158) Else @@ -378,7 +371,7 @@ Public Class dlgModelling End Sub Private Sub cmdrlm_Click(sender As Object, e As EventArgs) Handles cmdrlm.Click - clear() + Clear() If ucrChkIncludeArguments.Checked Then ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm(formula = , data, weights, ..., subset, na.action, method = c(""M"", ""MM"", ""model.frame""), wt.method = c(""inv.var"", ""case""), model = TRUE, x.ret = TRUE, y.ret = FALSE, contrasts = NULL)", 173) Else @@ -431,7 +424,7 @@ Public Class dlgModelling End Sub Private Sub cmdDisplayOptions_Click(sender As Object, e As EventArgs) Handles cmdDisplayOptions.Click - sdgSimpleRegOptions.SetRCode(clsNewRSyntax:=ucrBase.clsRsyntax, clsNewFormulaFunction:=clsFormulaFunction, clsNewAnovaFunction:=clsAnovaFunction, clsNewRSummaryFunction:=clsSummaryFunction, clsNewConfint:=clsConfint, clsNewVisReg:=clsVisReg, clsNewAutoplot:=clsAutoplot, clsNewResidualFunction:=clsResidualFunction, clsNewFittedValuesRfunction:=clsFittedValuesFunction, clsNewRstandardFunction:=clsRstandardFunction, clsNewHatvaluesFunction:=clsHatvaluesFunction, ucrNewAvailableDatafrane:=ucrSelectorModelling.ucrAvailableDataFrames, bReset:=bResetDisplayOptions) + sdgSimpleRegOptions.SetRCode(clsNewRSyntax:=ucrBase.clsRsyntax, clsNewFormulaFunction:=clsFormulaFunction, clsNewAnovaFunction:=clsAnovaFunction, clsNewRSummaryFunction:=clsSummaryFunction, clsNewConfint:=clsConfint, clsNewVisReg:=clsVisReg, clsNewAutoplot:=clsAutoplot, clsNewResidualFunction:=clsResidualFunction, clsNewFittedValuesFunction:=clsFittedValuesFunction, clsNewRstandardFunction:=clsRstandardFunction, clsNewHatvaluesFunction:=clsHatvaluesFunction, ucrNewAvailableDatafrane:=ucrSelectorModelling.ucrAvailableDataFrames, bReset:=bResetDisplayOptions) sdgSimpleRegOptions.ShowDialog() GraphAssignTo() bResetDisplayOptions = False @@ -443,6 +436,9 @@ Public Class dlgModelling Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click Dim clsHelp As New RFunction + Dim strPackageName As String + + strPackageName = ucrInputComboRPackage.GetText clsHelp.SetPackageName("utils") clsHelp.SetRCommand("help") clsHelp.AddParameter("package", Chr(34) & strPackageName & Chr(34)) @@ -450,44 +446,14 @@ Public Class dlgModelling frmMain.clsRLink.RunScript(clsHelp.ToScript, strComment:="Opening help page for" & " " & strPackageName & " " & "Package. Generated from dialog Modelling", iCallType:=2, bSeparateThread:=False, bUpdateGrids:=False) End Sub - Private Sub clear() + Private Sub Clear() ucrReceiverForTestColumn.Clear() End Sub - Private Sub ucrInputComboRPackage_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputComboRPackage.ControlValueChanged - Select Case ucrInputComboRPackage.GetText - Case "stats" - strPackageName = "stats" - grpStats.Visible = True - grpextRemes.Visible = False - grplme4.Visible = False - grpMASS.Visible = False - - Case "extRemes" - strPackageName = "extRemes" - grpStats.Visible = False - grpextRemes.Visible = True - grplme4.Visible = False - grpMASS.Visible = False - - Case "lme4" - strPackageName = "lme4" - grpStats.Visible = False - grpextRemes.Visible = False - grplme4.Visible = True - grpMASS.Visible = False - - Case "MASS" - strPackageName = "MASS" - grpStats.Visible = False - grpextRemes.Visible = False - grplme4.Visible = False - grpMASS.Visible = True - End Select - End Sub - Private Sub SetRcodeForControls(bReset As Boolean) + bUpdating = True ucrSaveResult.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) + bUpdating = False End Sub Private Sub TryScript() @@ -575,7 +541,54 @@ Public Class dlgModelling clsVisReg.SetAssignTo("last_visreg", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_visreg") clsAutoplot.SetAssignTo("last_autoplot", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_autoplot") End Sub + Private Sub ucrSaveResult_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlContentsChanged, ucrReceiverForTestColumn.ControlContentsChanged TestOkEnabled() End Sub + + Private Sub ucrSaveResult_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlValueChanged + Dim strAssginTo As String + + If Not bUpdating Then + strAssginTo = ucrBase.clsRsyntax.GetstrAssignTo() + clsFormulaFunction.AddParameter("x", ucrBase.clsRsyntax.GetstrAssignTo()) + clsAnovaFunction.AddParameter("object", strAssginTo) + clsSummaryFunction.AddParameter("object", strAssginTo) + clsConfint.AddParameter("object", strAssginTo) + clsVisReg.AddParameter("fit", strAssginTo) + clsAutoplot.AddParameter("object", strAssginTo) + clsResidualFunction.AddParameter("object", strAssginTo) + clsFittedValuesFunction.AddParameter("object", strAssginTo) + clsRstandardFunction.AddParameter("model", strAssginTo) + clsHatvaluesFunction.AddParameter("model", strAssginTo) + End If + End Sub + + Private Sub ucrInputComboRPackage_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputComboRPackage.ControlValueChanged + Select Case ucrInputComboRPackage.GetText + Case "stats" + grpStats.Visible = True + grpextRemes.Visible = False + grplme4.Visible = False + grpMASS.Visible = False + + Case "extRemes" + grpStats.Visible = False + grpextRemes.Visible = True + grplme4.Visible = False + grpMASS.Visible = False + + Case "lme4" + grpStats.Visible = False + grpextRemes.Visible = False + grplme4.Visible = True + grpMASS.Visible = False + + Case "MASS" + grpStats.Visible = False + grpextRemes.Visible = False + grplme4.Visible = False + grpMASS.Visible = True + End Select + End Sub End Class \ No newline at end of file From df12818a862595c6e83424b3777b2cbbf7cc989d Mon Sep 17 00:00:00 2001 From: Danny Parsons Date: Sun, 4 Nov 2018 22:09:54 +0000 Subject: [PATCH 8/8] updated modelling dialog added correct package names and link to sub dialog added to frmMain fixed bug in data frame control --- instat/dlgModelling.Designer.vb | 25 ++++-- instat/dlgModelling.resx | 141 +++++++++++++++++++++++--------- instat/dlgModelling.vb | 132 +++++++++++++++--------------- instat/frmMain.Designer.vb | 71 ++++++++-------- instat/frmMain.resx | 39 ++++++--- instat/frmMain.vb | 4 + instat/ucrDataFrame.vb | 4 +- 7 files changed, 258 insertions(+), 158 deletions(-) diff --git a/instat/dlgModelling.Designer.vb b/instat/dlgModelling.Designer.vb index 18140dfa366..fb5d613d142 100644 --- a/instat/dlgModelling.Designer.vb +++ b/instat/dlgModelling.Designer.vb @@ -23,7 +23,7 @@ Partial Class dlgModelling _ Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(dlgModelling)) - Me.lblTest = New System.Windows.Forms.Label() + Me.lblModel = New System.Windows.Forms.Label() Me.cmdspline = New System.Windows.Forms.Button() Me.cmdarima = New System.Windows.Forms.Button() Me.cmdloglin = New System.Windows.Forms.Button() @@ -46,6 +46,7 @@ Partial Class dlgModelling Me.cmdSquareBrackets = New System.Windows.Forms.Button() Me.cmdMinus = New System.Windows.Forms.Button() Me.grpFirstCalc = New System.Windows.Forms.GroupBox() + Me.cmdTilda = New System.Windows.Forms.Button() Me.cmdTry = New System.Windows.Forms.Button() Me.cmdDisplayOptions = New System.Windows.Forms.Button() Me.cmdPredict = New System.Windows.Forms.Button() @@ -78,11 +79,11 @@ Partial Class dlgModelling Me.grpMASS.SuspendLayout() Me.SuspendLayout() ' - 'lblTest + 'lblModel ' - resources.ApplyResources(Me.lblTest, "lblTest") - Me.lblTest.Name = "lblTest" - Me.lblTest.Tag = "Test" + resources.ApplyResources(Me.lblModel, "lblModel") + Me.lblModel.Name = "lblModel" + Me.lblModel.Tag = "Test" ' 'cmdspline ' @@ -221,6 +222,7 @@ Partial Class dlgModelling ' 'grpFirstCalc ' + Me.grpFirstCalc.Controls.Add(Me.cmdTilda) Me.grpFirstCalc.Controls.Add(Me.cmdMultiply) Me.grpFirstCalc.Controls.Add(Me.cmdColon) Me.grpFirstCalc.Controls.Add(Me.cmdPlus) @@ -229,13 +231,18 @@ Partial Class dlgModelling Me.grpFirstCalc.Controls.Add(Me.cmdOpeningBracket) Me.grpFirstCalc.Controls.Add(Me.cmdDiv) Me.grpFirstCalc.Controls.Add(Me.cmdDoubleBracket) - Me.grpFirstCalc.Controls.Add(Me.cmdClear) Me.grpFirstCalc.Controls.Add(Me.cmdSquareBrackets) Me.grpFirstCalc.Controls.Add(Me.cmdMinus) resources.ApplyResources(Me.grpFirstCalc, "grpFirstCalc") Me.grpFirstCalc.Name = "grpFirstCalc" Me.grpFirstCalc.TabStop = False ' + 'cmdTilda + ' + resources.ApplyResources(Me.cmdTilda, "cmdTilda") + Me.cmdTilda.Name = "cmdTilda" + Me.cmdTilda.UseVisualStyleBackColor = True + ' 'cmdTry ' resources.ApplyResources(Me.cmdTry, "cmdTry") @@ -413,12 +420,13 @@ Partial Class dlgModelling Me.Controls.Add(Me.cmdHelp) Me.Controls.Add(Me.cmdDisplayOptions) Me.Controls.Add(Me.cmdPredict) + Me.Controls.Add(Me.cmdClear) Me.Controls.Add(Me.ucrSaveResult) Me.Controls.Add(Me.ucrInputTryMessage) Me.Controls.Add(Me.cmdTry) Me.Controls.Add(Me.grpFirstCalc) Me.Controls.Add(Me.ucrInputComboRPackage) - Me.Controls.Add(Me.lblTest) + Me.Controls.Add(Me.lblModel) Me.Controls.Add(Me.ucrReceiverForTestColumn) Me.Controls.Add(Me.ucrSelectorModelling) Me.Controls.Add(Me.ucrBase) @@ -440,7 +448,7 @@ Partial Class dlgModelling Friend WithEvents ucrBase As ucrButtons Friend WithEvents ucrSelectorModelling As ucrSelectorByDataFrameAddRemove Friend WithEvents ucrInputComboRPackage As ucrInputComboBox - Friend WithEvents lblTest As Label + Friend WithEvents lblModel As Label Friend WithEvents ucrReceiverForTestColumn As ucrReceiverExpression Friend WithEvents grpStats As GroupBox Friend WithEvents cmdspline As Button @@ -485,4 +493,5 @@ Partial Class dlgModelling Friend WithEvents cmdHelp As Button Friend WithEvents lblRpackage As Label Friend WithEvents ucrChkIncludeArguments As ucrCheck + Friend WithEvents cmdTilda As Button End Class diff --git a/instat/dlgModelling.resx b/instat/dlgModelling.resx index f1bcb23a5bf..1dc5bc06338 100644 --- a/instat/dlgModelling.resx +++ b/instat/dlgModelling.resx @@ -118,40 +118,40 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + True - + NoControl - + 10, 17 - + 2, 0, 2, 0 - - 28, 13 + + 39, 13 - + 0 - - Test + + Model: - - lblTest + + lblModel - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - - 13 + + 14 NoControl @@ -451,7 +451,10 @@ $this - 17 + 18 + + + Microsoft Sans Serif, 12pt NoControl @@ -481,7 +484,10 @@ grpFirstCalc - 0 + 1 + + + Microsoft Sans Serif, 12pt NoControl @@ -511,7 +517,10 @@ grpFirstCalc - 1 + 2 + + + Microsoft Sans Serif, 12pt NoControl @@ -541,7 +550,10 @@ grpFirstCalc - 2 + 3 + + + Microsoft Sans Serif, 12pt NoControl @@ -571,7 +583,10 @@ grpFirstCalc - 3 + 4 + + + Microsoft Sans Serif, 9.75pt NoControl @@ -601,7 +616,10 @@ grpFirstCalc - 4 + 5 + + + Microsoft Sans Serif, 9.75pt NoControl @@ -631,7 +649,10 @@ grpFirstCalc - 5 + 6 + + + Microsoft Sans Serif, 12pt NoControl @@ -661,7 +682,10 @@ grpFirstCalc - 6 + 7 + + + Microsoft Sans Serif, 9.75pt NoControl @@ -691,13 +715,13 @@ grpFirstCalc - 7 + 8 NoControl - 59, 70 + 417, 251 2, 3, 2, 3 @@ -718,11 +742,14 @@ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - grpFirstCalc + $this 8 + + Microsoft Sans Serif, 9.75pt + NoControl @@ -753,6 +780,9 @@ 9 + + Microsoft Sans Serif, 12pt + NoControl @@ -783,6 +813,39 @@ 10 + + Microsoft Sans Serif, 18pt + + + NoControl + + + 59, 70 + + + 2, 3, 2, 3 + + + 57, 30 + + + 21 + + + ~ + + + cmdTilda + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpFirstCalc + + + 0 + 293, 181 @@ -802,7 +865,7 @@ $this - 11 + 12 NoControl @@ -832,13 +895,13 @@ $this - 10 + 11 NoControl - 426, 313 + 309, 343 105, 23 @@ -1279,10 +1342,10 @@ NoControl - 427, 191 + 493, 38 - 75, 23 + 60, 23 7 @@ -1372,7 +1435,7 @@ $this - 8 + 9 88, 314 @@ -1396,7 +1459,7 @@ $this - 9 + 10 364, 39 @@ -1417,7 +1480,7 @@ $this - 12 + 13 True @@ -1450,7 +1513,7 @@ $this - 15 + 16 10, 371 @@ -1471,7 +1534,7 @@ $this - 16 + 17 CenterScreen @@ -1486,13 +1549,13 @@ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 41, 13 + 53, 13 2, 3, 2, 3 - 390, 27 + 378, 27 1 @@ -1507,6 +1570,6 @@ $this - 14 + 15 \ No newline at end of file diff --git a/instat/dlgModelling.vb b/instat/dlgModelling.vb index 3bb7e95c82f..741d496eacc 100644 --- a/instat/dlgModelling.vb +++ b/instat/dlgModelling.vb @@ -50,15 +50,15 @@ Public Class dlgModelling Private Sub InitialiseDialog() bUpdating = True - cmdPredict.Enabled = False + cmdPredict.Visible = False + + cmdTry.Visible = False + ucrInputTryMessage.Visible = False ucrReceiverForTestColumn.Selector = ucrSelectorModelling - ucrReceiverForTestColumn.SetMeAsReceiver() ucrChkIncludeArguments.SetText("Include Arguments") - ucrBase.clsRsyntax.SetCommandString("") - ucrSaveResult.SetPrefix("model") ucrSaveResult.SetIsComboBox() ucrSaveResult.SetSaveTypeAsModel() @@ -69,16 +69,13 @@ Public Class dlgModelling ucrInputComboRPackage.SetItems({"stats", "extRemes", "lme4", "MASS"}) ucrInputComboRPackage.SetDropDownStyleAsNonEditable() - clsAttach.SetRCommand("attach") - clsAttach.AddParameter("what", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) - - clsDetach.SetRCommand("detach") - clsDetach.AddParameter("name", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) - clsDetach.AddParameter("unload", "TRUE", iPosition:=1) bUpdating = False End Sub Private Sub SetDefaults() + clsAttach = New RFunction + clsDetach = New RFunction + clsFormulaFunction = New RFunction clsRModelFunction = New RFunction clsRAovFunction = New RFunction @@ -108,10 +105,17 @@ Public Class dlgModelling bUpdating = True ucrSelectorModelling.Reset() + ucrReceiverForTestColumn.SetMeAsReceiver() + + ucrBase.clsRsyntax.SetCommandString("") + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lm()", 1) + ucrSaveResult.Reset() ucrSaveResult.ucrChkSave.Checked = False + ucrSaveResult.Enabled = False + ucrBase.clsRsyntax.SetAssignTo("last_model", strTempModel:="last_model", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem) ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.clsRsyntax.iCallType = 2 @@ -119,6 +123,13 @@ Public Class dlgModelling ucrChkIncludeArguments.Checked = False ucrInputComboRPackage.SetName("stats") + clsAttach.SetRCommand("attach") + clsAttach.AddParameter("what", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + + clsDetach.SetRCommand("detach") + clsDetach.AddParameter("name", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + clsDetach.AddParameter("unload", "TRUE", iPosition:=1) + 'Residual Plots clsAutoplot = clsRegressionDefaults.clsDefaultAutoplot.Clone clsAutoplot.bExcludeAssignedFunctionOutput = False @@ -187,6 +198,8 @@ Public Class dlgModelling clsHatvaluesFunction.SetRCommand("hatvalues") + ucrBase.clsRsyntax.AddToBeforeCodes(clsAttach, 1) + ucrBase.clsRsyntax.AddToAfterCodes(clsDetach, 1000) ucrBase.clsRsyntax.AddToAfterCodes(clsSummaryFunction, 2) bResetDisplayOptions = True @@ -292,90 +305,94 @@ Public Class dlgModelling Private Sub cmdfevd_Click(sender As Object, e As EventArgs) Handles cmdfevd.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd(x = , data, threshold = NULL, threshold.fun = ~1, location.fun = ~1, scale.fun = ~1, shape.fun = ~1, use.phi = FALSE, type = c(""GEV"", ""GP"", ""PP"", ""Gumbel"", ""Exponential""), method = c(""MLE"", ""GMLE"", ""Bayesian"", ""Lmoments""), initial = NULL, span, units = NULL, time.units = ""days"", period.basis = ""year"", na.action = na.fail, optim.args = NULL, priorFun = NULL, priorParams = NULL, proposalFun = NULL, proposalParams = NULL, iter = 9999, weights = 1, blocks = NULL, verbose = FALSE)", 476) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("extRemes::fevd(x = , data, threshold = NULL, threshold.fun = ~1, location.fun = ~1, scale.fun = ~1, shape.fun = ~1, use.phi = FALSE, type = c(""GEV"", ""GP"", ""PP"", ""Gumbel"", ""Exponential""), method = c(""MLE"", ""GMLE"", ""Bayesian"", ""Lmoments""), initial = NULL, span, units = NULL, time.units = ""days"", period.basis = ""year"", na.action = na.fail, optim.args = NULL, priorFun = NULL, priorParams = NULL, proposalFun = NULL, proposalParams = NULL, iter = 9999, weights = 1, blocks = NULL, verbose = FALSE)", 476) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("fevd()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("extRemes::fevd()", 1) End If End Sub Private Sub cmdlevd_Click(sender As Object, e As EventArgs) Handles cmdlevd.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd(x = , threshold, location, scale, shape, type = c(""GEV"", ""GP"", ""PP"", ""Gumbel"", ""Weibull"", ""Frechet"",""Exponential"", ""Beta"", ""Pareto""), log = TRUE, negative = TRUE, span, npy = 365.25, infval = Inf, weights = 1, blocks = NULL)", 220) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("extRemes::levd(x = , threshold, location, scale, shape, type = c(""GEV"", ""GP"", ""PP"", ""Gumbel"", ""Weibull"", ""Frechet"",""Exponential"", ""Beta"", ""Pareto""), log = TRUE, negative = TRUE, span, npy = 365.25, infval = Inf, weights = 1, blocks = NULL)", 220) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("levd()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("extRemes::levd()", 1) End If End Sub Private Sub cmdglmer_Click(sender As Object, e As EventArgs) Handles cmdglmer.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer(formula = , data = NULL, family = gaussian, control = glmerControl(), start = NULL, verbose = 0L, nAGQ = 1L, subset, weights, na.action, offset, contrasts = NULL, mustart, etastart, devFunOnly = FALSE)", 192) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lme4::glmer(formula = , data = NULL, family = gaussian, control = glmerControl(), start = NULL, verbose = 0L, nAGQ = 1L, subset, weights, na.action, offset, contrasts = NULL, mustart, etastart, devFunOnly = FALSE)", 192) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmer()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lme4::glmer()", 1) End If End Sub Private Sub cmdlmer_Click(sender As Object, e As EventArgs) Handles cmdlmer.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer(formula = , data = NULL, REML = TRUE, control = lmerControl(), start = NULL, verbose = 0L, subset, weights, na.action, offset, contrasts = NULL, devFunOnly = FALSE)", 154) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lme4::lmer(formula = , data = NULL, REML = TRUE, control = lmerControl(), start = NULL, verbose = 0L, subset, weights, na.action, offset, contrasts = NULL, devFunOnly = FALSE)", 154) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lmer()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lme4::lmer()", 1) End If End Sub Private Sub cmdnlmer_Click(sender As Object, e As EventArgs) Handles cmdnlmer.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer(formula = , data = NULL, control = nlmerControl(), start = NULL, verbose = 0L, nAGQ = 1L, subset, weights, na.action, offset, contrasts = NULL, devFunOnly = FALSE)", 153) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lme4::nlmer(formula = , data = NULL, control = nlmerControl(), start = NULL, verbose = 0L, nAGQ = 1L, subset, weights, na.action, offset, contrasts = NULL, devFunOnly = FALSE)", 153) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("nlmer()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("lme4::nlmer()", 1) End If End Sub Private Sub cmdglmmPQL_Click(sender As Object, e As EventArgs) Handles cmdglmmPQL.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmmPQL(fixed = , random, family, data, correlation, weights,control, niter = 10, verbose = TRUE)", 82) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::glmmPQL(fixed = , random, family, data, correlation, weights,control, niter = 10, verbose = TRUE)", 82) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glmmPQL()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::glmmPQL()", 1) End If End Sub Private Sub cmdglmnb_Click(sender As Object, e As EventArgs) Handles cmdglmnb.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb(formula = , data, weights, subset, na.action,start = NULL, etastart, mustart,control = glm.control(...), method = ""glm.fit"",model = TRUE, x = FALSE, y = TRUE, contrasts = NULL, ...,init.theta, link = log)", 194) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::glm.nb(formula = , data, weights, subset, na.action,start = NULL, etastart, mustart,control = glm.control(...), method = ""glm.fit"",model = TRUE, x = FALSE, y = TRUE, contrasts = NULL, ...,init.theta, link = log)", 194) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("glm.nb()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::glm.nb()", 1) End If End Sub Private Sub cmdloglm_Click(sender As Object, e As EventArgs) Handles cmdloglm.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm(formula = , data, subset, na.action)", 27) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::loglm(formula = , data, subset, na.action)", 27) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("loglm()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::loglm()", 1) End If End Sub Private Sub cmdpolr_Click(sender As Object, e As EventArgs) Handles cmdpolr.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr(formula = , data, weights, start, ..., subset, na.action,contrasts = NULL, Hess = FALSE, model = TRUE, method = c(""logistic"", ""probit"", ""loglog"", ""cloglog"", ""cauchit""))", 158) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::polr(formula = , data, weights, start, ..., subset, na.action,contrasts = NULL, Hess = FALSE, model = TRUE, method = c(""logistic"", ""probit"", ""loglog"", ""cloglog"", ""cauchit""))", 158) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("polr()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::polr()", 1) End If End Sub + Private Sub cmdTilda_Click(sender As Object, e As EventArgs) Handles cmdTilda.Click + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("~") + End Sub + Private Sub cmdrlm_Click(sender As Object, e As EventArgs) Handles cmdrlm.Click Clear() If ucrChkIncludeArguments.Checked Then - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm(formula = , data, weights, ..., subset, na.action, method = c(""M"", ""MM"", ""model.frame""), wt.method = c(""inv.var"", ""case""), model = TRUE, x.ret = TRUE, y.ret = FALSE, contrasts = NULL)", 173) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::rlm(formula = , data, weights, ..., subset, na.action, method = c(""M"", ""MM"", ""model.frame""), wt.method = c(""inv.var"", ""case""), model = TRUE, x.ret = TRUE, y.ret = FALSE, contrasts = NULL)", 173) Else - ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("rlm()", 1) + ucrReceiverForTestColumn.AddToReceiverAtCursorPosition("MASS::rlm()", 1) End If End Sub @@ -454,6 +471,7 @@ Public Class dlgModelling bUpdating = True ucrSaveResult.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) bUpdating = False + SetObjectInFunctions() End Sub Private Sub TryScript() @@ -517,26 +535,6 @@ Public Class dlgModelling TestOkEnabled() End Sub - Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk - Dim strScript As String = "" - Dim strFunc As String - clsAttach.AddParameter("what", clsRFunctionParameter:=ucrSelectorModelling.ucrAvailableDataFrames.clsCurrDataFrame) - strFunc = clsAttach.ToScript(strScript) - frmMain.clsRLink.RunScript(strScript & strFunc) - ucrBase.clsRsyntax.SetAssignTo(ucrSaveResult.GetText(), strTempModel:=ucrSaveResult.GetText(), strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem) - End Sub - - Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk - Dim strScript As String = "" - Dim strFunc As String - strFunc = clsDetach.ToScript(strScript) - frmMain.clsRLink.RunScript(strScript & strFunc) - End Sub - - Private Sub ucrSelectorModelling_Load(sender As Object, e As EventArgs) Handles ucrSelectorModelling.Load - - End Sub - Private Sub GraphAssignTo() clsVisReg.SetAssignTo("last_visreg", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_visreg") clsAutoplot.SetAssignTo("last_autoplot", strTempDataframe:=ucrSelectorModelling.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_autoplot") @@ -547,23 +545,28 @@ Public Class dlgModelling End Sub Private Sub ucrSaveResult_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSaveResult.ControlValueChanged - Dim strAssginTo As String - If Not bUpdating Then - strAssginTo = ucrBase.clsRsyntax.GetstrAssignTo() - clsFormulaFunction.AddParameter("x", ucrBase.clsRsyntax.GetstrAssignTo()) - clsAnovaFunction.AddParameter("object", strAssginTo) - clsSummaryFunction.AddParameter("object", strAssginTo) - clsConfint.AddParameter("object", strAssginTo) - clsVisReg.AddParameter("fit", strAssginTo) - clsAutoplot.AddParameter("object", strAssginTo) - clsResidualFunction.AddParameter("object", strAssginTo) - clsFittedValuesFunction.AddParameter("object", strAssginTo) - clsRstandardFunction.AddParameter("model", strAssginTo) - clsHatvaluesFunction.AddParameter("model", strAssginTo) + SetObjectInFunctions() End If End Sub + Private Sub SetObjectInFunctions() + Dim strAssginTo As String + + strAssginTo = ucrBase.clsRsyntax.GetstrAssignTo() + + clsFormulaFunction.AddParameter("x", strAssginTo) + clsAnovaFunction.AddParameter("object", strAssginTo) + clsSummaryFunction.AddParameter("object", strAssginTo) + clsConfint.AddParameter("object", strAssginTo) + clsVisReg.AddParameter("fit", strAssginTo) + clsAutoplot.AddParameter("object", strAssginTo) + clsResidualFunction.AddParameter("object", strAssginTo) + clsFittedValuesFunction.AddParameter("object", strAssginTo) + clsRstandardFunction.AddParameter("model", strAssginTo) + clsHatvaluesFunction.AddParameter("model", strAssginTo) + End Sub + Private Sub ucrInputComboRPackage_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputComboRPackage.ControlValueChanged Select Case ucrInputComboRPackage.GetText Case "stats" @@ -571,19 +574,16 @@ Public Class dlgModelling grpextRemes.Visible = False grplme4.Visible = False grpMASS.Visible = False - Case "extRemes" grpStats.Visible = False grpextRemes.Visible = True grplme4.Visible = False grpMASS.Visible = False - Case "lme4" grpStats.Visible = False grpextRemes.Visible = False grplme4.Visible = True grpMASS.Visible = False - Case "MASS" grpStats.Visible = False grpextRemes.Visible = False diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 0eb121cf1c2..c00ebdc2077 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -254,6 +254,7 @@ Partial Class frmMain Me.mnuCMSAF = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticCMSAFPlotRegion = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticCMSAFExporttoCMSAFRToolbox = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuClimaticMapping = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticModels = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticModelsExtremes = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClimaticModelsCircular = New System.Windows.Forms.ToolStripMenuItem() @@ -564,15 +565,15 @@ Partial Class frmMain Me.splOverall = New System.Windows.Forms.SplitContainer() Me.splExtraWindows = New System.Windows.Forms.SplitContainer() Me.splMetadata = New System.Windows.Forms.SplitContainer() + Me.splLogScript = New System.Windows.Forms.SplitContainer() + Me.splDataOutput = New System.Windows.Forms.SplitContainer() Me.ucrColumnMeta = New instat.ucrColumnMetadata() Me.ucrDataFrameMeta = New instat.ucrDataFrameMetadata() - Me.splLogScript = New System.Windows.Forms.SplitContainer() Me.ucrLogWindow = New instat.ucrLog() Me.ucrScriptWindow = New instat.ucrScript() - Me.splDataOutput = New System.Windows.Forms.SplitContainer() Me.ucrDataViewer = New instat.ucrDataView() Me.ucrOutput = New instat.ucrOutputWindow() - Me.mnuClimaticMapping = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuModelModel = New System.Windows.Forms.ToolStripMenuItem() Me.stsStrip.SuspendLayout() Me.Tool_strip.SuspendLayout() Me.mnuBar.SuspendLayout() @@ -870,7 +871,7 @@ Partial Class frmMain ' 'mnuModel ' - Me.mnuModel.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuModelProbabilityDistributions, Me.ToolStripSeparator3, Me.mnuModelOneVariable, Me.mnuModelTwoVariables, Me.mnuModelThreeVariables, Me.mnuModelFourVariables, Me.mnuModelGeneral, Me.ToolStripSeparator4, Me.mnuModelHypothesisTests, Me.mnuModelOtherOneVariable, Me.mnuModelOtherTwoVariables, Me.mnuModelOtherThreeVariables, Me.mnuModelOtherGeneral}) + Me.mnuModel.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuModelProbabilityDistributions, Me.ToolStripSeparator3, Me.mnuModelOneVariable, Me.mnuModelTwoVariables, Me.mnuModelThreeVariables, Me.mnuModelFourVariables, Me.mnuModelGeneral, Me.ToolStripSeparator4, Me.mnuModelHypothesisTests, Me.mnuModelModel, Me.mnuModelOtherOneVariable, Me.mnuModelOtherTwoVariables, Me.mnuModelOtherThreeVariables, Me.mnuModelOtherGeneral}) Me.mnuModel.Name = "mnuModel" resources.ApplyResources(Me.mnuModel, "mnuModel") Me.mnuModel.Tag = "Model" @@ -1790,6 +1791,11 @@ Partial Class frmMain Me.mnuClimaticCMSAFExporttoCMSAFRToolbox.Name = "mnuClimaticCMSAFExporttoCMSAFRToolbox" resources.ApplyResources(Me.mnuClimaticCMSAFExporttoCMSAFRToolbox, "mnuClimaticCMSAFExporttoCMSAFRToolbox") ' + 'mnuClimaticMapping + ' + Me.mnuClimaticMapping.Name = "mnuClimaticMapping" + resources.ApplyResources(Me.mnuClimaticMapping, "mnuClimaticMapping") + ' 'mnuClimaticModels ' Me.mnuClimaticModels.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuClimaticModelsExtremes, Me.mnuClimaticModelsCircular, Me.mnuClimaticModelsMarkovModelling}) @@ -3600,18 +3606,6 @@ Partial Class frmMain Me.splMetadata.Panel2.BackColor = System.Drawing.SystemColors.Control Me.splMetadata.Panel2.Controls.Add(Me.ucrDataFrameMeta) ' - 'ucrColumnMeta - ' - Me.ucrColumnMeta.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - resources.ApplyResources(Me.ucrColumnMeta, "ucrColumnMeta") - Me.ucrColumnMeta.Name = "ucrColumnMeta" - ' - 'ucrDataFrameMeta - ' - Me.ucrDataFrameMeta.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - resources.ApplyResources(Me.ucrDataFrameMeta, "ucrDataFrameMeta") - Me.ucrDataFrameMeta.Name = "ucrDataFrameMeta" - ' 'splLogScript ' Me.splLogScript.BackColor = System.Drawing.Color.LightGray @@ -3628,19 +3622,6 @@ Partial Class frmMain Me.splLogScript.Panel2.BackColor = System.Drawing.SystemColors.Control Me.splLogScript.Panel2.Controls.Add(Me.ucrScriptWindow) ' - 'ucrLogWindow - ' - Me.ucrLogWindow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - resources.ApplyResources(Me.ucrLogWindow, "ucrLogWindow") - Me.ucrLogWindow.Name = "ucrLogWindow" - ' - 'ucrScriptWindow - ' - Me.ucrScriptWindow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - resources.ApplyResources(Me.ucrScriptWindow, "ucrScriptWindow") - Me.ucrScriptWindow.Name = "ucrScriptWindow" - Me.ucrScriptWindow.Tag = "Script_Window" - ' 'splDataOutput ' Me.splDataOutput.BackColor = System.Drawing.Color.LightGray @@ -3657,6 +3638,31 @@ Partial Class frmMain Me.splDataOutput.Panel2.BackColor = System.Drawing.SystemColors.Control Me.splDataOutput.Panel2.Controls.Add(Me.ucrOutput) ' + 'ucrColumnMeta + ' + Me.ucrColumnMeta.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + resources.ApplyResources(Me.ucrColumnMeta, "ucrColumnMeta") + Me.ucrColumnMeta.Name = "ucrColumnMeta" + ' + 'ucrDataFrameMeta + ' + Me.ucrDataFrameMeta.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + resources.ApplyResources(Me.ucrDataFrameMeta, "ucrDataFrameMeta") + Me.ucrDataFrameMeta.Name = "ucrDataFrameMeta" + ' + 'ucrLogWindow + ' + Me.ucrLogWindow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + resources.ApplyResources(Me.ucrLogWindow, "ucrLogWindow") + Me.ucrLogWindow.Name = "ucrLogWindow" + ' + 'ucrScriptWindow + ' + Me.ucrScriptWindow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + resources.ApplyResources(Me.ucrScriptWindow, "ucrScriptWindow") + Me.ucrScriptWindow.Name = "ucrScriptWindow" + Me.ucrScriptWindow.Tag = "Script_Window" + ' 'ucrDataViewer ' Me.ucrDataViewer.BackColor = System.Drawing.SystemColors.Control @@ -3671,10 +3677,10 @@ Partial Class frmMain resources.ApplyResources(Me.ucrOutput, "ucrOutput") Me.ucrOutput.Name = "ucrOutput" ' - 'mnuClimaticMapping + 'mnuModelModel ' - Me.mnuClimaticMapping.Name = "mnuClimaticMapping" - resources.ApplyResources(Me.mnuClimaticMapping, "mnuClimaticMapping") + Me.mnuModelModel.Name = "mnuModelModel" + resources.ApplyResources(Me.mnuModelModel, "mnuModelModel") ' 'frmMain ' @@ -4254,4 +4260,5 @@ Partial Class frmMain Friend WithEvents mnuClimaticPrepareSPI As ToolStripMenuItem Friend WithEvents ToolStripSeparator51 As ToolStripSeparator Friend WithEvents mnuClimaticMapping As ToolStripMenuItem + Friend WithEvents mnuModelModel As ToolStripMenuItem End Class diff --git a/instat/frmMain.resx b/instat/frmMain.resx index ccbfcf67d3e..94b6dcce061 100644 --- a/instat/frmMain.resx +++ b/instat/frmMain.resx @@ -486,7 +486,7 @@ Two Variables - 160, 22 + 180, 22 Fit Model... @@ -495,7 +495,7 @@ False - 160, 22 + 180, 22 Choose Model... @@ -504,7 +504,7 @@ False - 160, 22 + 180, 22 Use Model... @@ -516,7 +516,7 @@ Three Variables - 160, 22 + 180, 22 Fit Model... @@ -525,7 +525,7 @@ False - 160, 22 + 180, 22 Choose Model... @@ -534,7 +534,7 @@ False - 160, 22 + 180, 22 Use Model... @@ -546,7 +546,7 @@ Four Variables - 160, 22 + 180, 22 Fit Model... @@ -555,7 +555,7 @@ False - 160, 22 + 180, 22 Choose Model... @@ -564,7 +564,7 @@ False - 160, 22 + 180, 22 Use Model... @@ -584,6 +584,12 @@ Hypothesis Tests... + + 201, 22 + + + Model... + 166, 22 @@ -5781,6 +5787,9 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + + NoControl + R-Instat @@ -7074,6 +7083,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + mnuClimaticMapping + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + mnuClimaticModels @@ -8898,10 +8913,10 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - mnuClimaticMapping + + mnuModelModel - + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/instat/frmMain.vb b/instat/frmMain.vb index 80aa41e2dec..b6b87ea5d72 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -2075,4 +2075,8 @@ Public Class frmMain Private Sub mnuClimaticMapping_Click(sender As Object, e As EventArgs) Handles mnuClimaticMapping.Click dlgClimaticStationMaps.ShowDialog() End Sub + + Private Sub mnuModelModel_Click(sender As Object, e As EventArgs) Handles mnuModelModel.Click + dlgModelling.ShowDialog() + End Sub End Class \ No newline at end of file diff --git a/instat/ucrDataFrame.vb b/instat/ucrDataFrame.vb index 12220c53507..1a4a32c5de8 100644 --- a/instat/ucrDataFrame.vb +++ b/instat/ucrDataFrame.vb @@ -199,7 +199,9 @@ Public Class ucrDataFrame Private Sub mnuRightClickCopy_Click(sender As Object, e As EventArgs) Handles mnuRightClickCopy.Click 'TODO Combo box should be replaced by ucrInput so that context menu done automatically - Clipboard.SetText(cboAvailableDataFrames.SelectedText) + If cboAvailableDataFrames.Text <> "" Then + Clipboard.SetText(cboAvailableDataFrames.Text) + End If End Sub Public Overrides Sub UpdateControl(Optional bReset As Boolean = False, Optional bCloneIfNeeded As Boolean = False)