diff --git a/data/.Rhistory b/data/.Rhistory
new file mode 100644
index 0000000000000000000000000000000000000000..a7984eee85579db6272e5f762c190a66b37ce7cd
--- /dev/null
+++ b/data/.Rhistory
@@ -0,0 +1,64 @@
+library(survival)
+lung
+library(readr)
+write_csv(lung, "lung.csv")
+knitr::opts_chunk$set(echo = TRUE)
+data(mammals)
+data(mammals, package = "MASS")
+force(mammals)
+libary(tidyverse)
+library(tidyverse)
+ggplot(mammals, aes(x = body, y = brain)) +
+geom_point()
+ggplot(mammals, aes(x = body, y = brain)) +
+geom_point() + theme_classic()
+ggplot(mammals, aes(x = body, y = brain)) +
+geom_point() + theme_bw()
+mammals <- mammals %>%
+mutate(log_body = log(body),
+log_brain = log(brain))
+ggplot(mammals, aes(x = log_body, y = log_brain)) +
+geom_point() + theme_bw()
+library(tidyverse)
+library(rstan)
+options(mc.cores = 4)
+rstan_options(auto_write = TRUE)
+library(saemix)
+theo <- read_csv("theophyllineData.csv",
+col_types = cols(id = col_factor()))
+theo <- theo %>%
+mutate(id_num = as.integer(id))
+bayes_model_ka <- stan_model("bayes_TP2.stan")
+init_func_ka <- function(){
+ka_pop <- 1.86 #psi0_hat[1]
+ke <- 0.086    #psi0_hat[2]
+V <- 33       #psi0_hat[3]
+a <- 1
+ka <- rep(1.8, 12)   #as.matrix(psi(sfit))[,1]
+tau <- 1             #sqrt(diag(sfit@results@omega))[1]
+eta <- (ka - ka_pop)/tau
+list(ka_pop = ka_pop, ke = ke, V = V, a = a, eta = eta, tau = tau)}
+posterior_ka <- sampling(bayes_model_ka, data = stan_data,
+init = init_func_ka,
+chains = 4, warmup = 5000,
+iter = 10000,
+refresh = 1000)
+stan_data <- list(ntot = nrow(theo), N = 12, y = theo$concentration,
+id = as.integer(theo$id), tps = theo$time, D = 320)
+posterior_ka <- sampling(bayes_model_ka, data = stan_data,
+init = init_func_ka,
+chains = 4, warmup = 5000,
+iter = 10000,
+refresh = 1000)
+bayes_model_ka <- stan_model("bayes_mixed_ka.stan")
+library(nycflights13)
+?flights
+head(flights)
+write.csv2(flights, row.names = FALSE)
+path <- "/Users/ppudlo/git/m1-donnees-tp/data"
+setwd(path)
+write.csv2(flights, file="fligths.csv", row.names = FALSE)
+write.csv2(airlines, file="airlines.csv", row.names = FALSE)
+write.csv2(airports, file="airports.csv", row.names = FALSE)
+write.csv2(planes, file="planes.csv", row.names = FALSE)
+write.csv2(weather, file="weather.csv", row.names = FALSE)