Skip to content

Commit f833fa6

Browse files
authored
Merge pull request #54 from zadrafi/master
u
2 parents 50fec65 + 9cdffd3 commit f833fa6

File tree

167 files changed

+43968
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+43968
-52
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
#
6+
# See https://github.com/r-lib/actions/tree/master/examples#readme for
7+
# additional example workflows available for the R community.
8+
9+
name: R
10+
11+
on:
12+
push:
13+
branches: [ "master" ]
14+
pull_request:
15+
branches: [ "master" ]
16+
17+
permissions:
18+
contents: write
19+
20+
jobs:
21+
build:
22+
runs-on: macos-latest
23+
strategy:
24+
matrix:
25+
r-version: ['3.6.3', '4.1.1']
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Set up R ${{ matrix.r-version }}
30+
uses: r-lib/actions/setup-r@f57f1301a053485946083d7a45022b278929a78a
31+
with:
32+
r-version: ${{ matrix.r-version }}
33+
- name: Install dependencies
34+
run: |
35+
install.packages(c("remotes", "rcmdcheck"))
36+
remotes::install_deps(dependencies = TRUE)
37+
shell: Rscript {0}
38+
- name: Check
39+
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error")
40+
shell: Rscript {0}

.travis.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

Meta/vignette.rds

645 Bytes
Binary file not shown.

R/curve_gen.R

