Skip to content

Commit

Permalink
Merge pull request #2 from Zadchow/testing
Browse files Browse the repository at this point in the history
v2.0.1
  • Loading branch information
zadrafi authored Jul 10, 2019
2 parents 3bb67c2 + 779a83b commit 8d3502a
Show file tree
Hide file tree
Showing 24 changed files with 155 additions and 77 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: concurve
Type: Package
Date: 2019-07-10
Title: Computes and Plots Consonance (Confidence) Intervals, P-Values, and S-Values to Form Consonance and Surprisal Functions
Version: 2.0
Version: 2.0.1
Authors@R: c(
person("Zad R.", "Chow", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1545-8199")
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# concurve 2.0.1

## Major changes

* `plot_concurve()` now has "measure" as an item which allows for ratio measures to be logarithmically scaled on the x axis. There are two options, "default", which is set as the default option and is for mean differences, and "ratio", which will result in the axis being logarithmically scaled.
* `plot_concurve()` also now has a "fill" option which will allow users to choose the color of the plot.


# concurve 2.0

## Major changes
Expand Down
96 changes: 69 additions & 27 deletions R/plot_concurve.R
Original file line number Diff line number Diff line change
@@ -1,41 +1,63 @@
plot_concurve <- function(type = "consonance",
data,
measure = "default",
title = "Consonance Function",
xlab = "Theta",
ylab1 = "P-value",
ylab2 = "Confidence Level (%)") {
ylab2 = "Confidence Level (%)",
fill = "#239a9880") {

# Overall graph parameters
par(
mar = c(4.9, 5, 3.5, 5),
mar = c(4.5, 5, 3, 5),
font.main = 1,
cex.main = 1.3,
cex.lab = 1.15
)

# Consonance function

if (type == "consonance") {
with(
data = data,
plot(lower.limit, pvalue,
xlim = c(min(lower.limit), max(upper.limit)),
panel.first = grid(ny = 0),
type = "l",
xlab = xlab,
ylab = ylab1,
main = title,
yaxt = "n",
las = 1
)
if (measure == "default") {
plot(lower.limit, pvalue,
xlim = c(min(lower.limit), max(upper.limit)),
panel.first = grid(ny = 0),
type = "l",
xlab = xlab,
ylab = ylab1,
main = title,
yaxt = "n",
las = 1
)
}
else if (measure == "ratio") {
plot(lower.limit, pvalue,
xlim = c(min(lower.limit), max(upper.limit)),
panel.first = grid(ny = 0),
type = "l",
xlab = xlab,
ylab = ylab1,
main = title,
yaxt = "n",
las = 1,
log = "x"
)
}
)

with(data = data, lines(upper.limit, pvalue))

# Shade in area under the curve

polygon(c(max(data$lower.limit), data$lower.limit),
c(min(data$pvalue), data$pvalue),
col = "#239a9880", border = NA
col = fill, border = NA
)
polygon(c(min(data$upper.limit), data$upper.limit),
c(min(data$pvalue), data$pvalue),
col = "#239a9880", border = NA
col = fill, border = NA
)
axis(
side = 2, at = c(seq(from = 0, to = 1, by = .10)),
Expand Down Expand Up @@ -120,28 +142,48 @@ plot_concurve <- function(type = "consonance",
),
cex = 0.93, col = "black"
)
} else if (type == "surprisal") {
}

# Surprisal function

if (type == "surprisal") {
with(
data,
plot(lower.limit, svalue,
xlim = c(min(lower.limit), max(upper.limit)),
panel.first = grid(),
type = "l",
xlab = "Theta",
ylab = "S-value",
main = "Surpisal Function",
yaxt = "n",
las = 1
)
if (measure == "default") {
plot(lower.limit, svalue,
xlim = c(min(lower.limit), max(upper.limit)),
panel.first = grid(),
type = "l",
xlab = "Theta",
ylab = "S-value",
main = "Surpisal Function",
yaxt = "n",
las = 1
)
}
else if (measure == "ratio") {
plot(lower.limit, svalue,
xlim = c(min(lower.limit), max(upper.limit)),
panel.first = grid(),
type = "l",
xlab = "Theta",
ylab = "S-value",
main = "Surpisal Function",
yaxt = "n",
las = 1,
log = "x"
)
}
)

with(data, lines(upper.limit, svalue))
polygon(c(max(data$lower.limit), data$lower.limit),
c(max(data$svalue), data$svalue),
col = "#239a9880", border = NA
col = fill, border = NA
)
polygon(c(min(data$upper.limit), data$upper.limit),
c(max(data$svalue), data$svalue),
col = "#239a9880", border = NA
col = fill, border = NA
)
axis(side = 2, lty = 2, col = "grey", las = 1)
par(new = T)
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"issueTracker": "https://github.com/Zadchow/concurve/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "2.0",
"version": "2.0.1",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -184,7 +184,7 @@
}
],
"keywords": ["confidence", "compatibility", "consonance", "surprisal", "interval", "function", "curve"],
"fileSize": "3935.732KB",
"fileSize": "3936.013KB",
"contIntegration": [
"https://travis-ci.org/Zadchow/concurve",
"https://ci.appveyor.com/project/Zadchow/concurve",
Expand Down
2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/examples.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/stata.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 25 additions & 9 deletions docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/curve_corr.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/curve_gen.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/curve_mean.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/curve_meta.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/curve_rev.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/curve_surv.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/defunct.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8d3502a

Please sign in to comment.