Skip to content

Instantly share code, notes, and snippets.

View SCgeeker's full-sized avatar

Sau-chin Chen SCgeeker

  • Tzu-Chi University
  • Hualien, Taiwan
  • 11:26 (UTC +08:00)
View GitHub Profile
@SCgeeker
SCgeeker / Temporal_06_FS
Created July 27, 2020 07:34
Situation_Public_Text
passage line line_text probe correct_response Dimension Foreshadow Shift
6 1 Juan’s meeting with the boss didn’t quite go as planned. n space Temporal y y
6 2 He sat at his desk snacking on mixed nuts. n space Temporal y y
6 3 He was going to have to finish the new designs before the next client meeting. n space Temporal y y
6 4 It was going to take all night. n space Temporal y y
6 5 The next morning, he reached for his coffee before remembering the cup was empty. n space Temporal y y
6 6 At least the designs were finished. n space Temporal y y
6 7 He could probably get a couple of hours of sleep before the meeting. n space Temporal y y
6 0 SNACKING y y Temporal y y
6 0 Juan’s meeting went as expected. y n Temporal y y
@SCgeeker
SCgeeker / LAB_SEED_CR.R
Created June 27, 2019 01:40
Handy code for PSA 002 labratories. Generate Lab seed number and order sequence.
##install.packages("googlesheets")
# Load googlesheets package
library(tidyverse)
library(googlesheets)
library(randomizeR)
# Connect R and my google drive
gs_auth(new_user = TRUE)
# Export the sheet.
@SCgeeker
SCgeeker / PANGEA_quasif.R
Created September 29, 2017 02:16
Compute effect size and VPC for PANGEA from quasif
## Load Raaijmakers 1999 data set from languageR
library(languageR)
data(quasif)
summary(quasif)
## Compute the variance of random effect
library(lme4)
## Parameters for the general effect size
if(!require(simr)){install.packages("simr"); library(simr)}else{library(simr)}
#library(lme4)
## Means and Variance of Behavior data
CWL2016RT <- rbind(M=c(.793,.815,.893,.866),VAR=c(.011^2,.010^2,.016^2,.015^2))
## Got the parameters of RT distributions
## Referring to https://stats.stackexchange.com/questions/12232/calculating-the-parameters-of-a-beta-distribution-using-the-mean-and-variance
estBetaParams <-function(mu, var) {
@SCgeeker
SCgeeker / gist:83ddf45357aef1206d3801f0fe0ec9db
Created April 12, 2017 10:18
Reproduce de Schoot et al. (2014) Bayesian Analysis
## Model from appendix 3
```
model{
# There are 20 individuals.
for (i in 1:n) {
# The dependent variable has a mean (beta) and prior precision (tau).
y[i] ~ dnorm(beta[i], tau)
# Beta consists of an intercept: mu (which is, without any predictors in the model equal to the mean of our dependent variable)
beta[i] <- mu [i]}
# Mu (=mean of dependent variable) has a normal prior distribution with a mean of 80 and a prior precision of .01 and the prior is limited to obtain scores between 40 and 180. The prior precision of the dependent variable, tau, has a inverse gamma prior distribution.
@SCgeeker
SCgeeker / ch01.R
Created June 1, 2015 13:22
Recommended modification
## 在Rstudio,Tools -> Global Options -> General -> Default Text Encoding -> UTF-8
## 系統語系要設定為台灣正體中文
Sys.setlocale(category = "LC_ALL", locale = "cht")
##讀取檔案、提取資料與製造變項
#這是一般 TXT 檔,檔頭有變項名稱
#資料來自於 NHIS 2010 調查,取 1955 年以前出生者(55歲以上)