Temporal Learning: IS50 prior RT
|
|
- Erica Lewis
- 5 years ago
- Views:
Transcription
1 Temporal Learning: IS50 prior RT Loading required package: Matrix Jihyun Suh 1/27/2016 This data.table install has not detected OpenMP support. It will work but slower in single threaded m Attaching package: 'lmertest' The following object is masked from 'package:lme4': lmer The following object is masked from 'package:stats': step Attaching package: 'ggplot2' The following objects are masked from 'package:psych': %+%, alpha setwd("~/box Sync/Lab meeting/bugg") # data<-as.data.frame(read.csv('bugg_data_cleaned.csv', header = TRUE, sep = # ',')) raw_data <- as.data.frame(read.csv("bugg_raw_data.csv", header = TRUE, sep = ",")) raw_data$subjpcno <- NA raw_data$subjpcno[which(raw_data$subjpc == "MC")] <- 0 raw_data$subjpcno[which(raw_data$subjpc == "MI")] <- 1 # feature repetition raw_data$feature_r <- NA library(zoo) Attaching package: 'zoo' The following objects are masked from 'package:base': as.ate, as.ate.numeric raw_data$feature_r <- c(rollapply(raw_data$color, width = 2, FUN = function(x) as.numeric(!identical(x[2 x[1]))), NA) raw_data$feature_r_1 <- NA raw_data$feature_r_1[2:nrow(raw_data)] <- raw_data$feature_r[1:nrow(raw_data) - 1] raw_data$feature_r_1[which(is.na(raw_data$priorrt))] <- NA raw_data <- subset(raw_data, select = -feature_r) filtering incorrect trials 1
2 p_incorr <- (length(which(raw_data$accuracy == 0))/nrow(raw_data)) * 100 p_incorr [1] data_won <- raw_data[raw_data$accuracy!= 0, ] filtering fast/slow trials p_out_rt <- (length(which(data_won$rt >= 3000 data_won$rt <= 200))/nrow(data_won)) * 100 p_out_rt [1] data_won <- data_won[data_won$rt < 3000, ] data_won <- data_won[data_won$rt > 200, ] data_won$priorrt[which(data_won$priorrt >= 3000)] <- NA data_won$priorrt[which(data_won$priorrt <= 200)] <- NA # eliminate neutral trials data_won <- data_won[data_won$congruency!= "neutral", ] # eliminate biased trials data_won <- data_won[data_won$ispc == "IS50", ] # eliminate feature repetition data_won <- data_won[data_won$feature_r_1 == 1, ] data_won <- na.omit(data_won) # data$priorerr[is.na(data$priorerr)] <- 2 eliminate N-1 errors # data<-subset(data,priorerr!=0,select=expname:priorerr) # eliminate neutral trials data_won<-data[data$trialtype!='neutral',] remove # rows with all nas data_won <- data_won[!apply(is.na(data_won), 1, all),] # data_won<-data # transform RT data_won$t_rt <- (1/data_won$rt) * data_won$t_priorrt <- (1/data_won$priorRT) * # centering prior RT original data_won$rt_gc <- data_won$rt - mean(data_won$rt, na.rm = T) data_won$priorrt_gc <- data_won$priorrt - mean(data_won$priorrt, na.rm = T) # transformed data_won$t_rt_gc <- data_won$t_rt - mean(data_won$t_rt, na.rm = T) data_won$t_priorrt_gc <- data_won$t_priorrt - mean(data_won$t_priorrt, na.rm = T) # Normality Test Plot_RT <- as.numeric(scale(data_won$rt)) Plot_T_RT <- as.numeric(scale(data_won$t_rt)) Plot_RT <- Plot_RT[!is.na(Plot_RT)] Plot_T_RT <- Plot_T_RT[!is.na(Plot_T_RT)] 2
3 n1 <- length(plot_rt) n2 <- length(plot_t_rt) probabilities_1 = (1:n1)/(n1 + 1) probabilities_2 = (1:n2)/(n2 + 1) normal.quantiles1 = qnorm(probabilities_1, mean(plot_rt, na.rm = TRUE), sd(plot_rt, na.rm = T)) plot(sort(normal.quantiles1), sort(plot_rt), xlab = "Theoretical Quantiles from Normal istribution", ylab = "Sample Quqnatiles of RT", main = "Normal Quantile-Quantile Plot of RT", xlim = c(-7, 5), ylim = c(-7, 5)) abline(0, 1) Normal Quantile Quantile Plot of RT Sample Quqnatiles of RT Theoretical Quantiles from Normal istribution hist(plot_rt) 3
4 Histogram of Plot_RT Frequency Plot_RT normal.quantiles2 = qnorm(probabilities_2, mean(plot_t_rt, na.rm = TRUE), sd(plot_t_rt, na.rm = T)) plot(sort(normal.quantiles2), sort(plot_t_rt), xlab = "Theoretical Quantiles from Normal istribution", ylab = "Sample Quqnatiles of Transformed RT", main = "Normal Quantile-Quantile Plot of Transfromed_R xlim = c(-7, 5), ylim = c(-7, 5)) abline(0, 1) 4
5 Normal Quantile Quantile Plot of Transfromed_RT Sample Quqnatiles of Transformed RT Theoretical Quantiles from Normal istribution hist(plot_t_rt) Histogram of Plot_T_RT Frequency Mixed Model # exclude NAs data_won <- na.omit(data_won) Plot_T_RT #Linear 5
6 # Set model optimizer cl <- lmercontrol(optimizer = "optimx", optctrl = list(method = "nlminb", maxiter = )) Transformed RT 1) PC x trialtype Fit1a <- lmer(t_rt ~ subjpcno + trialtype + subjpcno:trialtype + (1 unique_subjno) + (1 stimuli) + (1 experiment), data = data_won, na.action = na.exclude, control = cl) summary(fit1a) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: t_rt ~ subjpcno + trialtype + subjpcno:trialtype + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: data_won Control: cl REML criterion at convergence: Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept) stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: Estimate Std. Error df t value (Intercept) subjpcno trialtype subjpcno:trialtype Pr(> t ) (Intercept) < *** subjpcno ** trialtype *** subjpcno:trialtype *** --- Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) sbjpcn trltyp 6
7 subjpcno trialtype sbjpcn:trlt # fixef(fit1a) av1 <- vcov(fit1a) [1] ) PC x trialtype + prior RT new_data <- data_won[data_won$prior.acc!= 0, ] Fit1b <- lmer(t_rt ~ subjpcno + trialtype + t_priorrt_gc + subjpcno:trialtype + (1 unique_subjno) + (1 stimuli) + (1 experiment), data = new_data, na.action = na.exclude, control = cl) summary(fit1b) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: t_rt ~ subjpcno + trialtype + t_priorrt_gc + subjpcno:trialtype + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: new_data Control: cl REML criterion at convergence: Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept) stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: Estimate Std. Error df t value (Intercept) subjpcno trialtype t_priorrt_gc subjpcno:trialtype Pr(> t ) (Intercept) < *** subjpcno ** 7
8 trialtype *** t_priorrt_gc < *** subjpcno:trialtype *** --- Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) sbjpcn trltyp t_prt_ subjpcno trialtype t_prirrt_gc sbjpcn:trlt # fixef(fit1b) vcov(fit1b) av1 <- vcov(fit1b) [1] ) PCtrialtypepriorRT - 3way interaction Fit1c <- lmer(t_rt ~ subjpcno + trialtype + t_priorrt_gc + subjpcno:trialtype + subjpcno:t_priorrt_gc + trialtype:t_priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment), data = new_data, na.action = na.exclude, control = cl) summary(fit1c) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: t_rt ~ subjpcno + trialtype + t_priorrt_gc + subjpcno:trialtype + subjpcno:t_priorrt_gc + trialtype:t_priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: new_data Control: cl REML criterion at convergence: Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept) stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: 8
9 Estimate Std. Error df t value (Intercept) subjpcno trialtype t_priorrt_gc subjpcno:trialtype subjpcno:t_priorrt_gc trialtype:t_priorrt_gc Pr(> t ) (Intercept) < *** subjpcno ** trialtype *** t_priorrt_gc < *** subjpcno:trialtype *** subjpcno:t_priorrt_gc trialtype:t_priorrt_gc *** --- Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) sbjpcn trltyp t_prt_ sbjpc: spc:_r subjpcno trialtype t_prirrt_gc sbjpcn:trlt sbjpcn:_rt_ trltyp:_rt_ # fixef(fit1c) vcov(fit1c) av1 <- vcov(fit1c) [1] ) PC + trialtype + PriorRT + PC x trialtype + trialtype x priort (Schmidt s) Fit1d <- lmer(t_rt ~ subjpcno + trialtype + t_priorrt_gc + subjpcno:trialtype + trialtype:t_priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment), data = new_data, na.action = na.exclude, control = cl) summary(fit1d) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: t_rt ~ subjpcno + trialtype + t_priorrt_gc + subjpcno:trialtype + trialtype:t_priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: new_data Control: cl REML criterion at convergence:
10 Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept) stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: Estimate Std. Error df t value (Intercept) subjpcno trialtype t_priorrt_gc subjpcno:trialtype trialtype:t_priorrt_gc Pr(> t ) (Intercept) < *** subjpcno ** trialtype *** t_priorrt_gc < *** subjpcno:trialtype *** trialtype:t_priorrt_gc *** --- Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) sbjpcn trltyp t_prt_ sbjpc: subjpcno trialtype t_prirrt_gc sbjpcn:trlt trltyp:_rt_ # fixef(fit1d) vcov(fit1d) av1 <- vcov(fit1d) [1] ) three-way interaction Fit1e <- lmer(t_rt ~ subjpcno + trialtype + t_priorrt_gc + subjpcno:trialtype + subjpcno:t_priorrt_gc + trialtype:t_priorrt_gc + subjpcno:trialtype:t_priorrt_gc + 10
11 (1 unique_subjno) + (1 stimuli) + (1 experiment), data = new_data, na.action = na.exclude, control = cl) summary(fit1e) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: t_rt ~ subjpcno + trialtype + t_priorrt_gc + subjpcno:trialtype + subjpcno:t_priorrt_gc + trialtype:t_priorrt_gc + subjpcno:trialtype:t_priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: new_data Control: cl REML criterion at convergence: Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept) stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: Estimate Std. Error df t value (Intercept) subjpcno trialtype t_priorrt_gc subjpcno:trialtype subjpcno:t_priorrt_gc trialtype:t_priorrt_gc subjpcno:trialtype:t_priorrt_gc Pr(> t ) (Intercept) < *** subjpcno ** trialtype *** t_priorrt_gc *** subjpcno:trialtype *** subjpcno:t_priorrt_gc trialtype:t_priorrt_gc *** subjpcno:trialtype:t_priorrt_gc Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) sbjpcn trltyp t_prt_ sbjpc: spc:_r t:_rt_ subjpcno trialtype
12 t_prirrt_gc sbjpcn:trlt sbjpcn:_rt_ trltyp:_rt_ sbjpc::_rt_ # fixef(fit1e) vcov(fit1e) av1 <- vcov(fit1e) [1] untransformed RT 1) PC x trialtype Fit2a <- lmer(rt ~ subjpcno + trialtype + subjpcno:trialtype + (1 unique_subjno) + (1 stimuli) + (1 experiment), data = data_won, na.action = na.exclude, control = cl) summary(fit2a) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: rt ~ subjpcno + trialtype + subjpcno:trialtype + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: data_won Control: cl REML criterion at convergence: Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept) stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: Estimate Std. Error df t value (Intercept) subjpcno trialtype subjpcno:trialtype
13 Pr(> t ) (Intercept) < *** subjpcno ** trialtype *** subjpcno:trialtype *** --- Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) sbjpcn trltyp subjpcno trialtype sbjpcn:trlt # fixef(fit2a) vcov(fit2a) av1 <- vcov(fit2a) [1] ) PC x trialtype + prior RT Fit2b <- lmer(rt ~ subjpcno + trialtype + priorrt_gc + subjpcno:trialtype + (1 unique_subjno) + (1 stimuli) + (1 experiment), data = new_data, na.action = na.exclude, control = cl) summary(fit2b) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: rt ~ subjpcno + trialtype + priorrt_gc + subjpcno:trialtype + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: new_data Control: cl REML criterion at convergence: Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept) stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: Estimate Std. Error df t value 13
14 (Intercept) subjpcno trialtype priorrt_gc subjpcno:trialtype Pr(> t ) (Intercept) < *** subjpcno ** trialtype *** priorrt_gc < *** subjpcno:trialtype *** --- Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) sbjpcn trltyp prrrt_ subjpcno trialtype priorrt_gc sbjpcn:trlt # fixef(fit2b) vcov(fit2b) av1 <- vcov(fit2b) [1] ) PCtrialtypepriorRT - 3way interaction Fit2c <- lmer(rt_gc ~ subjpcno + trialtype + priorrt_gc + subjpcno:trialtype + subjpcno:priorrt_gc + trialtype:priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment), data = new_data, na.action = na.exclude, control = cl) summary(fit2c) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: rt_gc ~ subjpcno + trialtype + priorrt_gc + subjpcno:trialtype + subjpcno:priorrt_gc + trialtype:priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: new_data Control: cl REML criterion at convergence: Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept)
15 stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: Estimate Std. Error df t value (Intercept) subjpcno trialtype priorrt_gc subjpcno:trialtype subjpcno:priorrt_gc trialtype:priorrt_gc Pr(> t ) (Intercept) *** subjpcno ** trialtype *** priorrt_gc *** subjpcno:trialtype *** subjpcno:priorrt_gc trialtype:priorrt_gc Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) sbjpcn trltyp prrrt_ sbjpc: spc:rt subjpcno trialtype priorrt_gc sbjpcn:trlt sbjpcn:prt_ trltyp:prt_ # fixef(fit2c) vcov(fit2c) av1 <- vcov(fit2c) [1] ) PC + trialtype + PriorRT + PC x trialtype + trialtype x priort (Schmidt s) Fit2d <- lmer(rt ~ subjpcno + trialtype + priorrt_gc + subjpcno:trialtype + trialtype:priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment), data = new_data, na.action = na.exclude) summary(fit2d) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: rt ~ subjpcno + trialtype + priorrt_gc + subjpcno:trialtype + 15
16 trialtype:priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: new_data REML criterion at convergence: Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept) stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: Estimate Std. Error df t value (Intercept) subjpcno trialtype priorrt_gc subjpcno:trialtype trialtype:priorrt_gc Pr(> t ) (Intercept) < *** subjpcno ** trialtype *** priorrt_gc *** subjpcno:trialtype *** trialtype:priorrt_gc Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: (Intr) sbjpcn trltyp prrrt_ sbjpc: subjpcno trialtype priorrt_gc sbjpcn:trlt trltyp:prt_ # fixef(fit2d) vcov(fit2d) av1 <- vcov(fit2d) [1]
17 5) three-way interaction Fit2e <- lmer(rt ~ subjpcno + trialtype + priorrt_gc + subjpcno:trialtype + subjpcno:priorrt_gc + trialtype:priorrt_gc + subjpcno:trialtype:priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment), data = new_data, na.action = na.exclude, control = cl) summary(fit2e) Linear mixed model fit by REML t-tests use Satterthwaite approximations to degrees of freedom [lmermod] Formula: rt ~ subjpcno + trialtype + priorrt_gc + subjpcno:trialtype + subjpcno:priorrt_gc + trialtype:priorrt_gc + subjpcno:trialtype:priorrt_gc + (1 unique_subjno) + (1 stimuli) + (1 experiment) ata: new_data Control: cl REML criterion at convergence: Scaled residuals: Min 1Q Median 3Q Max Random effects: Groups Name Variance Std.ev. unique_subjno (Intercept) stimuli (Intercept) experiment (Intercept) Residual Number of obs: 5785, groups: unique_subjno, 72; stimuli, 32; experiment, 2 Fixed effects: Estimate Std. Error df t value (Intercept) subjpcno trialtype priorrt_gc subjpcno:trialtype subjpcno:priorrt_gc trialtype:priorrt_gc subjpcno:trialtype:priorrt_gc Pr(> t ) (Intercept) < *** subjpcno ** trialtype *** priorrt_gc *** subjpcno:trialtype *** subjpcno:priorrt_gc trialtype:priorrt_gc subjpcno:trialtype:priorrt_gc Signif. codes: 0 '***' '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Correlation of Fixed Effects: 17
18 (Intr) sbjpcn trltyp prrrt_ sbjpc: spc:rt tr:rt_ subjpcno trialtype priorrt_gc sbjpcn:trlt sbjpcn:prt_ trltyp:prt_ sbjpcn::rt_ # fixef(fit2e) vcov(fit2e) av1 <- vcov(fit2e) [1]
Stat 5303 (Oehlert): Balanced Incomplete Block Designs 1
Stat 5303 (Oehlert): Balanced Incomplete Block Designs 1 > library(stat5303libs);library(cfcdae);library(lme4) > weardata
More informationStat 5303 (Oehlert): Randomized Complete Blocks 1
Stat 5303 (Oehlert): Randomized Complete Blocks 1 > library(stat5303libs);library(cfcdae);library(lme4) > immer Loc Var Y1 Y2 1 UF M 81.0 80.7 2 UF S 105.4 82.3 3 UF V 119.7 80.4 4 UF T 109.7 87.2 5 UF
More informationA Handbook of Statistical Analyses Using R 2nd Edition. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R 2nd Edition Brian S. Everitt and Torsten Hothorn CHAPTER 12 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues
More informationWorkshop 9.3a: Randomized block designs
-1- Workshop 93a: Randomized block designs Murray Logan November 23, 16 Table of contents 1 Randomized Block (RCB) designs 1 2 Worked Examples 12 1 Randomized Block (RCB) designs 11 RCB design Simple Randomized
More informationA Handbook of Statistical Analyses Using R 2nd Edition. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R 2nd Edition Brian S. Everitt and Torsten Hothorn CHAPTER 12 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues
More informationMixed Model: Split plot with two whole-plot factors, one split-plot factor, and CRD at the whole-plot level (e.g. fancier split-plot p.
STAT:5201 Applied Statistic II Mixed Model: Split plot with two whole-plot factors, one split-plot factor, and CRD at the whole-plot level (e.g. fancier split-plot p.422 OLRT) Hamster example with three
More informationlme4 Luke Chang Last Revised July 16, Fitting Linear Mixed Models with a Varying Intercept
lme4 Luke Chang Last Revised July 16, 2010 1 Using lme4 1.1 Fitting Linear Mixed Models with a Varying Intercept We will now work through the same Ultimatum Game example from the regression section and
More informationLab 3 A Quick Introduction to Multiple Linear Regression Psychology The Multiple Linear Regression Model
Lab 3 A Quick Introduction to Multiple Linear Regression Psychology 310 Instructions.Work through the lab, saving the output as you go. You will be submitting your assignment as an R Markdown document.
More informationA Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R Brian S. Everitt and Torsten Hothorn CHAPTER 10 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues 10.1 Introduction
More informationMODELS WITHOUT AN INTERCEPT
Consider the balanced two factor design MODELS WITHOUT AN INTERCEPT Factor A 3 levels, indexed j 0, 1, 2; Factor B 5 levels, indexed l 0, 1, 2, 3, 4; n jl 4 replicate observations for each factor level
More informationInference with Heteroskedasticity
Inference with Heteroskedasticity Note on required packages: The following code requires the packages sandwich and lmtest to estimate regression error variance that may change with the explanatory variables.
More informationBIOL 458 BIOMETRY Lab 9 - Correlation and Bivariate Regression
BIOL 458 BIOMETRY Lab 9 - Correlation and Bivariate Regression Introduction to Correlation and Regression The procedures discussed in the previous ANOVA labs are most useful in cases where we are interested
More informationDensity Temp vs Ratio. temp
Temp Ratio Density 0.00 0.02 0.04 0.06 0.08 0.10 0.12 Density 0.0 0.2 0.4 0.6 0.8 1.0 1. (a) 170 175 180 185 temp 1.0 1.5 2.0 2.5 3.0 ratio The histogram shows that the temperature measures have two peaks,
More informationSolution pigs exercise
Solution pigs exercise Course repeated measurements - R exercise class 2 November 24, 2017 Contents 1 Question 1: Import data 3 1.1 Data management..................................... 3 1.2 Inspection
More informationİlk Dönem Ocak 2008 ve Aralık 2009 arasındak borsa kapanış fiyatlarının logaritmik farklarının 100 ile çarpılması ile elde edilmiştir.
periodical Kağan Karademir Tuesday, May 26, 2015 library(xts) Loading required package: zoo Attaching package: 'zoo' The following objects are masked from 'package:base': as.date, as.date.numeric library(tseries)
More informationChapter 8 Conclusion
1 Chapter 8 Conclusion Three questions about test scores (score) and student-teacher ratio (str): a) After controlling for differences in economic characteristics of different districts, does the effect
More informationLinear Probability Model
Linear Probability Model Note on required packages: The following code requires the packages sandwich and lmtest to estimate regression error variance that may change with the explanatory variables. If
More informationGov 2000: 9. Regression with Two Independent Variables
Gov 2000: 9. Regression with Two Independent Variables Matthew Blackwell Harvard University mblackwell@gov.harvard.edu Where are we? Where are we going? Last week: we learned about how to calculate a simple
More informationHandout 4: Simple Linear Regression
Handout 4: Simple Linear Regression By: Brandon Berman The following problem comes from Kokoska s Introductory Statistics: A Problem-Solving Approach. The data can be read in to R using the following code:
More information20. REML Estimation of Variance Components. Copyright c 2018 (Iowa State University) 20. Statistics / 36
20. REML Estimation of Variance Components Copyright c 2018 (Iowa State University) 20. Statistics 510 1 / 36 Consider the General Linear Model y = Xβ + ɛ, where ɛ N(0, Σ) and Σ is an n n positive definite
More informationSTAT 572 Assignment 5 - Answers Due: March 2, 2007
1. The file glue.txt contains a data set with the results of an experiment on the dry sheer strength (in pounds per square inch) of birch plywood, bonded with 5 different resin glues A, B, C, D, and E.
More informationChapter 6 Exercises 1. Data Analysis & Graphics Using R Solutions to Exercises (April 24, 2004)
Chapter 6 Exercises 1 Data Analysis & Graphics Using R Solutions to Exercises (April 24, 2004) Preliminaries > library(daag) Exercise 1 The data set cities lists the populations (in thousands) of Canada
More informationCoefficient of Determination
Coefficient of Determination ST 430/514 The coefficient of determination, R 2, is defined as before: R 2 = 1 SS E (yi ŷ i ) = 1 2 SS yy (yi ȳ) 2 The interpretation of R 2 is still the fraction of variance
More informationRegression and the 2-Sample t
Regression and the 2-Sample t James H. Steiger Department of Psychology and Human Development Vanderbilt University James H. Steiger (Vanderbilt University) Regression and the 2-Sample t 1 / 44 Regression
More informationSPH 247 Statistical Analysis of Laboratory Data
SPH 247 Statistical Analysis of Laboratory Data March 31, 2015 SPH 247 Statistical Analysis of Laboratory Data 1 ANOVA Fixed and Random Effects We will review the analysis of variance (ANOVA) and then
More informationHow to work correctly statistically about sex ratio
How to work correctly statistically about sex ratio Marc Girondot Version of 12th April 2014 Contents 1 Load packages 2 2 Introduction 2 3 Confidence interval of a proportion 4 3.1 Pourcentage..............................
More informationR Output for Linear Models using functions lm(), gls() & glm()
LM 04 lm(), gls() &glm() 1 R Output for Linear Models using functions lm(), gls() & glm() Different kinds of output related to linear models can be obtained in R using function lm() {stats} in the base
More informationFitting mixed models in R
Fitting mixed models in R Contents 1 Packages 2 2 Specifying the variance-covariance matrix (nlme package) 3 2.1 Illustration:.................................... 3 2.2 Technical point: why to use as.numeric(time)
More informationANOVA (Analysis of Variance) output RLS 11/20/2016
ANOVA (Analysis of Variance) output RLS 11/20/2016 1. Analysis of Variance (ANOVA) The goal of ANOVA is to see if the variation in the data can explain enough to see if there are differences in the means.
More informationMixed effects models
Mixed effects models The basic theory and application in R Mitchel van Loon Research Paper Business Analytics Mixed effects models The basic theory and application in R Author: Mitchel van Loon Research
More informationSolution Anti-fungal treatment (R software)
Contents Solution Anti-fungal treatment (R software) Question 1: Data import 2 Question 2: Compliance with the timetable 4 Question 3: population average model 5 Question 4: continuous time model 9 Question
More informationIntroduction to Statistics and R
Introduction to Statistics and R Mayo-Illinois Computational Genomics Workshop (2018) Ruoqing Zhu, Ph.D. Department of Statistics, UIUC rqzhu@illinois.edu June 18, 2018 Abstract This document is a supplimentary
More informationHierarchical Random Effects
enote 5 1 enote 5 Hierarchical Random Effects enote 5 INDHOLD 2 Indhold 5 Hierarchical Random Effects 1 5.1 Introduction.................................... 2 5.2 Main example: Lactase measurements in
More informationStat 5031 Quadratic Response Surface Methods (QRSM) Sanford Weisberg November 30, 2015
Stat 5031 Quadratic Response Surface Methods (QRSM) Sanford Weisberg November 30, 2015 One Variable x = spacing of plants (either 4, 8 12 or 16 inches), and y = plant yield (bushels per acre). Each condition
More informationStat 411/511 ESTIMATING THE SLOPE AND INTERCEPT. Charlotte Wickham. stat511.cwick.co.nz. Nov
Stat 411/511 ESTIMATING THE SLOPE AND INTERCEPT Nov 20 2015 Charlotte Wickham stat511.cwick.co.nz Quiz #4 This weekend, don t forget. Usual format Assumptions Display 7.5 p. 180 The ideal normal, simple
More informationCuckoo Birds. Analysis of Variance. Display of Cuckoo Bird Egg Lengths
Cuckoo Birds Analysis of Variance Bret Larget Departments of Botany and of Statistics University of Wisconsin Madison Statistics 371 29th November 2005 Cuckoo birds have a behavior in which they lay their
More informationSLR output RLS. Refer to slr (code) on the Lecture Page of the class website.
SLR output RLS Refer to slr (code) on the Lecture Page of the class website. Old Faithful at Yellowstone National Park, WY: Simple Linear Regression (SLR) Analysis SLR analysis explores the linear association
More informationIntroduction and Background to Multilevel Analysis
Introduction and Background to Multilevel Analysis Dr. J. Kyle Roberts Southern Methodist University Simmons School of Education and Human Development Department of Teaching and Learning Background and
More informationRegression_Model_Project Md Ahmed June 13th, 2017
Regression_Model_Project Md Ahmed June 13th, 2017 Executive Summary Motor Trend is a magazine about the automobile industry. It is interested in exploring the relationship between a set of variables and
More informationMATH 644: Regression Analysis Methods
MATH 644: Regression Analysis Methods FINAL EXAM Fall, 2012 INSTRUCTIONS TO STUDENTS: 1. This test contains SIX questions. It comprises ELEVEN printed pages. 2. Answer ALL questions for a total of 100
More informationMultiple Linear Regression (solutions to exercises)
Chapter 6 1 Chapter 6 Multiple Linear Regression (solutions to exercises) Chapter 6 CONTENTS 2 Contents 6 Multiple Linear Regression (solutions to exercises) 1 6.1 Nitrate concentration..........................
More informationOutline. 1 Preliminaries. 2 Introduction. 3 Multivariate Linear Regression. 4 Online Resources for R. 5 References. 6 Upcoming Mini-Courses
UCLA Department of Statistics Statistical Consulting Center Introduction to Regression in R Part II: Multivariate Linear Regression Denise Ferrari denise@stat.ucla.edu Outline 1 Preliminaries 2 Introduction
More informationCorrelated Data: Linear Mixed Models with Random Intercepts
1 Correlated Data: Linear Mixed Models with Random Intercepts Mixed Effects Models This lecture introduces linear mixed effects models. Linear mixed models are a type of regression model, which generalise
More informationA brief introduction to mixed models
A brief introduction to mixed models University of Gothenburg Gothenburg April 6, 2017 Outline An introduction to mixed models based on a few examples: Definition of standard mixed models. Parameter estimation.
More informationStatistical Prediction
Statistical Prediction P.R. Hahn Fall 2017 1 Some terminology The goal is to use data to find a pattern that we can exploit. y: response/outcome/dependent/left-hand-side x: predictor/covariate/feature/independent
More informationConsider fitting a model using ordinary least squares (OLS) regression:
Example 1: Mating Success of African Elephants In this study, 41 male African elephants were followed over a period of 8 years. The age of the elephant at the beginning of the study and the number of successful
More informationBEGINNING BAYES IN R. Comparing two proportions
BEGINNING BAYES IN R Comparing two proportions Learning about many parameters Chapters 2-3: single parameter (one proportion or one mean) Chapter 4: multiple parameters Two proportions from independent
More informationANOVA and Multivariate Analysis
ANOVA and Multivariate Analysis Introduction Many PhotosynQ users are interested in comparing the performance of different treatments, crop varieties, etc. A common approach to separate different groups
More informationRegression in R I. Part I : Simple Linear Regression
UCLA Department of Statistics Statistical Consulting Center Regression in R Part I : Simple Linear Regression Denise Ferrari & Tiffany Head denise@stat.ucla.edu tiffany@stat.ucla.edu Feb 10, 2010 Objective
More information17. Example SAS Commands for Analysis of a Classic Split-Plot Experiment 17. 1
17 Example SAS Commands for Analysis of a Classic SplitPlot Experiment 17 1 DELIMITED options nocenter nonumber nodate ls80; Format SCREEN OUTPUT proc import datafile"c:\data\simulatedsplitplotdatatxt"
More informationIntroduction to the Analysis of Hierarchical and Longitudinal Data
Introduction to the Analysis of Hierarchical and Longitudinal Data Georges Monette, York University with Ye Sun SPIDA June 7, 2004 1 Graphical overview of selected concepts Nature of hierarchical models
More informationValue Added Modeling
Value Added Modeling Dr. J. Kyle Roberts Southern Methodist University Simmons School of Education and Human Development Department of Teaching and Learning Background for VAMs Recall from previous lectures
More informationHands on cusp package tutorial
Hands on cusp package tutorial Raoul P. P. P. Grasman July 29, 2015 1 Introduction The cusp package provides routines for fitting a cusp catastrophe model as suggested by (Cobb, 1978). The full documentation
More informationRegression on Faithful with Section 9.3 content
Regression on Faithful with Section 9.3 content The faithful data frame contains 272 obervational units with variables waiting and eruptions measuring, in minutes, the amount of wait time between eruptions,
More informationA Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R Brian S. Everitt and Torsten Hothorn CHAPTER 5 Multiple Linear Regression: Cloud Seeding 5.1 Introduction 5.2 Multiple Linear Regression 5.3 Analysis Using R
More informationSAS Procedures Inference about the Line ffl model statement in proc reg has many options ffl To construct confidence intervals use alpha=, clm, cli, c
Inference About the Slope ffl As with all estimates, ^fi1 subject to sampling var ffl Because Y jx _ Normal, the estimate ^fi1 _ Normal A linear combination of indep Normals is Normal Simple Linear Regression
More informationMultiple Predictor Variables: ANOVA
Multiple Predictor Variables: ANOVA 1/32 Linear Models with Many Predictors Multiple regression has many predictors BUT - so did 1-way ANOVA if treatments had 2 levels What if there are multiple treatment
More informationPoisson Regression. James H. Steiger. Department of Psychology and Human Development Vanderbilt University
Poisson Regression James H. Steiger Department of Psychology and Human Development Vanderbilt University James H. Steiger (Vanderbilt University) Poisson Regression 1 / 49 Poisson Regression 1 Introduction
More informationA Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R Brian S. Everitt and Torsten Hothorn CHAPTER 6 Logistic Regression and Generalised Linear Models: Blood Screening, Women s Role in Society, and Colonic Polyps
More informationRandom and Mixed Effects Models - Part III
Random and Mixed Effects Models - Part III Statistics 149 Spring 2006 Copyright 2006 by Mark E. Irwin Quasi-F Tests When we get to more than two categorical factors, some times there are not nice F tests
More informationOutline. Mixed models in R using the lme4 package Part 3: Longitudinal data. Sleep deprivation data. Simple longitudinal data
Outline Mixed models in R using the lme4 package Part 3: Longitudinal data Douglas Bates Longitudinal data: sleepstudy A model with random effects for intercept and slope University of Wisconsin - Madison
More information13. The Cochran-Satterthwaite Approximation for Linear Combinations of Mean Squares
13. The Cochran-Satterthwaite Approximation for Linear Combinations of Mean Squares opyright c 2018 Dan Nettleton (Iowa State University) 13. Statistics 510 1 / 18 Suppose M 1,..., M k are independent
More informationMultiple Regression: Example
Multiple Regression: Example Cobb-Douglas Production Function The Cobb-Douglas production function for observed economic data i = 1,..., n may be expressed as where O i is output l i is labour input c
More informationHomework 3 - Solution
STAT 526 - Spring 2011 Homework 3 - Solution Olga Vitek Each part of the problems 5 points 1. KNNL 25.17 (Note: you can choose either the restricted or the unrestricted version of the model. Please state
More informationcor(dataset$measurement1, dataset$measurement2, method= pearson ) cor.test(datavector1, datavector2, method= pearson )
Tutorial 7: Correlation and Regression Correlation Used to test whether two variables are linearly associated. A correlation coefficient (r) indicates the strength and direction of the association. A correlation
More informationSolutions to obligatorisk oppgave 2, STK2100
Solutions to obligatorisk oppgave 2, STK2100 Vinnie Ko May 14, 2018 Disclaimer: This document is made solely for my own personal use and can contain many errors. Oppgave 1 We load packages and read data
More informationOutline. Statistical inference for linear mixed models. One-way ANOVA in matrix-vector form
Outline Statistical inference for linear mixed models Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark general form of linear mixed models examples of analyses using linear mixed
More informationTopics on Statistics 2
Topics on Statistics 2 Pejman Mahboubi March 7, 2018 1 Regression vs Anova In Anova groups are the predictors. When plotting, we can put the groups on the x axis in any order we wish, say in increasing
More informationPumpkin Example: Flaws in Diagnostics: Correcting Models
Math 3080. Treibergs Pumpkin Example: Flaws in Diagnostics: Correcting Models Name: Example March, 204 From Levine Ramsey & Smidt, Applied Statistics for Engineers and Scientists, Prentice Hall, Upper
More informationT-test: means of Spock's judge versus all other judges 1 12:10 Wednesday, January 5, judge1 N Mean Std Dev Std Err Minimum Maximum
T-test: means of Spock's judge versus all other judges 1 The TTEST Procedure Variable: pcwomen judge1 N Mean Std Dev Std Err Minimum Maximum OTHER 37 29.4919 7.4308 1.2216 16.5000 48.9000 SPOCKS 9 14.6222
More informationHoliday Assignment PS 531
Holiday Assignment PS 531 Prof: Jake Bowers TA: Paul Testa January 27, 2014 Overview Below is a brief assignment for you to complete over the break. It should serve as refresher, covering some of the basic
More informationSCHOOL OF MATHEMATICS AND STATISTICS
SHOOL OF MATHEMATIS AND STATISTIS Linear Models Autumn Semester 2015 16 2 hours Marks will be awarded for your best three answers. RESTRITED OPEN BOOK EXAMINATION andidates may bring to the examination
More informationMultivariate Statistics in Ecology and Quantitative Genetics Summary
Multivariate Statistics in Ecology and Quantitative Genetics Summary Dirk Metzler & Martin Hutzenthaler http://evol.bio.lmu.de/_statgen 5. August 2011 Contents Linear Models Generalized Linear Models Mixed-effects
More informationPAPER 218 STATISTICAL LEARNING IN PRACTICE
MATHEMATICAL TRIPOS Part III Thursday, 7 June, 2018 9:00 am to 12:00 pm PAPER 218 STATISTICAL LEARNING IN PRACTICE Attempt no more than FOUR questions. There are SIX questions in total. The questions carry
More informationIntroduction to Linear Regression
Introduction to Linear Regression James H. Steiger Department of Psychology and Human Development Vanderbilt University James H. Steiger (Vanderbilt University) Introduction to Linear Regression 1 / 46
More informationEstimated Simple Regression Equation
Simple Linear Regression A simple linear regression model that describes the relationship between two variables x and y can be expressed by the following equation. The numbers α and β are called parameters,
More informationCollinearity: Impact and Possible Remedies
Collinearity: Impact and Possible Remedies Deepayan Sarkar What is collinearity? Exact dependence between columns of X make coefficients non-estimable Collinearity refers to the situation where some columns
More informationWe would like to describe this population. Central tendency (mean) Variability (standard deviation) ( X X ) 2 N
External Validity: Assuming that there is a causal relationship in this study between the constructs of the cause and the effect, can we generalize this effect to other persons, places or times? Population
More informationANOVA: Analysis of Variation
ANOVA: Analysis of Variation The basic ANOVA situation Two variables: 1 Categorical, 1 Quantitative Main Question: Do the (means of) the quantitative variables depend on which group (given by categorical
More informationMultivariate Analysis of Variance
Chapter 15 Multivariate Analysis of Variance Jolicouer and Mosimann studied the relationship between the size and shape of painted turtles. The table below gives the length, width, and height (all in mm)
More informationBusiness Statistics. Lecture 10: Course Review
Business Statistics Lecture 10: Course Review 1 Descriptive Statistics for Continuous Data Numerical Summaries Location: mean, median Spread or variability: variance, standard deviation, range, percentiles,
More informationNature vs. nurture? Lecture 18 - Regression: Inference, Outliers, and Intervals. Regression Output. Conditions for inference.
Understanding regression output from software Nature vs. nurture? Lecture 18 - Regression: Inference, Outliers, and Intervals In 1966 Cyril Burt published a paper called The genetic determination of differences
More informationChapter 12: Linear regression II
Chapter 12: Linear regression II Timothy Hanson Department of Statistics, University of South Carolina Stat 205: Elementary Statistics for the Biological and Life Sciences 1 / 14 12.4 The regression model
More informationWhy Bayesian approaches? The average height of a rare plant
Why Bayesian approaches? The average height of a rare plant Estimation and comparison of averages is an important step in many ecological analyses and demographic models. In this demonstration you will
More informationRegression, Part I. - In correlation, it would be irrelevant if we changed the axes on our graph.
Regression, Part I I. Difference from correlation. II. Basic idea: A) Correlation describes the relationship between two variables, where neither is independent or a predictor. - In correlation, it would
More informationApplied Regression Modeling: A Business Approach Chapter 3: Multiple Linear Regression Sections
Applied Regression Modeling: A Business Approach Chapter 3: Multiple Linear Regression Sections 3.4 3.6 by Iain Pardoe 3.4 Model assumptions 2 Regression model assumptions.............................................
More informationMulti-factor analysis of variance
Faculty of Health Sciences Outline Multi-factor analysis of variance Basic statistics for experimental researchers 2016 Two-way ANOVA and interaction Matched samples ANOVA Random vs systematic variation
More informationPAPER 206 APPLIED STATISTICS
MATHEMATICAL TRIPOS Part III Thursday, 1 June, 2017 9:00 am to 12:00 pm PAPER 206 APPLIED STATISTICS Attempt no more than FOUR questions. There are SIX questions in total. The questions carry equal weight.
More informationStat 401B Final Exam Fall 2015
Stat 401B Final Exam Fall 015 I have neither given nor received unauthorized assistance on this exam. Name Signed Date Name Printed ATTENTION! Incorrect numerical answers unaccompanied by supporting reasoning
More informationA Handbook of Statistical Analyses Using R 3rd Edition. Torsten Hothorn and Brian S. Everitt
A Handbook of Statistical Analyses Using R 3rd Edition Torsten Hothorn and Brian S. Everitt CHAPTER 6 Simple and Multiple Linear Regression: How Old is the Universe and Cloud Seeding 6.1 Introduction?
More informationInferences on Linear Combinations of Coefficients
Inferences on Linear Combinations of Coefficients Note on required packages: The following code required the package multcomp to test hypotheses on linear combinations of regression coefficients. If you
More informationUsing R in 200D Luke Sonnet
Using R in 200D Luke Sonnet Contents Working with data frames 1 Working with variables........................................... 1 Analyzing data............................................... 3 Random
More informationPower analysis examples using R
Power analysis examples using R Code The pwr package can be used to analytically compute power for various designs. The pwr examples below are adapted from the pwr package vignette, which is available
More informationNonlinear Models. Daphnia: Purveyors of Fine Fungus 1/30 2/30
Nonlinear Models 1/30 Daphnia: Purveyors of Fine Fungus 2/30 What do you do when you don t have a straight line? 7500000 Spores 5000000 2500000 0 30 40 50 60 70 longevity 3/30 What do you do when you don
More informationR 2 and F -Tests and ANOVA
R 2 and F -Tests and ANOVA December 6, 2018 1 Partition of Sums of Squares The distance from any point y i in a collection of data, to the mean of the data ȳ, is the deviation, written as y i ȳ. Definition.
More information1 Introduction 1. 2 The Multiple Regression Model 1
Multiple Linear Regression Contents 1 Introduction 1 2 The Multiple Regression Model 1 3 Setting Up a Multiple Regression Model 2 3.1 Introduction.............................. 2 3.2 Significance Tests
More informationChapter 5 Exercises 1
Chapter 5 Exercises 1 Data Analysis & Graphics Using R, 2 nd edn Solutions to Exercises (December 13, 2006) Preliminaries > library(daag) Exercise 2 For each of the data sets elastic1 and elastic2, determine
More informationStat 579: Generalized Linear Models and Extensions
Stat 579: Generalized Linear Models and Extensions Linear Mixed Models for Longitudinal Data Yan Lu April, 2018, week 14 1 / 64 Data structure and Model t1 t2 tn i 1st subject y 11 y 12 y 1n1 2nd subject
More informationunadjusted model for baseline cholesterol 22:31 Monday, April 19,
unadjusted model for baseline cholesterol 22:31 Monday, April 19, 2004 1 Class Level Information Class Levels Values TRETGRP 3 3 4 5 SEX 2 0 1 Number of observations 916 unadjusted model for baseline cholesterol
More informationFractional Factorial Designs
Fractional Factorial Designs ST 516 Each replicate of a 2 k design requires 2 k runs. E.g. 64 runs for k = 6, or 1024 runs for k = 10. When this is infeasible, we use a fraction of the runs. As a result,
More information