I hereby claim:
- I am stonegold546 on github.
- I am jamesuanhoro (https://keybase.io/jamesuanhoro) on keybase.
- I have a public key ASDQwPwPar3wn53oAgVAk6oGl6VZsS7Xlucm8AE_Rkgx3wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
title Using our API: details at /api/v1/routes | |
note over API: LOGIN | |
note right of API: GET /api/v1/client_id | |
Dev->API: Request for Google OAuth Client ID | |
API->Dev: Returns Google OAuth Client ID as URL Dev can call | |
Dev->*Google: Request callback code from Google | |
Google-->Dev: Returns callback code | |
destroy Google | |
note right of API: GET /api/v1/use_callback_code |
get_gci_fcn <- function(mymeansqsvec, MC = 100000, B, L, R, alpha = 0.05) { | |
# Precondition: mymeansqsvec is a vector of mean squares from | |
# the ANOVA fit of a two-way crossed models. B>2 | |
# is the number of levels of the first factor and | |
# L>2 is the number of levels of the second factor and | |
# R>0 is the number of replicates per cell. A two-way | |
# balanced layout without interaction is assumed. | |
# MC is the number of Monte Carlo used to construct the | |
# GCI, with default one-hundred thousand. |
# require(lme4) | |
mymod <- function(data) { | |
result <- lme4::lmer(y ~ 1 + (1 | x), data = data, REML = FALSE) | |
sumy <- summary(result) | |
varb <- sumy$varcor$x[1] | |
varw <- sumy$sigma ^ 2 | |
icc <- varb / (varb + varw) | |
c(icc, varb, varw) | |
} | |
# mymod(data) |
library(lavaan) | |
library(rstan) | |
library(rethinking) | |
library(loo) | |
options(mc.cores = parallel::detectCores()) | |
rstan_options(auto_write = TRUE) | |
dat <- dplyr::select(HolzingerSwineford1939, x1:x9) |
library(lavaan) | |
library(psych) | |
sim.fun <- function (lv, lambda, nrep = 2e3) { | |
np <- nrow(lv) | |
t(replicate(nrep, { | |
X <- lv %*% lambda + | |
matrix(rnorm(np * length(lambda), 0, sqrt(1 - lambda ^ 2)), np, byrow = TRUE) | |
# summary(cfa(paste("F =~", paste0("V", 1:length(lambda), collapse = " + ")), X, std.lv = TRUE)) | |
library(lavaan) | |
summary(m0 <- cfa( | |
"F1 =~ x1 + x2 + x3 + x9\n F2 =~ x4 + x5 + x6\n F3 =~ x7 + x8 + x9\n x3 ~~ x5\n x2 ~~ x7\n x4 ~~ x7", | |
HolzingerSwineford1939, std.lv = TRUE, meanstructure = TRUE)) | |
library(rstan) | |
options(mc.cores = parallel::detectCores()) | |
rstan_options(auto_write = TRUE) |
data { | |
real<lower = 0> sd_m; | |
real<lower = 0> sd_m_diff; | |
real<lower = 0> sd_st; | |
real<lower = 0> sd_st_r; | |
int<lower = 0, upper = 1> nu_choice; | |
int<lower = 0> N; | |
vector<lower = 0, upper = 1>[N] x; | |
vector[N] y; | |
} |
progesterone <- c(1513, 2025) | |
placebo <- c(1459, 2013) | |
(tab <- as.data.frame(rbind(progesterone, placebo))) | |
names(tab) <- c("pass", "total") | |
tab$fail <- tab$total - tab$pass | |
tab$treatment <- c(1, 0) | |
chisq.test(tab[c("pass", "fail")], correct = FALSE) | |
# chisq.test(long.tab$treatment, long.tab$pass, correct = FALSE) | |
summary(glm(cbind(pass, fail) ~ treatment, binomial, tab)) |
library(lavaan) | |
X <- HolzingerSwineford1939[, paste0("x", 1:9)] | |
colMeans(X) | |
apply(X, 2, sd) | |
# min-max scaling version | |
X.p <- as.data.frame(apply(X, 2, function (x) (x - min(x)) / (max(x) - min(x)))) | |
colMeans(X.p) | |
apply(X.p, 2, sd) |