-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ralmond/working
Working
- Loading branch information
Showing
24 changed files
with
804 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata | ||
.Rbuildignore | ||
*~ | ||
.#* | ||
inst/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
Package: CPTtools | ||
Version: 0.6-1 | ||
Date: 2019/10/27 | ||
Title: Tools for creating conditional probability tables | ||
Version: 0.7-2 | ||
Date: 2021/03/05 | ||
Author: Russell Almond | ||
Maintainer: Russell Almond <[email protected]> | ||
Depends: R (>= 3.0), lattice, methods | ||
Description: Provides support for parameterized tables for Bayesian networks . | ||
License: Artistic-2.0 | ||
Authors@R: | ||
person(given = "Russell", | ||
family = "Almond", | ||
role = c("aut", "cre"), | ||
email = "[email protected]", | ||
comment = c(ORCID = "0000-0002-8876-9337")) | ||
Description: Provides support parameterized tables for Bayesian | ||
networks, particularly the IRT-like DiBello tables. | ||
Also, provides some tools for visualing the networks. | ||
License: Artistic-2.0 | ||
Encoding: UTF-8 | ||
LazyData: true | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.1.1 | ||
URL: http://pluto.coe.fsu.edu/RNetica | ||
|
||
Depends: methods | ||
Imports: grDevices, graphics, stats, utils | ||
Suggests: | ||
ggplot2, | ||
lattice, | ||
knitr, | ||
rmarkdown | ||
VignetteBuilder: knitr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
YEAR: 2021 | ||
COPYRIGHT HOLDER: Russell G. Almond |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# MIT License | ||
|
||
Copyright (c) 2020 CPTtools | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#.*# | ||
#StackedBars.R# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
library(googlesheets4) | ||
library(tidyverse) | ||
library(cowplot) | ||
|
||
formA.hist <- read_sheet("https://docs.google.com/spreadsheets/d/1svdCQI9Jb3MpIObGWExg942MUsBB4uRquhD1FNTkChM/edit#gid=688471781",1) | ||
View(formA.hist) | ||
|
||
## Need to fix baseline timestamp | ||
|
||
min(formA.hist$timestamp,na.rm=TRUE) -> first.post | ||
base.timestamp <- as.POSIXlt(first.post) | ||
## Put at the top of the hours. | ||
base.timestamp$min <-0 | ||
base.timestamp$sec <-0 | ||
base.timestamp <- as.POSIXct(base.timestamp) | ||
|
||
formA.hist[formA.hist$context=="*Baseline*","timestamp"] <- as.POSIXct(base.timestamp) | ||
|
||
filter(formA.hist, uid=="011c1") %>% ggplot(aes(x=timestamp,y=Physics_EAP)) + geom_line() + geom_text(aes(label=context)) | ||
|
||
fiveuid <- sample(unique(formA.hist$uid),5) | ||
filter(formA.hist, uid %in% fiveuid) %>% ggplot(aes(x=timestamp,y=Physics_EAP)) + geom_line() + | ||
facet_grid(rows=vars(uid)) | ||
|
||
|
||
## ndiff differences the series, leaving the first (baseline) value as NA. | ||
## Thus is is a candidate aux function for mutate. | ||
ndiff <- function (x) { | ||
res <- c(NA,diff(x)) | ||
names(res) <- names(x) | ||
res | ||
} | ||
Phys1 <- filter(formA.hist,uid=="011c1") %>% pull(Physics_EAP) | ||
names(Phys1) <- filter(formA.hist,uid=="011c1") %>% pull(context) | ||
|
||
## Plots versus timestamps. Hard to see what is going on. | ||
filter(formA.hist, uid=="011c1") %>% ggplot(aes(x=timestamp,y=ndiff(Physics_EAP))) + geom_line() | ||
filter(formA.hist, uid %in% fiveuid) %>% ggplot(aes(x=timestamp,y=Physics_EAP)) + geom_line() + | ||
facet_grid(rows=vars(uid)) | ||
filter(formA.hist, uid %in% fiveuid) %>% ggplot(aes(x=timestamp,y=ndiff(Physics_EAP))) + geom_line() + | ||
facet_grid(rows=vars(uid)) | ||
|
||
## Working with discrete time. | ||
## 1) Need to use geom_col() not geom_bar() | ||
## 2) fct_reorder(context,timestamp) makes sure levels are in time order, not alphabetical!! | ||
## 3) scale_fill_gradient2(low="red",mid="yellow",high="green") gives traffic light coloring. | ||
## 4) theme(axis.text.y=element_blank()) suppresses the labels in the second plot. | ||
## 5) cowplot::plot_grid() plots side by side. | ||
|
||
c011c1.eap <- filter(formA.hist, uid=="011c1") %>% ggplot(aes(x=fct_reorder(context,timestamp),y=Physics_EAP)) + | ||
geom_col(aes(fill=..y..))+scale_fill_gradient2(low="red",mid="yellow",high="green",midpoint=0)+ | ||
coord_flip(ylim=c(-1,1))+theme_light()+labs(x="",y="EAP[Physics]") | ||
c011c1.diff <- filter(formA.hist, uid=="011c1") %>% ggplot(aes(x=fct_reorder(context,timestamp),y=ndiff(Physics_EAP))) + | ||
geom_col(aes(fill=..y..))+scale_fill_gradient2(low="red",mid="yellow",high="green",midpoint=0)+ | ||
coord_flip(ylim=c(-1,1))+theme_light()+labs(x="",y="\u0394EAP[Physics]") + theme(axis.text.y=element_blank()) | ||
|
||
plot_grid(c011c1.eap,c011c1.diff) | ||
|
||
## Remaining Issues: | ||
# 1) Probably want 3 plots: level names and trophies, EAP, Delta EAP | ||
#### Need to merge trophy data in with levels. | ||
# 2) There could be more than one level with the same context. Need to fix. | ||
#### Maybe plotting by order number will fix this. | ||
# 3) Need to figure out how to add "outer" labels to multiplot Grid. | ||
|
||
|
||
EAPBal(filter(formA.hist,uid=="011c1") %>% pull("Physics_EAP"), | ||
filter(formA.hist,uid=="011c1") %>% pull("context"), | ||
varname="Physics") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#woeBal.Rd# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.