Skip to content

Commit 14f4d2f

Browse files
authored
Merge pull request #41 from dustinfife/development
Merge JASP/jamovi developments into master
2 parents 4c8dc0d + ed36c6e commit 14f4d2f

File tree

109 files changed

+48543
-65360
lines changed

Some content is hidden

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

109 files changed

+48543
-65360
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.Rbuildignore

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
^\.git$
77
jamovi
88
.travis.yml
9+
flexplot.svg
910
^build$
1011
^icon.svg$
1112
^flexplot.jmo$
@@ -18,9 +19,19 @@ tests/
1819
^Meta$
1920
EJ notes.rtf
2021
R/flexplota.b.R
22+
# stuff to ignore jasp when doing CMD check
23+
R/glinmod_jasp.R
24+
R/linmod_jasp.R
25+
R/flexplot_jasp2.R
26+
R/mixedmod_jasp.R
27+
R/jasp_common.R
28+
2129
R/flexplota.h.R
2230
R/glmbasic.b.R
2331
R/glmbasic.h.R
2432
R/modelcomp.b.R
2533
R/modelcomp.h.R
26-
vignettes/regex_syntax.txt
34+
R/scratch/
35+
data/generate_data.R
36+
vignettes/regex_syntax.txt
37+
vignettes/psychmethods/

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: flexplot
22
Type: Package
33
Title: Graphically Based Data Analysis Using Flexplot
4-
Version: 0.6.7
4+
Version: 0.7.2
55
Author: Dustin Fife
66
Maintainer: Dustin Fife <[email protected]>
77
Description: The ‘flexplot’ suite is a graphically-based set of tools for doing data analysis. flexplot() allows users to specify a formula and the software automatically chooses what sort of graphic to present. Analysis can be paired with visuals using the visualize() function, such that the software will choose an appropriate graphic to match an R model object.

NAMESPACE

-4
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ export(bf.bic)
1414
export(compare.fits)
1515
export(estimates)
1616
export(flexplot)
17-
export(flexplot_jasp2)
1817
export(flip_data)
1918
export(geom_jitterd)
2019
export(glinmod)
21-
export(glinmod_jasp)
22-
export(linmod_jasp)
2320
export(make.formula)
2421
export(mixed.mod.visual)
25-
export(mixedmod_jasp)
2622
export(model.comparison)
2723
export(position_jitterd)
2824
export(position_jitterdodged)

R/compare.fits.R

