Skip to content

Commit

Permalink
version 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JimGrange authored and cran-robot committed Apr 6, 2023
1 parent 181783e commit 2a274a8
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 133 deletions.
12 changes: 6 additions & 6 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Package: mixtur
Title: Modelling Continuous Report Visual Short-Term Memory Studies
Version: 1.2.0
Date: 2021-07-27
Version: 1.2.1
Date: 2023-04-06
Authors@R: c(
person(
given = "Jim",
Expand All @@ -27,22 +27,22 @@ Description: A set of utility functions for analysing and modelling data from
3-component mixture model of Bays et al. (2009) <doi:10.1167/9.10.7>. Users
are also able to simulate from these models.
Depends: R (>= 4.0)
Imports: dplyr, ggplot2, rlang, tidyr, RColorBrewer
Imports: dplyr, ggplot2, rlang, tidyr
Suggests: knitr, rmarkdown
License: GPL-3
LazyData: true
URL: https://github.com/JimGrange/mixtur
BugReports: https://github.com/JimGrange/mixtur/issues
Encoding: UTF-8
RoxygenNote: 7.1.1
RoxygenNote: 7.2.1
Copyright: Some functions have been adapted from Matlab code written by
Paul Bays (https://bayslab.com) published under GNU General
Public License.
NeedsCompilation: no
Packaged: 2021-07-30 12:41:36 UTC; jimgrange
Packaged: 2023-04-06 10:15:16 UTC; jimgrange
Author: Jim Grange [aut, cre] (<https://orcid.org/0000-0002-8352-8390>),
Stuart B. Moore [aut] (<https://orcid.org/0000-0002-0747-9304>),
Ed D. J. Berry [ctb]
Maintainer: Jim Grange <grange.jim@gmail.com>
Repository: CRAN
Date/Publication: 2021-08-03 08:00:02 UTC
Date/Publication: 2023-04-06 11:00:02 UTC
21 changes: 11 additions & 10 deletions MD5
@@ -1,26 +1,27 @@
01508f5b8030097d8c49af5e3a35ba1c *DESCRIPTION
a8b44b5e52cdb8d37884d12ec2dade8f *NAMESPACE
2e0c6d7e83650da32b481b2b865e78d1 *NEWS.md
5c8dbfeaecd592744d5f0adcd1bb71d4 *DESCRIPTION
ac6a31cc73c38ed8a1510f466096c9b6 *NAMESPACE
7a51616fdf9b9a0743ef237a2572b44d *NEWS.md
50c6878b4a2fb4bbcd71b294a5ff90f8 *R/analysing.R
49eb16a1dac8e90ce8533af677cec320 *R/data_descriptions.R
5fce881fc6e2afd4abf208b538df57f3 *R/designing.R
77038cc9fbd9c6d230ded50efbadba2c *R/modelling.R
1860d4496cfb545e1513fadf40ee39a3 *R/plotting.R
46d221ad15c4c6f4657543f42536af6c *R/simulating.R
e2be981ec6a6ec0cdfa5f80f5a5c409f *R/plotting.R
6a117748331b7e9c5545883f37a3978d *R/simulating.R
0c67f69d88ccb7fe864fa4ccf7f6d216 *R/utilities.R
e73be97bf7ad0bfc204f2d58e9254867 *README.md
e89dfceb5578c4c55873a5996ac3d974 *README.md
3ac8f5ad800a0a2df5b416890ee78435 *data/bays2009_full.rda
102a1be4952a5ff33d4ba3a2d3854ec5 *data/bays2009_sample.rda
1b190f0d51ee39e0874b696477e01a0f *data/berry_2019.rda
74d12c079a320e3e7a9ba7b2a2d8b0f1 *data/oberauer_2017.rda
90aae499035856c85943670440264ba0 *man/bays2009_full.Rd
9d63c65b885637b7937ccfad5912aef2 *man/bays2009_sample.Rd
55d2a2fad360327cabaeabd742d47076 *man/berry_2019.Rd
f5c6916b452efe9f7b3f3b9624bc54c3 *man/figures/README-pressure-1.png
c4f11b54d0d6d915c4ff5cea4fb2b457 *man/fit_mixtur.Rd
8678f518e2df55242ae5966208ac3fdc *man/get_summary_statistics.Rd
c277741a5ee87778d5bb3640824900df *man/oberauer_2017.Rd
368d9eef959d15fec86527dc4d0c075b *man/plot_error.Rd
7fb68a07a7e38abcdc4a0453044036dd *man/plot_model_fit.Rd
e163b2a76a12ac2dc545f65ee56e8a95 *man/plot_model_parameters.Rd
4805990e9f3af84e69c9c3e9e8de3226 *man/plot_summary_statistic.Rd
6bff58a5a61dd2bf1b5e97aedbe8fea2 *man/plot_error.Rd
e1a5160386f298f66a8a3fdbf48c8180 *man/plot_model_fit.Rd
063fe1082a0bd8a6fc5ec58d5ecd9004 *man/plot_model_parameters.Rd
1cb346e5060ccd44677acc5f46b41bbf *man/plot_summary_statistic.Rd
3a1797a31d33ac019312885210788d91 *man/simulate_mixtur.Rd
1 change: 0 additions & 1 deletion NAMESPACE
Expand Up @@ -21,7 +21,6 @@ importFrom(dplyr,relocate)
importFrom(dplyr,rename)
importFrom(dplyr,sample_n)
importFrom(dplyr,select)
importFrom(dplyr,slice)
importFrom(dplyr,starts_with)
importFrom(dplyr,summarise)
importFrom(ggplot2,aes)
Expand Down
9 changes: 7 additions & 2 deletions NEWS.md
Expand Up @@ -2,6 +2,11 @@
output: html_document
---

mixtur 1.2.0
mixtur v1.2.1
===========
* Initial release to GitHub
* Fixed issue that RColorBrewer package was imported but never used
* Fixed issue in simulate_components() function caused by dplyr's slice()

mixtur v1.2.0
===========
* Initial release to GitHub & to CRAN
202 changes: 137 additions & 65 deletions R/plotting.R
Expand Up @@ -30,7 +30,7 @@
#'@param return_data A boolean (TRUE or FALSE) indicating whether the data for
#'the plot should be returned.
#'@param palette A character stating the preferred colour palette to use. To
#'see all available palettes, type display.brewer.all() into the console.
#'see all available palettes, type ?scale_colour_brewer into the console.
#'
#'@return If \code{return_data} is set to \code{FALSE} (which it is by default),
#' the function returns a ggplot2 object visualising the summary statistic
Expand Down Expand Up @@ -145,7 +145,7 @@ plot_summary_statistic <- function(data,
#' @param return_data A boolean (TRUE or FALSE) indicating whether the data for
#' the plot should be returned.
#' @param palette A character stating the preferred colour palette to use. To
#' see all available palettes, type display.brewer.all() into the console.
#' see all available palettes, type ?scale_colour_brewer into the console.
#'
#' @importFrom stats sd
#' @importFrom dplyr %>%
Expand Down Expand Up @@ -698,7 +698,9 @@ plot_mean_absolute_error <- function(data,
#'@param return_data A boolean (TRUE or FALSE) indicating whether the data for
#'the plot should be returned.
#'@param palette A character stating the preferred colour palette to use. To
#'see all available palettes, type display.brewer.all() into the console.
#'see all available palettes, type ?scale_colour_brewer into the console.
#'@param scale_y_axis A vector of 2 elements stating the minimum and maximum
#'value to use for the y-axis in the plots.
#'
#'@return If \code{return_data} is set to \code{FALSE} (which it is by default),
#' the function returns a ggplot2 object visualising the density distribution
Expand Down Expand Up @@ -739,7 +741,8 @@ plot_error <- function(data,
n_bins = 18,
n_col = 2,
return_data = FALSE,
palette = "Dark2"){
palette = "Dark2",
scale_y_axis = NULL){

condition <- NULL
set_size <- NULL
Expand Down Expand Up @@ -880,39 +883,71 @@ plot_error <- function(data,
# no set size or condition manipulation
if(is.null(set_size_var) && is.null(condition_var)){

plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error),
width = 0.00) +
geom_point() +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(0,
max(final_data$mean_error) +
max(final_data$se_error))) +
labs(x = "Error (Radians)",
y = "Probability Density")

if(is.null(scale_y_axis)){
plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error),
width = 0.00) +
geom_point() +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(0,
max(final_data$mean_error) +
max(final_data$se_error))) +
labs(x = "Error (Radians)",
y = "Probability Density")
} else {
plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error),
width = 0.00) +
geom_point() +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(scale_y_axis[1], scale_y_axis[2])) +
labs(x = "Error (Radians)",
y = "Probability Density")
}

}


