Skip to content

Commit 2c9b660

Browse files
authored
Fix selection of modules in issue jasp-stats/jasp-test-release#2895 (#72)
This should resolve the issue where model names were not specified correctly, and thus the analysis broke and closes jasp-stats/jasp-test-release#2895 It also fixes the issue that after changing code in the .createModelListHelper function, the .predanFuturePredictionPlot broke to some extent. This is a regression issue, so perhaps the problem was with the qml elements? I am not sure why it broke.
1 parent a73f9eb commit 2c9b660

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

R/predictiveAnalytics.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,9 +1086,9 @@ lagit <- function(a,k) {
10861086

10871087

10881088

1089-
shortNames <- modNames[selectedModels]
10901089

1091-
res <- lapply(shortNames, function(x){
1090+
1091+
res <- lapply(selectedModels, function(x){
10921092
names(selectedModels) <- selectedModels
10931093
model <- gsub("Lag|Reg","",x)
10941094

@@ -1107,6 +1107,8 @@ lagit <- function(a,k) {
11071107

11081108
return(list(model = model,modelFormula = modelFormula,modelName = names(modNames)[modNames==x]))
11091109
})
1110+
names(res) <- names(selectedModels)
1111+
return(res)
11101112
}
11111113

11121114

@@ -1926,16 +1928,16 @@ lagit <- function(a,k) {
19261928

19271929

19281930
colnames(dataOld)[1] <- 'mean'
1929-
dataOld <- tail(dataOld,500)
1931+
#dataOld <- tail(dataOld,500)
19301932
predictionsCombined <- rbind(dataOld,predictionsCombined)
19311933

19321934
modelList <- .createModelListHelper(dataEng,options$selectedModels)
19331935

19341936

1935-
modelNames <- paste0(sapply(modelList,'[', "model"),1:length(modelList))
1936-
names(modelNames) <- names(modelList)
1937+
modelIds <- paste0(sapply(modelList,'[', "model"),1:length(modelList))
1938+
19371939

1938-
selectedModPlot <- modelNames[names(modelNames) ==options$"selectedFuturePredictionModel"]
1940+
selectedModPlot <- modelIds[sapply(modelList,'[', "model") == options$"selectedFuturePredictionModel"]
19391941
if("BMA" %in% unique(predictionsCombined$model) & options$"selectedFuturePredictionModel" == "BMA")
19401942
selectedModPlot <- "BMA"
19411943

0 commit comments

Comments
 (0)