Skip to content

Instantly share code, notes, and snippets.

aaroncharlton

Block or report user

Report or block aaroncharlton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View authenticity.r
setwd("~/Research/PPAuthenticity/studies/Study1")
library(dplyr)
filter <- dplyr::filter
select <- dplyr::select
qualtrics <- read.csv("PPAuthenticity2SPAPR15.csv", stringsAsFactors = FALSE) %>%
filter(grepl("^95", ID)) %>% # remove responses without student ID
rename(adskep_2 = adskep_10,
adskep_3 = adskep_11,
adskep_4 = adskep_12,
adskep_5 = adskep_13,
View qualtrics.r
# 1. You will need to do a one-time install of the dplyr package (code on next line).
# install.packages("dplyr")
# 2. make sure to name the student ID column "ID" in both files
# 3. files must have two header rows (qualtrics-style) and be in .csv format
# 4. update all three of the following variables and don't forget the quotes!
qualtrics_file <- "Authenticity2.csv"
demos_file <- "Spring 2015 Demos %28UPPER 3-8%29 (1).csv"
save_location <- "C:/Users/abc/Downloads"
### shouldn't need to modify below this line ####
View gist:485bd28d54eb55f8a76f
<a href="http://taqueriaelpatoverde.com/">My friends' restaurant</a>
<i>Italic</i> versus <strong>Bold</strong>
<h1>Header 1</h1>
<h2>Header 2</h2>
<p>Regular paragraph</p>
View gist:ddb6edcfbdd1445de598
<a href="https://twitter.com/aaroncharlton">Aaron's twitter page</a>
View Independence tests
library(plyr)
type.1 <- NULL
p.values <- NULL
all.p <- NULL
for (j in 1:100){
for (i in 1:1000){
indy <- sample(1:2,29, replace=TRUE)
inter <- sample(1:2,31, replace=TRUE)
indy.c <- count(indy)[,2]
inter.c <- count(inter)[,2]
View gist:2a58914de3471052f798
## model selection
# This is Max Kuhn's tutorial on caret: http://topepo.github.io/caret/training.html
library(mlbench)
data(Sonar)
str(Sonar[, 1:10])
library(caret)
set.seed(998)
View gist:6e3e76907875f4e2e43e
# here is the data:
# http://www.ams.usda.gov/AMSv1.0/getfile?dDocName=STELPRDC5087258
# You'll need to remove the first two lines and save a .csv file
setwd("C:/Users/abc/Downloads")
markets <- read.csv("farmers-market.csv")
OR.markets <- markets %>%
filter(State=="Oregon")
require(ggplot2)
View gist:b1ce016b7ea320423e93
# http://ww2.coastal.edu/kingw/statistics/R-tutorials/independ.html
# Study 1A
# find numbers for chi square table
indy_affect <- round(.552*29)
inter_affect <- round(.29*31)
inter_cog <- round(.71*31)
View gist:ef72963abe904bbed5d4
pf(q=6.21, df1=1, df2=132, lower.tail=FALSE) # interaction self-construal and mood
pf(q=4, df1=1, df2=132, lower.tail=FALSE)
pf(q=2.33, df1=1, df2=132, lower.tail=FALSE)
View gist:72bc1b5a52b483a5eaab
# chi-squared test
chisq.test(tbl) # Yate's continuity correction is the default
chisq.test(tbl, correct=FALSE) # no Yate's continuity correction
fisher.test(tbl) # fisher's exact test for count data
chisq.test(tbl, simulate.p.value=T, B=999) # Markov chain
You can’t perform that action at this time.