# no set size manipulation but there is a condition manipulation
if(is.null(set_size_var) && !is.null(condition_var)){

plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error),
width = 0.00) +
geom_point() +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(0,
max(final_data$mean_error) +
max(final_data$se_error))) +
labs(x = "Error (Radians)",
y = "Probability Density") +
facet_wrap(vars(.data$condition), ncol = n_col)
if(is.null(scale_y_axis)){
plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error),
width = 0.00) +
geom_point() +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(0,
max(final_data$mean_error) +
max(final_data$se_error))) +
labs(x = "Error (Radians)",
y = "Probability Density") +
facet_wrap(vars(.data$condition), ncol = n_col)
} else {
plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error),
width = 0.00) +
geom_point() +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(scale_y_axis[1], scale_y_axis[2])) +
labs(x = "Error (Radians)",
y = "Probability Density") +
facet_wrap(vars(.data$condition), ncol = n_col)
}


# rename the final_data frame
colnames(final_data)[1] <- condition_var
Expand All @@ -923,20 +958,37 @@ plot_error <- function(data,
# set size manipulation, but no condition manipulation
if(!is.null(set_size_var) && is.null(condition_var)){

plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error),
width = 0.00) +
geom_point() +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(0,
max(final_data$mean_error) +
if(is.null(scale_y_axis)){
plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error),
width = 0.00) +
geom_point() +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(0,
max(final_data$mean_error) +
max(final_data$se_error))) +
labs(x = "Error (Radians)",
y = "Probability Density") +
facet_wrap(vars(.data$set_size), ncol = n_col)
labs(x = "Error (Radians)",
y = "Probability Density") +
facet_wrap(vars(.data$set_size), ncol = n_col)
} else {
plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error),
width = 0.00) +
geom_point() +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(scale_y_axis[1], scale_y_axis[2])) +
labs(x = "Error (Radians)",
y = "Probability Density") +
facet_wrap(vars(.data$set_size), ncol = n_col)
}



