forked from IDEMSInternational/R-Instat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #980 from nyagishira/dlgOneWayANOVA
dlgOneWayANOVA
- Loading branch information
Showing
4 changed files
with
286 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,83 @@ | ||
' Instat-R | ||
' Copyright (C) 2015 | ||
' | ||
' 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 k | ||
' along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
' Instat-R | ||
' Copyright (C) 2015 | ||
' | ||
' 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 k | ||
' along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
Imports instat.Translations | ||
|
||
Public Class dlgOneWayANOVA | ||
Private Sub dlgOneWayAnova_Load(sender As Object, e As EventArgs) Handles MyBase.Load | ||
|
||
Public bFirstLoad As Boolean = True | ||
Dim clsModel As New ROperator | ||
|
||
Private Sub dlgOneWayAnova_Load(sender As Object, e As EventArgs) Handles MyBase.Load | ||
If bFirstLoad Then | ||
InitialiseDialog() | ||
SetDefaultSettings() | ||
bFirstLoad = False | ||
End If | ||
|
||
End Sub | ||
|
||
Private Sub InitialiseDialog() | ||
ucrBase.clsRsyntax.SetFunction("aov") | ||
ucrBase.clsRsyntax.iCallType = 2 | ||
ucrYVariate.Selector = ucrAddRemoveDataFrame | ||
ucrYVariate.SetMeAsReceiver() | ||
ucrFactor.Selector = ucrAddRemoveDataFrame | ||
ucrFactor.SetDataType("factor") | ||
ucrBase.clsRsyntax.AddParameter("data", clsRFunctionParameter:=ucrAddRemoveDataFrame.ucrAvailableDataFrames.clsCurrDataFrame) | ||
clsModel.SetOperation("~") | ||
|
||
autoTranslate(Me) | ||
Fillformula() | ||
|
||
ucrBase.iHelpTopicID = 315 | ||
End Sub | ||
|
||
Private Sub SetDefaultSettings() | ||
ucrAddRemoveDataFrame.Reset() | ||
ucrAddRemoveDataFrame.Focus() | ||
ucrYVariate.SetMeAsReceiver() | ||
TestOKEnabled() | ||
|
||
Private Sub ucrYVariate_ValueChanged(sender As Object, e As EventArgs) Handles ucrYVariate.ValueChanged | ||
Fillformula() | ||
End Sub | ||
|
||
Private Sub ucrFactor_ValueChanged(sender As Object, e As EventArgs) Handles ucrFactor.ValueChanged | ||
Fillformula() | ||
End Sub | ||
Private Sub Fillformula() | ||
Dim strFactor As String = "" | ||
Dim strYVariate As String = "" | ||
strYVariate = ucrYVariate.GetVariableNames(bWithQuotes:=False) | ||
strFactor = ucrFactor.GetVariableNames(bWithQuotes:=False) | ||
|
||
If ((Not (strYVariate = "")) And (Not (strFactor = ""))) Then | ||
ucrBase.clsRsyntax.AddParameter("formula", strYVariate & "~" & strFactor) | ||
Private Sub ucrYVariate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrYVariate.SelectionChanged | ||
clsModel.SetParameter(True, strValue:=ucrYVariate.GetVariableNames(bWithQuotes:=False)) | ||
TestOKEnabled() | ||
End Sub | ||
|
||
Private Sub ucrFactor_SelectionChanged(sender As Object, e As EventArgs) Handles ucrFactor.SelectionChanged | ||
clsModel.SetParameter(False, strValue:=ucrFactor.GetVariableNames(bWithQuotes:=False)) | ||
TestOKEnabled() | ||
End Sub | ||
|
||
Private Sub TestOKEnabled() | ||
If (Not ucrYVariate.IsEmpty()) And (Not ucrFactor.IsEmpty()) Then | ||
ucrBase.clsRsyntax.AddParameter("formula", clsROperatorParameter:=clsModel) | ||
ucrBase.OKEnabled(True) | ||
Else | ||
ucrBase.OKEnabled(False) | ||
End If | ||
End Sub | ||
|
||
Private Sub ucrAddRemoveDataframe_Leave(sender As Object, e As EventArgs) Handles ucrAddRemoveDataFrame.Leave | ||
Private Sub ucrAddRemoveDataframe_DataFrameChanged() Handles ucrAddRemoveDataFrame.DataFrameChanged | ||
ucrBase.clsRsyntax.AddParameter("data", clsRFunctionParameter:=ucrAddRemoveDataFrame.ucrAvailableDataFrames.clsCurrDataFrame) | ||
End Sub | ||
|
||
Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click | ||
sdgOptions.ShowDialog() | ||
sdgANOVAOptions.ShowDialog() | ||
End Sub | ||
Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset | ||
SetDefaultSettings() | ||
End Sub | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
' Instat-R | ||
' Copyright (C) 2015 | ||
' | ||
' 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 k | ||
' along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
Imports instat.Translations | ||
|
||
Public Class sdgANOVAOptions | ||
|
||
Public clsRModelFunction As RFunction | ||
Public clsRaovFunction As New RFunction | ||
Public bFirstLoad As Boolean = True | ||
|
||
|
||
Private Sub sdgANOVAOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load | ||
|
||
autoTranslate(Me) | ||
|
||
If bFirstLoad Then | ||
SetDefaultSettings() | ||
bFirstLoad = False | ||
End If | ||
End Sub | ||
|
||
Public Sub SetRModelFunction(clsRModelFunc As RFunction) | ||
clsRModelFunction = clsRModelFunc | ||
End Sub | ||
|
||
Public Sub SetDefaultSettings() | ||
chkANOVATable.Checked = True | ||
End Sub | ||
|
||
Private Sub AnovaTable() | ||
clsRaovFunction.SetRCommand("aov") | ||
clsRaovFunction.AddParameter("", clsRFunctionParameter:=clsRModelFunction) | ||
frmMain.clsRLink.RunScript(clsRaovFunction.ToScript(), 2) | ||
End Sub | ||
|
||
Public Sub Estimates() | ||
If (chkANOVATable.Checked) Then | ||
AnovaTable() | ||
End If | ||
End Sub | ||
|
||
End Class |