Skip to content

Commit b670a80

Browse files
committed
minor details
1 parent 943e4f6 commit b670a80

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

R/fqpca.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ plot.fqpca_object <- function(x, pve = 0.99, ...)
779779

780780
# Create the GGPlot object with facets displaying each component separately.
781781
p <- ggplot2::ggplot(plot_data, ggplot2::aes(x = .data$Time, y = .data$Loading)) +
782-
ggplot2::geom_line(color = "steelblue", linewidth = 1) +
782+
ggplot2::geom_line(color = "steelblue") +
783783
ggplot2::facet_wrap(~ Component, scales = "free_y", ncol = 3) +
784784
ggplot2::labs(title = "Loading Functions",
785785
x = "Time",

R/mfqpca.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ plot.mfqpca_object <- function(x, pve.between = 0.95, pve.within = 0.95, ...)
936936

937937
# Plot
938938
p <- ggplot2::ggplot(plot_data, ggplot2::aes(x = .data$Time, y = .data$Loading)) +
939-
ggplot2::geom_line(color = "steelblue", linewidth = 1) +
939+
ggplot2::geom_line(color = "steelblue") +
940940
ggplot2::facet_wrap(~ Component, scales = "free_y", ncol = 4) +
941941
ggplot2::labs(title = "Loading Functions", x = "Time", y = "Loading") +
942942
ggplot2::theme_bw()

R/utils.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ quantile_error <- function(Y, Y.pred, quantile.value)
4646
#' @export
4747
proportion_under_quantile <- function(Y, Y.pred)
4848
{
49-
mean(Y <= Y.pred, na.rm = T)
49+
mean(Y <= Y.pred, na.rm = TRUE)
5050
}
5151

5252
# VARIABILITY OF SCORES -------------------------------------------------------
@@ -72,14 +72,16 @@ obtain_npc <- function(scores, pve)
7272
npc <- ncol(scores)
7373
}else if(pve == 0){
7474
npc <- 0
75-
}else if(pve < 1){
75+
}else if(pve < 1 && pve > 0){
7676
score.variance <- cumsum(compute_explained_variability(scores))
7777
npc <- min(which(score.variance >= pve))
78-
}else
78+
}else if(pve >= 1)
7979
{
8080
if(!(pve == floor(pve))){stop('pve must be either a floating point number smaller than 1 or an integer number smaller than the number of pc. Value provided: ', pve)}
8181
if(pve > ncol(scores)){stop('pve must be either a floating point number smaller than 1 or an integer number smaller than the number of pc. Value provided: ', pve)}
8282
npc <- pve
83+
}else{
84+
stop('Invalid pve value.')
8385
}
8486
return(npc)
8587
}
@@ -109,7 +111,7 @@ compute_objective_value <- function(Y, quantile.value, scores, intercept, loadin
109111
#' @param train.pct Float number indicating the % of rows used for training.
110112
#' @param train.size Integer number indicating number of rows used for training. \code{train.size} is superseded by \code{train.pct}.
111113
#' @param seed Seed for the random generator number.
112-
#' @return A list containing a matrix Y.train and a matrix Y.test
114+
#' @return A list containing a matrix Y.train, a matrix Y.test and a list of training indices.
113115
train_test_split_rows <- function(Y, train.pct = NULL, train.size = NULL, seed = NULL)
114116
{
115117
# Validate inputs
@@ -332,7 +334,7 @@ train_test_split <- function(Y, criteria = 'points', train.pct = NULL, train.siz
332334
#' @param Y \eqn{(N \times P)} matrix of predictive variables.
333335
#' @param folds Integer number indicating number of folds.
334336
#' @param seed Seed for the random generator number.
335-
#' @return A list containing two inside lists, one for training and one for testing. The length of the inside lists is equal to the number of folds
337+
#' @return A list containing three inside lists, one for training, one for testing and one with training indices.. The length of the inside lists is equal to the number of folds
336338
kfold_cv_rows <- function(Y, folds = 3, seed = NULL)
337339
{
338340
# Validate inputs

0 commit comments

Comments
 (0)