Lines changed: 111 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#' logistic regression and the 'glm' function. Similarly, the Glm function from the
2525
#' rms package can also be used for this option. The gls method allows objects from gls()
2626
#' or from Gls() from the rms package.
27-
#' @param log Determines whether the coefficients will be exponentiated or not. By default,
27+
#' @param log Determines whether the coefficients will be exponentiated or not. By default,
2828
#' it is off and set to FALSE or F, but changing this to TRUE or T, will exponentiate the results
2929
#' which may be useful if trying to view the results from a logistic regression on a scale that is not
3030
#' logarithmic.
@@ -59,6 +59,111 @@
5959
#' bob <- curve_gen(rob, "GroupB")
6060
#' }
6161
#'
62+
#'
63+
64+
if ((Sys.info()["sysname"]) == "Windows") {
65+
66+
67+
curve_gen <- function(model, var, method = "lm", log = FALSE, penalty = NULL, m = NULL,
68+
steps = 1000, table = TRUE) {
69+
if (is.character(method) != TRUE) {
70+
stop("Error: 'method' must be a character vector")
71+
}
72+
if (is.numeric(steps) != TRUE) {
73+
stop("Error: 'steps' must be a numeric vector")
74+
}
75+
76+
intrvls <- (1:(steps - 1)) / steps
77+
78+
# No adjustment for multiple comparisons ----------------------------------
79+
80+
if (is.null(penalty) & is.null(m)) {
81+
if (method == "lm") {
82+
results <- lapply(intrvls, FUN = function(i) confint.default(object = model, level = i)[var, ])
83+
} else if (method == "rlm") {
84+
results <- lapply(intrvls, FUN = function(i) confint(object = model, level = i)[var, ])
85+
} else if (method == "glm") {
86+
results <- lapply(intrvls, FUN = function(i) confint(object = model, level = i, trace = FALSE)[var, ])
87+
} else if (method == "aov") {
88+
results <- lapply(intrvls, FUN = function(i) confint(object = model, level = i)[var, ])
89+
} else if (method == "gls") {
90+
results <- lapply(intrvls, FUN = function(i) confint.default(object = model, level = i)[var, ])
91+
}
92+
93+
# Bonferroni adjustment for multiple comparisons --------------------------
94+
} else if (penalty == "bonferroni" & m > 1) {
95+
bon.adj <- (1 - ((1 - intrvls) / m))
96+
97+
if (method == "lm") {
98+
results <- lapply(bon.adj, FUN = function(i) confint.default(object = model, level = i)[var, ])
99+
} else if (method == "rlm") {
100+
results <- lapply(bon.adj, FUN = function(i) confint(object = model, level = i)[var, ])
101+
} else if (method == "glm") {
102+
results <- lapply(bon.adj, FUN = function(i) confint(object = model, level = i, trace = FALSE)[var, ])
103+
} else if (method == "aov") {
104+
results <- lapply(bon.adj, FUN = function(i) confint(object = model, level = i)[var, ])
105+
} else if (method == "gls") {
106+
results <- lapply(bon.adj, FUN = function(i) confint.default(object = model, level = i)[var, ])
107+
}
108+
109+
# Sidak adjustment for multiple comparisons -------------------------------
110+
} else if (penalty == "sidak" & m > 1) {
111+
sidak.adj <- (((intrvls)^(1 / m)))
112+
113+
if (method == "lm") {
114+
results <- lapply(sidak.adj, FUN = function(i) confint.default(object = model, level = i)[var, ])
115+
} else if (method == "rlm") {
116+
results <- lapply(sidak.adj, FUN = function(i) confint(object = model, level = i)[var, ])
117+
} else if (method == "glm") {
118+
results <- lapply(sidak.adj, FUN = function(i) confint(object = model, level = i, trace = FALSE)[var, ])
119+
} else if (method == "aov") {
120+
results <- lapply(sidak.adj, FUN = function(i) confint(object = model, level = i)[var, ])
121+
} else if (method == "gls") {
122+
results <- lapply(sidak.adj, FUN = function(i) confint.default(object = model, level = i)[var, ])
123+
}
124+
}
125+
126+
127+
128+
df <- data.frame(do.call(rbind, results))
129+
130+
if (log == FALSE) {
131+
df <- (df)
132+
} else if (log == TRUE) {
133+
df <- exp(df)
134+
}
135+
136+
intrvl.limit <- c("lower.limit", "upper.limit")
137+
colnames(df) <- intrvl.limit
138+
df$intrvl.width <- (abs((df$upper.limit) - (df$lower.limit)))
139+
df$intrvl.level <- intrvls
140+
df$cdf <- (abs(df$intrvl.level / 2)) + 0.5
141+
df$pvalue <- 1 - intrvls
142+
df$svalue <- -log2(df$pvalue)
143+
df <- head(df, -1)
144+
class(df) <- c("data.frame", "concurve")
145+
densdf <- data.frame(c(df$lower.limit, df$upper.limit))
146+
colnames(densdf) <- "x"
147+
densdf <- head(densdf, -1)
148+
class(densdf) <- c("data.frame", "concurve")
149+
150+
151+
if (table == TRUE) {
152+
levels <- c(0.25, 0.50, 0.75, 0.80, 0.85, 0.90, 0.95, 0.975, 0.99)
153+
(df_subintervals <- (curve_table(df, levels, type = "c", format = "data.frame")))
154+
class(df_subintervals) <- c("data.frame", "concurve")
155+
dataframes <- list(df, densdf, df_subintervals)
156+
names(dataframes) <- c("Intervals Dataframe", "Intervals Density", "Intervals Table")
157+
class(dataframes) <- "concurve"
158+
return(dataframes)
159+
} else if (table == FALSE) {
160+
return(list(df, densdf))
161+
}
162+
}
163+
164+
} else if ((Sys.info()["sysname"]) == "Darwin") {
165+
166+
62167
curve_gen <- function(model, var, method = "lm", log = FALSE, penalty = NULL, m = NULL,
63168
steps = 1000, cores = getOption("mc.cores", 1L), table = TRUE) {
64169
if (is.character(method) != TRUE) {
@@ -117,17 +222,17 @@ curve_gen <- function(model, var, method = "lm", log = FALSE, penalty = NULL, m
117222
results <- pbmclapply(sidak.adj, FUN = function(i) confint.default(object = model, level = i)[var, ], mc.cores = cores)
118223
}
119224
}
120-
225+
121226

122227

123228
df <- data.frame(do.call(rbind, results))
124-
229+
125230
if (log == FALSE) {
126231
df <- (df)
127232
} else if (log == TRUE) {
128233
df <- exp(df)
129234
}
130-
235+
131236
intrvl.limit <- c("lower.limit", "upper.limit")
132237
colnames(df) <- intrvl.limit
133238
df$intrvl.width <- (abs((df$upper.limit) - (df$lower.limit)))
@@ -156,5 +261,7 @@ curve_gen <- function(model, var, method = "lm", log = FALSE, penalty = NULL, m
156261
}
157262
}
158263

264+
}
265+
159266
# RMD Check
160267
utils::globalVariables(c("df", "lower.limit", "upper.limit", "intrvl.width", "intrvl.level", "cdf", "pvalue", "svalue"))