+6-7
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ compare.fits = function(formula, data, model1, model2=NULL, return.preds=F, repo
4646
outcome = variables[1]
4747
predictors = variables[-1]
4848

49-
#### for the rare occasion where deleting missing data changes the levels...
50-
if (length(predict(model1))<nrow(data) | length(predict(model2))<nrow(data)){
51-
data = na.omit(data[,variables])
52-
}
53-
5449
##### make sure they're putting the same variables from formula in terms
5550
if (!(all(predictors %in% testme))){
5651
stop(paste0("Sorry, but some variables in formula don't match what's in the model. Specifically: ", paste0(variables[!(variables%in%terms.mod1)], collapse=",")))
@@ -61,8 +56,12 @@ compare.fits = function(formula, data, model1, model2=NULL, return.preds=F, repo
6156
stop(paste0("Sorry, but some variables in formula don't match what's in the dataset. Specifically: ", paste0(variables[!(variables%in%data)], collapse=","), ". Did you input the wrong dataset?"))
6257
}
6358

64-
65-
#### create random column just to make the applies work (yeah, it's hacky, but it works)
59+
#### for the rare occasion where deleting missing data changes the levels...
60+
if (length(predict(model1))<nrow(data) | length(predict(model2))<nrow(data)){
61+
data = na.omit(data[,variables])
62+
}
63+
64+
#### create random column just to make the applies work (yeah, it's hacky, but it works)
6665
data$reject = 1:nrow(data); data$reject2 = 1:nrow(data)
6766
predictors = c(predictors, "reject", "reject2")
6867

R/data_documentation.R

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
#' Simulated Statistics on the Final Avengers Battle
2+
#'
3+
#' A dataset containing combat attributes of almost 812
4+
#' fighters in the final Avengers battle
5+
#'
6+
#' @format A data frame with 812 rows and 13 variables:
7+
#' \describe{
8+
#' \item{iq}{Intelligence}
9+
#' \item{agility}{weighted scores on an obstacle course}
10+
#' \item{speed}{Speed in running the 40 meter dash}
11+
#' \item{strength}{Pounds lifted in a benchpress}
12+
#' \item{damage.resistence}{Amount of skin deflection (in mm) when slapped with a frozen fish}
13+
#' \item{flexibility}{Number of inches past their toes they can reach}
14+
#' \item{willpower}{Length of time they wait at a DMV for a driver's license}
15+
#' \item{superpower}{Does this person have a superpower?}
16+
#' \item{died}{Whether the person died at the final battle}
17+
#' \item{kills}{Number of enemies killed in the final battle}
18+
#' \item{injuries}{Number of injuries sustained. Anything more than 5 is marked as a 5}
19+
#' \item{minutes.fighting}{Number of minutes spent fighting before dying or giving up}
20+
#' \item{shots.taken}{Number of shots (with a gun) or punches thrown at an enemy}
21+
#' }
22+
"avengers"
23+
124
#' Alcohol use among youth
225
#'
326
#' A dataset containing alcohol use from 82 youth over the course of three years

R/estimates.R

+13-9
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
#'
33
#' Report object Estimates
44
#' @param object a object
5+
#' @param mc Should model comparisons be performed?
56
#' @export
6-
estimates = function(object){
7+
estimates = function(object, mc=TRUE){
78
UseMethod("estimates")
89
}
910

1011
#' Output APA style statistical significance from an object
1112
#'
1213
#' Output APA style statistical significance from an object
1314
#' @param object a object
15+
#' @param mc Should model comparisons be performed?
1416
#' @return One or more objects containing parameter estimates and effect sizes
1517
#' @export
16-
estimates.default = function(object){
18+
estimates.default = function(object, mc=TRUE){
1719
out = summary(object)
1820
class(out) = "estimates"
1921
out
@@ -23,9 +25,10 @@ estimates.default = function(object){
2325
#'
2426
#' Report lm object Estimates
2527
#' @param object a lm object
28+
#' @param mc Should model comparisons be performed?
2629
#' @return One or more objects containing parameter estimates and effect sizes
2730
#' @export
28-
estimates.lm = function(object){
31+
estimates.lm = function(object, mc=TRUE){
2932

3033
n = nrow(model.frame(object))
3134

@@ -43,7 +46,7 @@ estimates.lm = function(object){
4346
}
4447
#### get dataset
4548
d = object$model
46-
dataset=NULL
49+
#}dataset=NULL
4750
#### identify factors
4851
if (length(terms)>1){
4952
### convert characters to factors
@@ -213,8 +216,7 @@ estimates.lm = function(object){
213216
}
214217

215218
### do nested model comparisons
216-
if (length(terms)>1){
217-
#save(object, terms, file="/Users/fife/Dropbox/jaspResults.Rdat")
219+
if (length(terms)>1 & mc){
218220
removed.one.at.a.time = function(i, terms, object){
219221
new.f = as.formula(paste0(". ~ . -", terms[i]))
220222
new.object = update(object, new.f)
@@ -224,7 +226,7 @@ estimates.lm = function(object){
224226
)
225227
}
226228
### this requires superassignment to work with JASP
227-
dataset<<-object$model
229+
#dataset<<-object$model
228230
all.terms = attr(terms(object), "term.labels")
229231
mc = t(sapply(1:length(all.terms), removed.one.at.a.time, terms=all.terms, object=object))
230232
mc = data.frame(cbind(all.terms,mc), stringsAsFactors = FALSE)
@@ -262,9 +264,10 @@ estimates.lm = function(object){
262264
#'
263265
#' Report glm object Estimates
264266
#' @param object a glm object
267+
#' @param mc Should model comparisons be performed? Currently not used
265268
#' @return One or more objects containing parameter estimates and effect sizes
266269
#' @export
267-
estimates.glm = function(object){
270+
estimates.glm = function(object, mc=FALSE){
268271
#### generate list of coefficients
269272
terms = attr(terms(object), "term.labels")
270273

@@ -332,8 +335,9 @@ estimates.glm = function(object){
332335
#'
333336
#' Report zeroinfl object Estimates
334337
#' @param object a zeroinfl object
338+
#' @param mc Should model comparisons be performed? Currently not used
335339
#' @export
336-
estimates.zeroinfl = function(object){
340+
estimates.zeroinfl = function(object, mc=FALSE){
337341

338342
#### get dataset
339343
d = object$model

0 commit comments

Comments
 (0)