Skip to content

Commit d323f12

Browse files
committed
restructure qml elements
1 parent 9d14427 commit d323f12

19 files changed

+562
-764
lines changed

R/exploratoryfactoranalysis.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ exploratoryFactorAnalysisInternal <- function(jaspResults, dataset, options, ...
357357
return()
358358

359359
loadingsTable <- createJaspTable(gettext("Factor Loadings"))
360-
loadingsTable$dependOn(c("loadingsDisplayLimit", "factorLoadingsOrder"))
360+
loadingsTable$dependOn(c("loadingsDisplayLimit", "loadingsOrder"))
361361
loadingsTable$position <- 2
362362

363363
loadingsTable$addColumnInfo(name = "var", title = "", type = "string")
@@ -394,7 +394,7 @@ exploratoryFactorAnalysisInternal <- function(jaspResults, dataset, options, ...
394394
colnames(df)[2:(1 + ncol(loads))] <- paste0("c", seq_len(ncol(loads)))
395395

396396
# "sortByVariables" is the default output
397-
if (options[["factorLoadingsOrder"]] == "sortByFactorSize")
397+
if (options[["loadingsOrder"]] == "sortBySize")
398398
df <- df[do.call(order, c(abs(df[2:(ncol(df) - 1)]), na.last = TRUE, decreasing = TRUE)), ]
399399

400400
loadingsTable$setData(df)

R/exploratoryfactoranalysisWrapper.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ exploratoryFactorAnalysis <- function(
2828
eigenValuesAbove = 1,
2929
factorCorrelations = FALSE,
3030
factorCountMethod = "parallelAnalysis",
31-
factorLoadingsOrder = "sortByFactorSize",
31+
loadingsOrder = "sortBySize",
3232
factorStructure = FALSE,
3333
factoringMethod = "minimumResidual",
3434
fitIndices = FALSE,

R/principalcomponentanalysis.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ principalComponentAnalysisInternal <- function(jaspResults, dataset, options, ..
310310
if (!is.null(modelContainer[["loadingsTable"]])) return()
311311

312312
loadingsTable <- createJaspTable(gettext("Component Loadings"))
313-
loadingsTable$dependOn(c("loadingsDisplayLimit", "componentLoadingsOrder"))
313+
loadingsTable$dependOn(c("loadingsDisplayLimit", "loadingsOrder"))
314314
loadingsTable$position <- 2
315315
loadingsTable$addColumnInfo(name = "var", title = "", type = "string")
316316
modelContainer[["loadingsTable"]] <- loadingsTable
@@ -347,7 +347,7 @@ principalComponentAnalysisInternal <- function(jaspResults, dataset, options, ..
347347
colnames(df)[2:(1 + ncol(loads))] <- paste0("c", seq_len(ncol(loads)))
348348

349349
# "sortByVariables" is the default output
350-
if (options[["componentLoadingsOrder"]] == "sortByComponentSize")
350+
if (options[["loadingsOrder"]] == "sortBySize")
351351
df <- df[do.call(order, c(abs(df[2:(ncol(df) - 1)]), na.last = TRUE, decreasing = TRUE)), ]
352352

353353
loadingsTable$setData(df)

R/principalcomponentanalysisWrapper.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ principalComponentAnalysis <- function(
2626
bartlettTest = FALSE,
2727
componentCorrelations = FALSE,
2828
componentCountMethod = "parallelAnalysis",
29-
componentLoadingsOrder = "sortByComponentSize",
29+
loadingsOrder = "sortBySize",
3030
dataType = "raw",
3131
eigenValuesAbove = 1,
3232
kaiserMeyerOlkinTest = FALSE,

inst/Upgrades.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Upgrades
116116
ChangeRename
117117
{
118118
from: "componentLoadingsSort"
119-
to: "componentLoadingsOrder"
119+
to: "loadingsOrder"
120120
}
121121
ChangeRename
122122
{
@@ -230,7 +230,7 @@ Upgrades
230230
ChangeRename
231231
{
232232
from: "factorLoadingsSort"
233-
to: "factorLoadingsOrder"
233+
to: "loadingsOrder"
234234
}
235235
ChangeRename
236236
{

inst/qml/ConfirmatoryFactorAnalysis.qml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,31 @@ Form
313313
label: qsTr("Missing data handling")
314314
values:
315315
[
316-
{ label: qsTr("Listwise deletion") , value: "listwise" },
317-
{ label: qsTr("FIML") , value: "fiml" },
316+
317+
{ label: qsTr("Listwise deletion"), value: "listwise"},
318+
{ label: qsTr("FIML") , value: "fiml"},
318319
{ label: qsTr("Pairwise") , value: "pairwise" },
319320
{ label: qsTr("Two-stage") , value: "twoStage" },
320321
{ label: qsTr("Robust two-stage") , value: "twoStageRobust" },
321322
]
322323
}
324+
// DropDown
325+
// {
326+
// name: "naAction"
327+
// label: qsTr("Missing data handling")
328+
// values:
329+
// [
330+
// { factors.columnsTypes.includes("ordinal") ?
331+
// {label: qsTr("Listwise deletion"), value: "listwise"} : {label: qsTr("FIML"), value: "fiml"}
332+
// },
333+
// { factors.columnsTypes.includes("ordinal") ?
334+
// {label: qsTr("FIML") , value: "fiml"} : {label: qsTr("Listwise deletion"), value: "listwise"}
335+
// },
336+
// { label: qsTr("Pairwise") , value: "pairwise" },
337+
// { label: qsTr("Two-stage") , value: "twoStage" },
338+
// { label: qsTr("Robust two-stage") , value: "twoStageRobust" },
339+
// ]
340+
// }
323341
}
324342

325343
RadioButtonGroup

inst/qml/ExploratoryFactorAnalysis.qml

Lines changed: 14 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
// License along with this program. If not, see
1616
// <http://www.gnu.org/licenses/>.
1717
//
18+
1819
import QtQuick
20+
import QtQuick.Layouts
1921
import JASP
2022
import JASP.Controls
23+
import "./common" as Common
2124

2225
Form
2326
{
@@ -52,243 +55,21 @@ Form
5255
}
5356
}
5457

55-
Group
56-
{
57-
RadioButtonGroup
58-
{
59-
name: "factorCountMethod"
60-
title: qsTr("Number of Factors based on")
61-
RadioButton
62-
{
63-
value: "parallelAnalysis";
64-
label: qsTr("Parallel analysis");
65-
checked: true
66-
67-
RadioButtonGroup
68-
{
69-
name: "parallelAnalysisMethod"
70-
title: ""
71-
72-
RadioButton
73-
{
74-
value: "principalComponentBased"
75-
label: qsTr("Based on PC")
76-
checked: true
77-
}
78-
RadioButton
79-
{
80-
value: "factorBased"
81-
label: qsTr("Based on FA")
82-
}
83-
}
84-
85-
SetSeed{}
86-
87-
}
88-
89-
RadioButton
90-
{
91-
value: "eigenValues"; label: qsTr("Eigenvalues")
92-
DoubleField {
93-
name: "eigenValuesAbove"
94-
label: qsTr("Eigenvalues above")
95-
defaultValue: 1
96-
decimals: 1
97-
}
98-
}
99-
RadioButton
100-
{
101-
value: "manual"; label: qsTr("Manual")
102-
IntegerField {
103-
name: "manualNumberOfFactors"
104-
label: qsTr("Number of factors")
105-
defaultValue: 1
106-
min: 1
107-
max: variables.count > 1 ? variables.count : 1
108-
109-
}
110-
}
111-
}
112-
113-
Group
114-
{
115-
title: qsTr("Factoring method")
116-
DropDown
117-
{
118-
name: "factoringMethod"
119-
indexDefaultValue: 0
120-
values:
121-
[
122-
{ label: qsTr("Minimum residual"), value: "minimumResidual" },
123-
{ label: qsTr("Maximum likelihood"), value: "maximumLikelihood" },
124-
{ label: qsTr("Principal axis factoring"), value: "principalAxis" },
125-
{ label: qsTr("Ordinary least squares"), value: "ordinaryLeastSquares" },
126-
{ label: qsTr("Weighted least squares"), value: "weightedLeastSquares" },
127-
{ label: qsTr("Generalized least squares"), value: "generalizedLeastSquares"},
128-
{ label: qsTr("Minimum chi-square"), value: "minimumChiSquare" },
129-
{ label: qsTr("Minimum rank"), value: "minimumRank" }
130-
]
131-
}
132-
}
133-
58+
Common.NumberFactors{
59+
pca: false
60+
variablesCount: variables.count
13461
}
13562

136-
137-
138-
Group
139-
{
140-
RadioButtonGroup
141-
{
142-
name: "rotationMethod"
143-
title: qsTr("Rotation")
144-
RadioButton
145-
{
146-
value : "orthogonal"
147-
label : qsTr("Orthogonal")
148-
DropDown
149-
{
150-
name: "orthogonalSelector"
151-
values: [
152-
{ label: qsTr("none") , value: "none" },
153-
{ label: "varimax" , value: "varimax" },
154-
{ label: "quartimax" , value: "quartimax" },
155-
{ label: "bentlerT" , value: "bentlerT" },
156-
{ label: "equamax" , value: "equamax" },
157-
{ label: "geominT" , value: "geominT" }
158-
]
159-
}
160-
}
161-
RadioButton
162-
{
163-
value : "oblique"
164-
label : qsTr("Oblique")
165-
checked : true
166-
DropDown { name: "obliqueSelector"; values: [ "promax", "oblimin", "simplimax", "bentlerQ", "cluster", "geominQ" ] }
167-
}
168-
}
169-
170-
RadioButtonGroup
171-
{
172-
name: "analysisBasedOn"
173-
title: qsTr("Base analysis on")
174-
RadioButton
175-
{
176-
value: "correlationMatrix"
177-
label: qsTr("Correlation matrix")
178-
checked: true
179-
}
180-
RadioButton
181-
{
182-
value: "covarianceMatrix"
183-
label: qsTr("Covariance matrix")
184-
}
185-
RadioButton
186-
{
187-
enabled: dataType.value == "raw"
188-
value: "polyTetrachoricCorrelationMatrix"
189-
label: qsTr("Polychoric/tetrachoric correlation matrix")
190-
}
191-
}
63+
Common.AnalysisOptions{
64+
pca: false
65+
dataRaw: dataType.value == "raw"
19266
}
19367

194-
Section
195-
{
196-
title: qsTr("Output Options")
197-
Group
198-
{
199-
Slider {
200-
name: "loadingsDisplayLimit"
201-
label: qsTr("Display loadings above")
202-
value: 0.4
203-
}
204-
RadioButtonGroup
205-
{
206-
name: "factorLoadingsOrder"
207-
title: qsTr("Order factor loadings by")
208-
RadioButton { name: "sortByFactorSize"; label: qsTr("Factor size"); checked: true }
209-
RadioButton { name: "sortByVariables"; label: qsTr("Variables") }
210-
}
211-
}
68+
Common.OutputOptions{
69+
pca: false
70+
dataRaw: dataType.value == "raw"
71+
variablesCount: variables.count
21272

213-
Group
214-
{
215-
Group
216-
{
217-
title: qsTr("Tables")
218-
CheckBox { name: "factorStructure"; label: qsTr("Structure matrix") }
219-
CheckBox { name: "factorCorrelations"; label: qsTr("Factor correlations") }
220-
CheckBox { name: "fitIndices"; label: qsTr("Additional fit indices") }
221-
CheckBox { name: "residualMatrix"; label: qsTr("Residual matrix") }
222-
CheckBox {
223-
name: "parallelAnalysisTable";
224-
label: qsTr("Parallel analysis")
225-
RadioButtonGroup
226-
{
227-
name: "parallelAnalysisTableMethod"
228-
title: ""
229-
230-
RadioButton
231-
{
232-
value: "principalComponentBased"
233-
label: qsTr("Based on PC")
234-
checked: true
235-
}
236-
RadioButton
237-
{
238-
value: "factorBased"
239-
label: qsTr("Based on FA")
240-
}
241-
}
242-
}
243-
}
244-
245-
Group
246-
{
247-
title: qsTr("Plots")
248-
CheckBox { name: "pathDiagram"; label: qsTr("Path diagram") }
249-
CheckBox {
250-
name: "screePlot";
251-
label: qsTr("Scree plot")
252-
253-
CheckBox {
254-
name: "screePlotParallelAnalysisResults"
255-
label: qsTr("Parallel analysis results")
256-
checked: true
257-
}
258-
}
259-
}
260-
}
261-
262-
263-
Group
264-
{
265-
title: qsTr("Assumption checks")
266-
CheckBox { name: "kaiserMeyerOlkinTest"; label: qsTr("KMO test") }
267-
CheckBox { name: "bartlettTest"; label: qsTr("Bartlett's test") }
268-
CheckBox { name: "mardiaTest"; label: qsTr("Mardia's test") ; enabled: dataType.value == "raw" }
269-
}
270-
RadioButtonGroup
271-
{
272-
name: "naAction"
273-
title: qsTr("Missing Values")
274-
RadioButton { value: "pairwise"; label: qsTr("Exclude cases pairwise"); checked: true }
275-
RadioButton { value: "listwise"; label: qsTr("Exclude cases listwise") }
276-
}
277-
278-
CheckBox
279-
{
280-
id: addScores
281-
name: "addScores"
282-
label: qsTr("Add FA scores to data")
283-
enabled: variables.count > 1 & dataType.value == "raw"
284-
285-
TextField {
286-
name: "addedScoresPrefix"
287-
label: qsTr("Prefix")
288-
defaultValue: "FA"
289-
fieldWidth: 80
290-
enabled: addScores.checked
291-
}
292-
}
29373
}
74+
29475
}

0 commit comments

Comments
 (0)