README.md

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
### <span style="color:#000; font-weight: 400;">`concurve`</span> \| Graph Frequentist Distributions of Parameters </strong> <img src="man/figures/logo.svg" align="right" width="70"/>
2+
# `concurve` \| Graph Frequentist Distributions of Parameters <img src="https://raw.githubusercontent.com/zadrafi/concurve/master/man/figures/logo.svg" align="right" width="70"/>
33

44
------------------------------------------------------------------------
55

@@ -16,8 +16,7 @@ Downloads](https://cranlogs.r-pkg.org/badges/grand-total/concurve)](https://cran
1616
[![Rdoc](http://www.rdocumentation.org/badges/version/concurve)](http://www.rdocumentation.org/packages/concurve)
1717
[![License: GPL
1818
v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
19-
[![Travis build
20-
status](https://travis-ci.com/zadrafi/concurve.svg?branch=master)](https://travis-ci.com/zadrafi/concurve)
19+
[![R-CMD-check](https://github.com/zadrafi/concurve/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/zadrafi/concurve/actions/workflows/R-CMD-check.yaml)
2120
[![Codecov test
2221
coverage](https://codecov.io/gh/zadrafi/concurve/branch/master/graph/badge.svg)](https://codecov.io/gh/zadrafi/concurve?branch=master)
2322
<!-- badges: end -->
@@ -118,7 +117,7 @@ here](articles/supported.html).
118117
### Citation
119118

120119
To properly cite the package, please see the [following
121-
page](file:///Users/zad/Desktop/GitHub/concurve/docs/authors.html) or
120+
page](https://data.lesslikely.com/concurve/authors.html) or
122121
run the R script below.
123122

124123
citation("concurve")
@@ -129,30 +128,6 @@ run the R script below.
129128

130129
Please note that the concurve project is released with a [Contributor
131130
Code of
132-
Conduct](https://data.lesslikely.com/concurve//CODE_OF_CONDUCT.html). By
131+
Conduct](https://data.lesslikely.com/concurve/CODE_OF_CONDUCT.html). By
133132
contributing to this project, you agree to abide by its terms.
134133

135-
##### Environment
136-
137-
The package was currently run on:
138-
139-
## R version 4.0.2 (2020-06-22)
140-
## Platform: x86_64-apple-darwin17.0 (64-bit)
141-
## Running under: macOS Catalina 10.15.6
142-
##
143-
## Matrix products: default
144-
## BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
145-
## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
146-
##
147-
## locale:
148-
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
149-
##
150-
## attached base packages:
151-
## [1] stats graphics grDevices utils datasets methods base
152-
##
153-
## loaded via a namespace (and not attached):
154-
## [1] compiler_4.0.2 magrittr_1.5 credentials_1.3.0 htmltools_0.5.0 tools_4.0.2 yaml_2.2.1 stringi_1.5.3
155-
## [8] rmarkdown_2.4 knitr_1.30 stringr_1.4.0 xfun_0.18 digest_0.6.25 rlang_0.4.7 openssl_1.4.3
156-
## [15] sys_3.4 evaluate_0.14 askpass_1.1
157-
158-
------------------------------------------------------------------------

0 commit comments

Comments
 (0)