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
## 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) |
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
# 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) |
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
# 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) |
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
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) |
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
# 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 |
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
# find numbers for chi square table | |
indy_affect <- round(.552*29) | |
inter_affect <- round(.29*31) | |
inter_cog <- round(.71*31) | |
indy_cog <- round(.448*29) | |
# build table | |
tbl <- matrix(c(indy_affect,indy_cog,inter_affect,inter_cog),nrow=2) | |
colnames(tbl) <- c("Indie","Inter") | |
rownames(tbl) <- c("Affect","Cog") |
NewerOlder