pip3 install pipenv
pipenv shell
library(tidyverse) | |
library(nlme) | |
library(rms) | |
library(lmerTest) | |
library(emmeans) | |
data("fev_data", package = "mmrm") | |
data <- fev_data %>% | |
as_tibble() %>% | |
mutate(ARMCD = as.character(ARMCD)) %>% |
library(survival) | |
library(dplyr) | |
library(modelbased) | |
library(ggplot2) | |
# Recode the status into 0 for censoring | |
data <- survival::lung %>% | |
select(time, status, age, sex) %>% | |
mutate( | |
status = status - 1, # Status is coded as 1=dead 2=alive |
# Install necessary packages if not already installed | |
install.packages("svglite") | |
install.packages("ggplot2") | |
# Load the ggplot2 library | |
library(ggplot2) | |
# Create a basic boxplot of Sepal Length by Species | |
p <- ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) + | |
geom_boxplot() + |
library(mice) | |
library(gtsummary) | |
# impute the data | |
df_imputed <- mice::mice(trial, m = 2, seed = 123) | |
# build the model list | |
imputed_model_list <- purrr::map( | |
1:df_imputed$m, | |
~ lm(age ~ marker + grade, complete(df_imputed, .x)) |
from math import comb | |
import numpy as np | |
def kravchuck(k: int, x: int, n: int, q: int) -> int: | |
""" | |
Kravchuck polynomials of the form K_k(x,n,q) where k = 0,...,n and q | |
must be a prime power. | |
""" | |
k_values = [ |
import numpy as np | |
import matplotlib.pyplot as plt | |
def collatz(x): | |
if x % 2 == 0: | |
return(x/2) | |
else: | |
return((3*x)+1) |