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
#drops all numbers prior to the decimal place | |
dropLeading <- function(num) { | |
sub("^0\\.", ".",as.character(num)) | |
} |
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
# Get all variables plotted along a given axis in a ggplot. | |
getPlottedVals <- function(ggplotObj,axis=c("x","y"),includeLayers=TRUE) | |
{ | |
if (is.null(axis)) {stop("In getPlotted: Argument axis not specified.")} | |
getValAxis <- function(.q,axis=c("x","y")) { | |
as.data.table(.q$data)[,eval(.q$mapping[[axis]])] | |
} | |
getLayerAxis <- function(tmpLayer,axis=c("x","y")) { | |
if (!any(class(tmpLayer$data) %in% "waiver") & (any(class(tmpLayer$data)=="data.frame"))) { | |
return(getValAxis(tmpLayer,axis)) |
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
//Modified from: http://forums.adobe.com/message/4496260#4496260 to list comments in page number order | |
//Open PDF | |
//Control-J | |
//Control-A (select the junk already in the console) | |
//Control-V (paste in code) | |
//Control-A | |
//Control-Enter | |
//It will freeze for a while while it does the work | |
this.syncAnnotScan(); | |
var a = this.getAnnots({ |
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
#will have to decide about the html later. | |
#probably need to make digits work in a sane sort of way. | |
fixedEffectFrame <- function(x,digits=c(2,2,2)) { | |
data.frame("Coefficient"=round(fixef(x),digits[1]),"Std. Error"=round(sqrt(diag(vcov(x))),digits[2]),"t value"=abs(round(fixef(x)/sqrt(diag(vcov(x))),digits[3])),check.names=FALSE) | |
} | |
varcortau <- function(lme4.model,groupLevel="WAISID",digits=2) { | |
model.var <- VarCorr(lme4.model)[[groupLevel]] | |
model.var[lower.tri(model.var)] <- attr(model.var,"correlation")[lower.tri(attr(model.var,"correlation"))] | |
REmat <- summary(lme4.model)@REmat |
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
Option Explicit | |
Dim SD | |
Dim DD | |
Dim CMD, CMDRUN, CMDRUNPersist | |
Dim oShell, oShellOut | |
Dim Resp | |
Set oShell = WScript.CreateObject("WScript.Shell") | |
SD = BrowseFolder( "%userprofile%\documents", True, "Select source directory") | |
DD = BrowseFolder( "%userprofile%\documents", True, "Select destination directory") |
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
# Paired Sample t-tests: Yes, Virginia there is an effect size for that! | |
There are a plethora of options, Cohen’s d, a tweaked version of Glass’ $\Delta$ (1976): $\Delta_{RM}$ (Gibbons et al., 1993), dIGPP (Becker, 1988), generalized $\eta^2$ (Bakeman, 2005; Olejnik & Algina, 2003), and r (which in this context is a square rooted alias for partial eta squared). Of these I prefer generalized $\eta^2$ or r. Why r I hear you say. I’ve never seen r used before in this context. | |
A paired samples t is just a one sample t-test of the differences. The advantage of using r is that it is well known and amenable to meta-analysis. The interpretation does take a couple steps to think through, but I thought I’d try to help point you in the right direction. You’ll recall that a paired samples t-test reduces to a within samples ANOVA with 1 df in the numerator. Just as r is the square root of the proportion explained, so too is r (in this context) the square root of the proportion of variance explained by estimatin |
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
sim <- function(places=3,N=20,FUN=round,...) { | |
SSr <- function(x) {sum((FUN(x,places)-mean(FUN(x,places)))^2)} | |
SS <- function(x) {sum((x-mean(x))^2)} | |
y <- rnorm(N,...) | |
return(abs(SSr(y)-SS(y))) | |
} | |
mean(replicate(20000,sim())) |
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
#The base version on 9/23/2013 still dies on WUA_yldata_for TRB_contest Sep 10 2013.xlsx as a file name | |
xlsxToR <- function(file, keep_sheets = NULL, header = FALSE) { | |
require(XML) | |
require(plyr) | |
require(pbapply) | |
suppressWarnings(file.remove(tempdir())) | |
file.copy(file, tempdir()) | |
new_file <- list.files(tempdir(), full.name = TRUE, pattern = basename(file)) |
NewerOlder