# rename the final_data frame
colnames(final_data)[1] <- set_size_var
Expand All @@ -950,25 +1002,45 @@ plot_error <- function(data,
# add position jitter to avoid over-plotting
pd <- position_dodge(0.1)

plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error,
group = .data$condition)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error,
colour = .data$condition),
width = 0.00,
position = pd) +
geom_point(aes(colour = .data$condition),
position = pd) +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(0,
max(final_data$mean_error) +
max(final_data$se_error))) +
scale_colour_brewer(palette = palette, name = condition_var) +
labs(x = "Error (Radians)",
y = "Probability Density") +
facet_wrap(vars(.data$set_size), ncol = n_col)
if(is.null(scale_y_axis)){
plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error,
group = .data$condition)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error,
colour = .data$condition),
width = 0.00,
position = pd) +
geom_point(aes(colour = .data$condition),
position = pd) +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(0,
max(final_data$mean_error) +
max(final_data$se_error))) +
scale_colour_brewer(palette = palette, name = condition_var) +
labs(x = "Error (Radians)",
y = "Probability Density") +
facet_wrap(vars(.data$set_size), ncol = n_col)
} else {
plot <- ggplot(final_data, aes(x = .data$x,
y = .data$mean_error,
group = .data$condition)) +
geom_errorbar(aes(ymax = .data$mean_error + .data$se_error,
ymin = .data$mean_error - .data$se_error,
colour = .data$condition),
width = 0.00,
position = pd) +
geom_point(aes(colour = .data$condition),
position = pd) +
theme_bw() +
scale_x_continuous(limits = c(-pi, pi)) +
scale_y_continuous(limits = c(scale_y_axis[1], scale_y_axis[2])) +
labs(x = "Error (Radians)",
y = "Probability Density") +
facet_wrap(vars(.data$set_size), ncol = n_col)
}


# rename the final_data frame
colnames(final_data)[1] <- set_size_var
Expand Down Expand Up @@ -1302,7 +1374,7 @@ plot_precision <- function(data,
#'@param n_col An integer controlling the number of columns in the resulting
#'plot.
#'@param palette A character stating the preferred colour palette to use. To
#'see all available palettes, type display.brewer.all() into the console.
#'see all available palettes, type ?scale_colour_brewer into the console.
#'
#'@return The function returns a ggplot2 object visualising the mean observed
#' response error density distribution across participants (if applicable)
Expand Down Expand Up @@ -2035,7 +2107,7 @@ plot_model_fit <- function(participant_data,
#'@param return_data A boolean (TRUE or FALSE) indicating whether the data for
#'the plot should be returned.
#'@param palette A character stating the preferred colour palette to use. To
#'see all available palettes, type display.brewer.all() into the console.
#'see all available palettes, type?scale_colour_brewer into the console.
#'
#'@return If \code{return_data} is set to \code{FALSE} (which it is by
#' default),the function returns a ggplot2 object visualising the mean model
Expand Down

0 comments on commit 2a274a8

Please sign in to comment.