diff --git a/instat/dlgOneVarUseModel.vb b/instat/dlgOneVarUseModel.vb index f0f4b5287ae..657ba9eb065 100644 --- a/instat/dlgOneVarUseModel.vb +++ b/instat/dlgOneVarUseModel.vb @@ -20,7 +20,7 @@ Public Class dlgOneVarUseModel Public bfirstload As Boolean = True Public bReset As Boolean = True Private bResetSubdialog As Boolean = False - Public clsRBootFunction, clsQuantileFunction, clsSeqFunction, clsReceiver As New RFunction + Public clsRBootFunction, clsQuantileFunction, clsSeqFunction, clsReceiver, clsRPlotFunction As New RFunction Private Sub dlgOneVarUseModel_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) If bfirstload Then @@ -37,14 +37,14 @@ Public Class dlgOneVarUseModel Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 375 - ucrBase.clsRsyntax.iCallType = 2 + ucrBase.clsRsyntax.iCallType = 3 ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrReceiverObject.SetParameter(New RParameter("x", 0)) ucrReceiverObject.Selector = ucrSelectorUseModel ucrReceiverObject.SetParameterIsRFunction() ucrReceiverObject.SetMeAsReceiver() - ucrReceiverObject.strSelectorHeading = "Models" ' check this + ucrReceiverObject.strSelectorHeading = "Models" ucrSelectorUseModel.SetItemType("model") @@ -63,22 +63,26 @@ Public Class dlgOneVarUseModel ucrNewDataFrameName.SetAssignToIfUncheckedValue("last_model") ucrSaveObjects.SetPrefix("bootstrap") + ucrSaveObjects.SetDataFrameSelector(ucrSelectorUseModel.ucrAvailableDataFrames) ucrSaveObjects.SetSaveTypeAsModel() ucrSaveObjects.SetIsComboBox() ucrSaveObjects.SetCheckBoxText("Save Bootstrap") - ' ucrSaveObjects.SetAssignToIfUncheckedValue("last_bootstrap") + 'ucrSaveObjects.SetAssignToIfUncheckedValue("last_bootstrap") End Sub Private Sub SetDefaults() clsRBootFunction = New RFunction clsQuantileFunction = New RFunction clsSeqFunction = New RFunction + clsRPlotFunction = New RFunction ucrSelectorUseModel.Reset() - ucrSaveObjects.Enabled = False 'for now + ucrSaveObjects.Enabled = False ' temporary ucrSaveObjects.Reset() ucrNewDataFrameName.Reset() - sdgOneVarUseModFit.SetDefaults() + + clsRPlotFunction.SetPackageName("graphics") + clsRPlotFunction.SetRCommand("plot") clsSeqFunction.SetRCommand("seq") clsSeqFunction.AddParameter("from", 0) @@ -93,15 +97,16 @@ Public Class dlgOneVarUseModel clsRBootFunction.AddParameter("bootmethod", Chr(34) & "nonparam" & Chr(34)) clsRBootFunction.AddParameter("niter", 1001) - ucrBase.clsRsyntax.SetBaseRFunction(clsQuantileFunction) + ucrBase.clsRsyntax.SetBaseRFunction(clsQuantileFunction) - ucrBase.clsRsyntax.SetAssignTo(ucrNewDataFrameName.GetText, strTempModel:="last_model", strTempDataframe:=ucrSelectorUseModel.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - ' clsRBootFunction.SetAssignTo(ucrSaveObjects.GetText, strTempModel:="last_bootstrap", strTempDataframe:=ucrSelectorUseModel.ucrAvailableDataFrames.cboAvailableDataFrames.Text) ' test at end. + clsQuantileFunction.SetAssignTo(ucrNewDataFrameName.GetText, strTempModel:="last_model", strTempDataframe:=ucrSelectorUseModel.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + 'clsRBootFunction.SetAssignTo(ucrSaveObjects.GetText, strTempModel:="last_bootstrap", strTempDataframe:=ucrSelectorUseModel.ucrAvailableDataFrames.cboAvailableDataFrames.Text) bResetSubdialog = True End Sub Public Sub SetRCodeForControls(bReset As Boolean) - ucrReceiverObject.AddAdditionalCodeParameterPair(clsRBootFunction, New RParameter("f"), iAdditionalPairNo:=1) + ucrReceiverObject.AddAdditionalCodeParameterPair(clsRBootFunction, New RParameter("f", 0), iAdditionalPairNo:=1) + ucrReceiverObject.AddAdditionalCodeParameterPair(clsRPlotFunction, New RParameter("x", 0), iAdditionalPairNo:=2) ucrChkProduceBootstrap.SetRCode(clsRBootFunction, bReset) ucrNewDataFrameName.SetRCode(clsQuantileFunction, bReset) ucrSaveObjects.SetRCode(clsRBootFunction, bReset) @@ -124,12 +129,12 @@ Public Class dlgOneVarUseModel Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk If ucrChkProduceBootstrap.Checked Then - frmMain.clsRLink.RunScript(clsRBootFunction.ToScript(), iCallType:=2) + frmMain.clsRLink.RunScript(clsRBootFunction.ToScript(), iCallType:=3) End If End Sub - Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk - sdgOneVarUseModFit.CreateGraphs() + Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk + frmMain.clsRLink.RunScript(clsRPlotFunction.ToScript(), iCallType:=3) End Sub ' Private Sub AssignSaveObjects() @@ -149,9 +154,10 @@ Public Class dlgOneVarUseModel End Sub Private Sub cmdFitModel_Click(sender As Object, e As EventArgs) Handles cmdFitModelandBootstrap.Click - sdgOneVarUseModFit.SetRFunction(clsSeqFunction, clsRBootFunction, clsQuantileFunction, clsReceiver, bResetSubdialog) + sdgOneVarUseModFit.SetRFunction(clsSeqFunction, clsRBootFunction, clsQuantileFunction, clsReceiver, clsRPlotFunction, bResetSubdialog) bResetSubdialog = False - sdgOneVarUseModFit.ShowDialog() + sdgOneVarUseModFit.ShowDialog() + sdgOneVarUseModFit.SetPlotOptions() End Sub Private Sub ucrChkProduceBootstrap_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkProduceBootstrap.ControlValueChanged diff --git a/instat/sdgOneVarUseModFit.Designer.vb b/instat/sdgOneVarUseModFit.Designer.vb index b89f34457a2..ea6cbf1a8b8 100644 --- a/instat/sdgOneVarUseModFit.Designer.vb +++ b/instat/sdgOneVarUseModFit.Designer.vb @@ -22,24 +22,15 @@ Partial Class sdgOneVarUseModFit 'Do not modify it using the code editor. Private Sub InitializeComponent() - Me.ucrBase = New instat.ucrButtonsSubdialogue() Me.tbBootstrapOptions = New System.Windows.Forms.TabPage() - Me.ucrChkParametric = New instat.ucrCheck() Me.lblNumberOfIterations = New System.Windows.Forms.Label() - Me.ucrNudIterations = New instat.ucrNud() Me.lblCI = New System.Windows.Forms.Label() - Me.ucrNudCI = New instat.ucrNud() Me.tbQuantiles = New System.Windows.Forms.TabPage() - Me.ucrInputQuantiles = New instat.ucrInputComboBox() - Me.ucrNudBy = New instat.ucrNud() - Me.ucrNudTo = New instat.ucrNud() - Me.ucrNudFrom = New instat.ucrNud() Me.lblFrom = New System.Windows.Forms.Label() Me.lblTo = New System.Windows.Forms.Label() Me.rdoSequence = New System.Windows.Forms.RadioButton() Me.rdoInsertValues = New System.Windows.Forms.RadioButton() Me.lblBy = New System.Windows.Forms.Label() - Me.ucrPnlQuantiles = New instat.UcrPanel() Me.tbPlots = New System.Windows.Forms.TabPage() Me.rdoNoPlot = New System.Windows.Forms.RadioButton() Me.rdoPlotAll = New System.Windows.Forms.RadioButton() @@ -48,27 +39,29 @@ Partial Class sdgOneVarUseModFit Me.rdoDensityPlot = New System.Windows.Forms.RadioButton() Me.rdoQQPlot = New System.Windows.Forms.RadioButton() Me.rdoCIcdf = New System.Windows.Forms.RadioButton() - Me.ucrPnlPlots = New instat.UcrPanel() Me.tbOneVarUseModFit = New System.Windows.Forms.TabControl() + Me.ucrPnlPlots = New instat.UcrPanel() + Me.ucrInputQuantiles = New instat.ucrInputComboBox() + Me.ucrNudBy = New instat.ucrNud() + Me.ucrNudTo = New instat.ucrNud() + Me.ucrNudFrom = New instat.ucrNud() + Me.ucrPnlQuantiles = New instat.UcrPanel() + Me.ucrChkParametric = New instat.ucrCheck() + Me.ucrNudIterations = New instat.ucrNud() + Me.ucrNudCI = New instat.ucrNud() + Me.ucrBase = New instat.ucrButtonsSubdialogue() Me.tbBootstrapOptions.SuspendLayout() Me.tbQuantiles.SuspendLayout() Me.tbPlots.SuspendLayout() Me.tbOneVarUseModFit.SuspendLayout() Me.SuspendLayout() ' - 'ucrBase - ' - Me.ucrBase.Location = New System.Drawing.Point(59, 216) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(142, 30) - Me.ucrBase.TabIndex = 0 - ' 'tbBootstrapOptions ' Me.tbBootstrapOptions.Controls.Add(Me.ucrChkParametric) Me.tbBootstrapOptions.Controls.Add(Me.lblNumberOfIterations) - Me.tbBootstrapOptions.Controls.Add(Me.ucrNudIterations) Me.tbBootstrapOptions.Controls.Add(Me.lblCI) + Me.tbBootstrapOptions.Controls.Add(Me.ucrNudIterations) Me.tbBootstrapOptions.Controls.Add(Me.ucrNudCI) Me.tbBootstrapOptions.Location = New System.Drawing.Point(4, 22) Me.tbBootstrapOptions.Name = "tbBootstrapOptions" @@ -78,14 +71,6 @@ Partial Class sdgOneVarUseModFit Me.tbBootstrapOptions.Text = "Bootstrap Options" Me.tbBootstrapOptions.UseVisualStyleBackColor = True ' - 'ucrChkParametric - ' - Me.ucrChkParametric.Checked = False - Me.ucrChkParametric.Location = New System.Drawing.Point(14, 71) - Me.ucrChkParametric.Name = "ucrChkParametric" - Me.ucrChkParametric.Size = New System.Drawing.Size(140, 20) - Me.ucrChkParametric.TabIndex = 4 - ' 'lblNumberOfIterations ' Me.lblNumberOfIterations.AutoSize = True @@ -95,18 +80,6 @@ Partial Class sdgOneVarUseModFit Me.lblNumberOfIterations.TabIndex = 0 Me.lblNumberOfIterations.Text = "Number of Iterations:" ' - 'ucrNudIterations - ' - Me.ucrNudIterations.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudIterations.Increment = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudIterations.Location = New System.Drawing.Point(129, 9) - Me.ucrNudIterations.Maximum = New Decimal(New Integer() {10001, 0, 0, 0}) - Me.ucrNudIterations.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudIterations.Name = "ucrNudIterations" - Me.ucrNudIterations.Size = New System.Drawing.Size(50, 20) - Me.ucrNudIterations.TabIndex = 1 - Me.ucrNudIterations.Value = New Decimal(New Integer() {1001, 0, 0, 0}) - ' 'lblCI ' Me.lblCI.AutoSize = True @@ -116,18 +89,6 @@ Partial Class sdgOneVarUseModFit Me.lblCI.TabIndex = 2 Me.lblCI.Text = "Confidence Interval:" ' - 'ucrNudCI - ' - Me.ucrNudCI.DecimalPlaces = New Decimal(New Integer() {2, 0, 0, 0}) - Me.ucrNudCI.Increment = New Decimal(New Integer() {5, 0, 0, 131072}) - Me.ucrNudCI.Location = New System.Drawing.Point(129, 35) - Me.ucrNudCI.Maximum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudCI.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudCI.Name = "ucrNudCI" - Me.ucrNudCI.Size = New System.Drawing.Size(50, 20) - Me.ucrNudCI.TabIndex = 3 - Me.ucrNudCI.Value = New Decimal(New Integer() {95, 0, 0, 131072}) - ' 'tbQuantiles ' Me.tbQuantiles.Controls.Add(Me.ucrInputQuantiles) @@ -148,51 +109,6 @@ Partial Class sdgOneVarUseModFit Me.tbQuantiles.Text = "Quantiles" Me.tbQuantiles.UseVisualStyleBackColor = True ' - 'ucrInputQuantiles - ' - Me.ucrInputQuantiles.AddQuotesIfUnrecognised = True - Me.ucrInputQuantiles.IsReadOnly = False - Me.ucrInputQuantiles.Location = New System.Drawing.Point(50, 144) - Me.ucrInputQuantiles.Name = "ucrInputQuantiles" - Me.ucrInputQuantiles.Size = New System.Drawing.Size(137, 21) - Me.ucrInputQuantiles.TabIndex = 9 - ' - 'ucrNudBy - ' - Me.ucrNudBy.DecimalPlaces = New Decimal(New Integer() {2, 0, 0, 0}) - Me.ucrNudBy.Increment = New Decimal(New Integer() {5, 0, 0, 131072}) - Me.ucrNudBy.Location = New System.Drawing.Point(79, 91) - Me.ucrNudBy.Maximum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudBy.Minimum = New Decimal(New Integer() {1, 0, 0, 196608}) - Me.ucrNudBy.Name = "ucrNudBy" - Me.ucrNudBy.Size = New System.Drawing.Size(53, 20) - Me.ucrNudBy.TabIndex = 7 - Me.ucrNudBy.Value = New Decimal(New Integer() {1, 0, 0, 65536}) - ' - 'ucrNudTo - ' - Me.ucrNudTo.DecimalPlaces = New Decimal(New Integer() {2, 0, 0, 0}) - Me.ucrNudTo.Increment = New Decimal(New Integer() {5, 0, 0, 131072}) - Me.ucrNudTo.Location = New System.Drawing.Point(79, 65) - Me.ucrNudTo.Maximum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudTo.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudTo.Name = "ucrNudTo" - Me.ucrNudTo.Size = New System.Drawing.Size(52, 20) - Me.ucrNudTo.TabIndex = 5 - Me.ucrNudTo.Value = New Decimal(New Integer() {1, 0, 0, 0}) - ' - 'ucrNudFrom - ' - Me.ucrNudFrom.DecimalPlaces = New Decimal(New Integer() {2, 0, 0, 0}) - Me.ucrNudFrom.Increment = New Decimal(New Integer() {5, 0, 0, 131072}) - Me.ucrNudFrom.Location = New System.Drawing.Point(79, 39) - Me.ucrNudFrom.Maximum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudFrom.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudFrom.Name = "ucrNudFrom" - Me.ucrNudFrom.Size = New System.Drawing.Size(52, 20) - Me.ucrNudFrom.TabIndex = 2 - Me.ucrNudFrom.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'lblFrom ' Me.lblFrom.AutoSize = True @@ -242,13 +158,6 @@ Partial Class sdgOneVarUseModFit Me.lblBy.TabIndex = 6 Me.lblBy.Text = "By:" ' - 'ucrPnlQuantiles - ' - Me.ucrPnlQuantiles.Location = New System.Drawing.Point(5, 12) - Me.ucrPnlQuantiles.Name = "ucrPnlQuantiles" - Me.ucrPnlQuantiles.Size = New System.Drawing.Size(227, 164) - Me.ucrPnlQuantiles.TabIndex = 3 - ' 'tbPlots ' Me.tbPlots.Controls.Add(Me.rdoNoPlot) @@ -339,13 +248,6 @@ Partial Class sdgOneVarUseModFit Me.rdoCIcdf.Text = "CDF Plot with Confidence Intervals" Me.rdoCIcdf.UseVisualStyleBackColor = True ' - 'ucrPnlPlots - ' - Me.ucrPnlPlots.Location = New System.Drawing.Point(6, 11) - Me.ucrPnlPlots.Name = "ucrPnlPlots" - Me.ucrPnlPlots.Size = New System.Drawing.Size(227, 160) - Me.ucrPnlPlots.TabIndex = 0 - ' 'tbOneVarUseModFit ' Me.tbOneVarUseModFit.Controls.Add(Me.tbPlots) @@ -357,6 +259,104 @@ Partial Class sdgOneVarUseModFit Me.tbOneVarUseModFit.Size = New System.Drawing.Size(249, 205) Me.tbOneVarUseModFit.TabIndex = 0 ' + 'ucrPnlPlots + ' + Me.ucrPnlPlots.Location = New System.Drawing.Point(6, 6) + Me.ucrPnlPlots.Name = "ucrPnlPlots" + Me.ucrPnlPlots.Size = New System.Drawing.Size(227, 165) + Me.ucrPnlPlots.TabIndex = 0 + ' + 'ucrInputQuantiles + ' + Me.ucrInputQuantiles.AddQuotesIfUnrecognised = True + Me.ucrInputQuantiles.IsReadOnly = False + Me.ucrInputQuantiles.Location = New System.Drawing.Point(50, 144) + Me.ucrInputQuantiles.Name = "ucrInputQuantiles" + Me.ucrInputQuantiles.Size = New System.Drawing.Size(137, 21) + Me.ucrInputQuantiles.TabIndex = 9 + ' + 'ucrNudBy + ' + Me.ucrNudBy.DecimalPlaces = New Decimal(New Integer() {2, 0, 0, 0}) + Me.ucrNudBy.Increment = New Decimal(New Integer() {5, 0, 0, 131072}) + Me.ucrNudBy.Location = New System.Drawing.Point(79, 91) + Me.ucrNudBy.Maximum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudBy.Minimum = New Decimal(New Integer() {1, 0, 0, 196608}) + Me.ucrNudBy.Name = "ucrNudBy" + Me.ucrNudBy.Size = New System.Drawing.Size(53, 20) + Me.ucrNudBy.TabIndex = 7 + Me.ucrNudBy.Value = New Decimal(New Integer() {1, 0, 0, 65536}) + ' + 'ucrNudTo + ' + Me.ucrNudTo.DecimalPlaces = New Decimal(New Integer() {2, 0, 0, 0}) + Me.ucrNudTo.Increment = New Decimal(New Integer() {5, 0, 0, 131072}) + Me.ucrNudTo.Location = New System.Drawing.Point(79, 65) + Me.ucrNudTo.Maximum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudTo.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTo.Name = "ucrNudTo" + Me.ucrNudTo.Size = New System.Drawing.Size(52, 20) + Me.ucrNudTo.TabIndex = 5 + Me.ucrNudTo.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'ucrNudFrom + ' + Me.ucrNudFrom.DecimalPlaces = New Decimal(New Integer() {2, 0, 0, 0}) + Me.ucrNudFrom.Increment = New Decimal(New Integer() {5, 0, 0, 131072}) + Me.ucrNudFrom.Location = New System.Drawing.Point(79, 39) + Me.ucrNudFrom.Maximum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudFrom.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudFrom.Name = "ucrNudFrom" + Me.ucrNudFrom.Size = New System.Drawing.Size(52, 20) + Me.ucrNudFrom.TabIndex = 2 + Me.ucrNudFrom.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrPnlQuantiles + ' + Me.ucrPnlQuantiles.Location = New System.Drawing.Point(5, 12) + Me.ucrPnlQuantiles.Name = "ucrPnlQuantiles" + Me.ucrPnlQuantiles.Size = New System.Drawing.Size(227, 164) + Me.ucrPnlQuantiles.TabIndex = 3 + ' + 'ucrChkParametric + ' + Me.ucrChkParametric.Checked = False + Me.ucrChkParametric.Location = New System.Drawing.Point(14, 71) + Me.ucrChkParametric.Name = "ucrChkParametric" + Me.ucrChkParametric.Size = New System.Drawing.Size(140, 20) + Me.ucrChkParametric.TabIndex = 4 + ' + 'ucrNudIterations + ' + Me.ucrNudIterations.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudIterations.Increment = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudIterations.Location = New System.Drawing.Point(129, 9) + Me.ucrNudIterations.Maximum = New Decimal(New Integer() {10001, 0, 0, 0}) + Me.ucrNudIterations.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudIterations.Name = "ucrNudIterations" + Me.ucrNudIterations.Size = New System.Drawing.Size(50, 20) + Me.ucrNudIterations.TabIndex = 1 + Me.ucrNudIterations.Value = New Decimal(New Integer() {1001, 0, 0, 0}) + ' + 'ucrNudCI + ' + Me.ucrNudCI.DecimalPlaces = New Decimal(New Integer() {2, 0, 0, 0}) + Me.ucrNudCI.Increment = New Decimal(New Integer() {5, 0, 0, 131072}) + Me.ucrNudCI.Location = New System.Drawing.Point(129, 35) + Me.ucrNudCI.Maximum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudCI.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudCI.Name = "ucrNudCI" + Me.ucrNudCI.Size = New System.Drawing.Size(50, 20) + Me.ucrNudCI.TabIndex = 3 + Me.ucrNudCI.Value = New Decimal(New Integer() {95, 0, 0, 131072}) + ' + 'ucrBase + ' + Me.ucrBase.Location = New System.Drawing.Point(59, 216) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(142, 30) + Me.ucrBase.TabIndex = 0 + ' 'sdgOneVarUseModFit ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/instat/sdgOneVarUseModFit.vb b/instat/sdgOneVarUseModFit.vb index d46aed9733e..738295e3a8a 100644 --- a/instat/sdgOneVarUseModFit.vb +++ b/instat/sdgOneVarUseModFit.vb @@ -13,11 +13,11 @@ ' ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . -Imports instat + Imports instat.Translations Public Class sdgOneVarUseModFit Private bControlsInitialised As Boolean = False - Private clsRSeqFunction, clsOneVarRBootFunction, clsOneVarQuantileFunction, clsRPlotFunction, clsRBootFunction, clsRReceiver As New RFunction + Private clsRSeqFunction, clsOneVarRBootFunction, clsOneVarQuantileFunction, clsRBootFunction, clsRReceiver, clsRPlotFunction As New RFunction Public bfirstload As Boolean = True Private Sub sdgOneVarFitModDisplay(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) @@ -65,10 +65,9 @@ Public Class sdgOneVarUseModFit dctQuantileValues.Add("0.25, 0.5, 0.75", "0.25, 0.5, 0.75") dctQuantileValues.Add("0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9", "0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9") ucrInputQuantiles.SetItems(dctQuantileValues) - ucrInputQuantiles.SetRDefault("0.25, 0.5, 0.75") + 'ucrInputQuantiles.SetRDefault("0.25, 0.5, 0.75") ucrInputQuantiles.SetValidationTypeAsNumericList(MinValue:=0, MaxValue:=1) - ucrPnlQuantiles.AddToLinkedControls(ucrInputQuantiles, {rdoInsertValues}, bNewLinkedAddRemoveParameter:=True, bNewLinkedDisabledIfParameterMissing:=True) ucrPnlQuantiles.AddToLinkedControls(ucrNudTo, {rdoSequence}, bNewLinkedAddRemoveParameter:=True, bNewLinkedDisabledIfParameterMissing:=True) ucrPnlQuantiles.AddToLinkedControls(ucrNudFrom, {rdoSequence}, bNewLinkedAddRemoveParameter:=True, bNewLinkedDisabledIfParameterMissing:=True) @@ -76,18 +75,37 @@ Public Class sdgOneVarUseModFit ucrNudTo.SetLinkedDisplayControl(lblTo) ucrNudFrom.SetLinkedDisplayControl(lblFrom) ucrNudBy.SetLinkedDisplayControl(lblBy) + + ucrPnlPlots.AddRadioButton(rdoNoPlot) + ucrPnlPlots.AddRadioButton(rdoPlotAll) + ucrPnlPlots.AddRadioButton(rdoPPPlot) + ucrPnlPlots.AddRadioButton(rdoCDFPlot) + ucrPnlPlots.AddRadioButton(rdoQQPlot) + ucrPnlPlots.AddRadioButton(rdoDensityPlot) + ucrPnlPlots.AddRadioButton(rdoCIcdf) + + ucrPnlPlots.AddFunctionNamesCondition(rdoNoPlot, "") + ucrPnlPlots.AddFunctionNamesCondition(rdoPlotAll, "plot") + ucrPnlPlots.AddFunctionNamesCondition(rdoPPPlot, "ppcomp") + ucrPnlPlots.AddFunctionNamesCondition(rdoCDFPlot, "cdfcomp") + ucrPnlPlots.AddFunctionNamesCondition(rdoQQPlot, "qqcomp") + ucrPnlPlots.AddFunctionNamesCondition(rdoDensityPlot, "denscomp") + ucrPnlPlots.AddFunctionNamesCondition(rdoCIcdf, "CIcdfplot") + rdoNoPlot.Enabled = False ' temporary bControlsInitialised = True End Sub - Public Sub SetRFunction(clsNewRSeqFunction As RFunction, clsNewRbootFunction As RFunction, clsNewQuantileFunction As RFunction, clsNewReceiver As RFunction, Optional bReset As Boolean = False) + Public Sub SetRFunction(clsNewRSeqFunction As RFunction, clsNewRBootFunction As RFunction, clsNewQuantileFunction As RFunction, clsNewReceiver As RFunction, clsNewPlotFunction As RFunction, Optional bReset As Boolean = False) If Not bControlsInitialised Then InitialiseControls() End If + clsRSeqFunction = clsNewRSeqFunction - clsOneVarRBootFunction = clsNewRbootFunction + clsOneVarRBootFunction = clsNewRBootFunction clsOneVarQuantileFunction = clsNewQuantileFunction clsRReceiver = clsNewReceiver + clsRPlotFunction = clsNewPlotFunction 'Setting Rcode for the sub dialog ucrNudFrom.SetRCode(clsRSeqFunction, bReset) @@ -96,46 +114,45 @@ Public Class sdgOneVarUseModFit ucrChkParametric.SetRCode(clsOneVarRBootFunction, bReset) ucrNudIterations.SetRCode(clsOneVarRBootFunction, bReset) ucrNudCI.SetRCode(clsOneVarQuantileFunction, bReset) - + ucrPnlPlots.SetRCode(clsRPlotFunction, bReset) + ucrPnlQuantiles.SetRCode(clsOneVarQuantileFunction, bReset) End Sub - - Public Sub SetDefaults() - rdoPlotAll.Checked = True - rdoSequence.Checked = True - ucrInputQuantiles.Enabled = False - SetPlotOptions() - End Sub Public Sub CreateGraphs() If rdoPlotAll.Checked Then - clsRPlotFunction.ClearParameters() + clsRPlotFunction.ClearParameters() + clsRPlotFunction.SetPackageName("graphics") clsRPlotFunction.SetRCommand("plot") clsRPlotFunction.AddParameter("x", clsRFunctionParameter:=clsRReceiver) - ElseIf rdoPPPlot.Checked Then - clsRPlotFunction.ClearParameters() + ElseIf rdoPPPlot.Checked Then + clsRPlotFunction.ClearParameters() + clsRPlotFunction.SetPackageName("fitdistrplus") clsRPlotFunction.SetRCommand("ppcomp") clsRPlotFunction.AddParameter("ft", clsRFunctionParameter:=clsRReceiver) ElseIf rdoCDFPlot.Checked Then - clsRPlotFunction.ClearParameters() + clsRPlotFunction.ClearParameters() + clsRPlotFunction.SetPackageName("fitdistrplus") clsRPlotFunction.SetRCommand("cdfcomp") clsRPlotFunction.AddParameter("ft", clsRFunctionParameter:=clsRReceiver) ElseIf rdoQQPlot.Checked Then - clsRPlotFunction.ClearParameters() + clsRPlotFunction.ClearParameters() + clsRPlotFunction.SetPackageName("fitdistrplus") clsRPlotFunction.SetRCommand("qqcomp") clsRPlotFunction.AddParameter("ft", clsRFunctionParameter:=clsRReceiver) ElseIf rdoDensityPlot.Checked Then - clsRPlotFunction.ClearParameters() + clsRPlotFunction.ClearParameters() + clsRPlotFunction.SetPackageName("fitdistrplus") clsRPlotFunction.SetRCommand("denscomp") clsRPlotFunction.AddParameter("ft", clsRFunctionParameter:=clsRReceiver) ElseIf rdoCIcdf.Checked Then - clsRPlotFunction.ClearParameters() + clsRPlotFunction.ClearParameters() + clsRPlotFunction.SetPackageName("fitdistrplus") clsRPlotFunction.SetRCommand("CIcdfplot") dlgOneVarUseModel.clsRBootFunction.RemoveParameterByName("bootmethod") dlgOneVarUseModel.clsRBootFunction.RemoveParameterByName("niter") clsRPlotFunction.AddParameter("b", clsRFunctionParameter:=clsOneVarRBootFunction) clsRPlotFunction.AddParameter("CI.output", Chr(34) & "quantile" & Chr(34)) End If - frmMain.clsRLink.RunScript(clsRPlotFunction.ToScript(), iCallType:=2) End Sub Public Sub SetPlotOptions() @@ -153,5 +170,6 @@ Public Class sdgOneVarUseModFit Private Sub ucrBase_ClickReturn(sender As Object, e As EventArgs) Handles ucrBase.ClickReturn dlgOneVarUseModel.QuantileCommand() + CreateGraphs() End Sub End Class \ No newline at end of file