Heller title: “Phar 7380 week11_4 doses_cor1” output: html_document: default word_document: default Nov 8, 2024
— #libraries

library(ggplot2)
library(dplyr)
library(knitr)

#theme

my_theme<-function(x){theme_bw()+
    theme(text = element_text(size=20))+
    theme(axis.line.y = element_line(size = 2.0))+
    theme(axis.line.x = element_line(size = 2.0))+
    theme(axis.ticks = element_line(size = 1.5,colour="black"))+
    theme(axis.ticks.length=  unit(0.45, "cm"))+
    theme(axis.title.y =element_text(vjust=1.2))+
    theme(axis.title.x =element_text(vjust=-0.2))+
    theme(axis.text=element_text(colour="black"))+
    theme(panel.background = element_rect(fill ="white"))}

#0.5 mg dose

sim0.5<-read.table("C:\\Heller\\PHAR7380\\week11\\SDINDOUT1.res",skip=1,header=T)
#sim0.5<-read.table("/work/ac0837/PHAR7380/week11/indirect1.dir1/NM_run1/SDINDOUT1.res",skip=1,header=T)
sim0.5sum<-sim0.5%>%filter(CMT==4)%>%group_by(TIME)%>%summarise(cmed=median(IPRED),cu975=quantile(IPRED,0.975),cu025=quantile(IPRED,0.025))

#plots for 0.5 mg dose

ggplot(data=sim0.5%>%filter(CMT==4),aes(TIME/(7*24),IPRED*1000,group=ID))+
geom_line(size=0.5)+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## i Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
## i Please use the `linewidth` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

#median and 95% CI
ggplot(data=sim0.5sum,aes(TIME/(24*7),cmed*1000))+
geom_line(size=0.5)+
geom_line(data=sim0.5sum,aes(TIME/(24*7),cu975*1000),size=0.5,linetype="dashed")+
geom_line(data=sim0.5sum,aes(TIME/(24*7),cu025*1000),size=0.5,linetype="dashed")+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")

#CD4 suppression at any time post-dose is defined as ≥ 10% of subjects with CD4 counts < 80% of pre-dose values. You need to interpret the table for the criteria of CD4 suppression. Percent column is the percent of subjects with <80% counts of pre-dose values.

    sim0.5%>%
    select(ID,TIME,CMT,IPRED,BASE)%>%
    group_by(TIME)%>%
    filter(CMT==4)%>%
    mutate(suppression=(IPRED/BASE)*100)%>%
    filter(suppression<80)%>%
    summarise(percent=n_distinct(ID))%>%kable
TIME percent
0.5 40
1.0 98
1.5 100
2.0 100
3.0 100
4.0 100
6.0 100
8.0 100
10.0 100
12.0 100
18.0 100
24.0 100
36.0 100
48.0 100
60.0 100
72.0 100
96.0 100
120.0 100
144.0 100
168.0 100
336.0 96
504.0 65
672.0 34
840.0 13
1008.0 7

#0.1 mg dose results

sim0.1<-read.table("C:\\Heller\\PHAR7380\\week11\\SDINDOUT2.res",skip=1,header=T)
#sim0.1<-read.table("/work/ac0837/PHAR7380/week11/indirect2.dir1/NM_run1/SDINDOUT2.res",skip=1,header=T)
sim0.1sum<-sim0.1%>%filter(CMT==4)%>%group_by(TIME)%>%summarise(cmed=median(IPRED),cu975=quantile(IPRED,0.975),cu025=quantile(IPRED,0.025))

#plots for 0.1 mg

ggplot(data=sim0.1%>%filter(CMT==4),aes(TIME/(7*24),IPRED*1000,group=ID))+
geom_line(size=0.5)+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")

#median and 95% CI
ggplot(data=sim0.1sum,aes(TIME/(24*7),cmed*1000))+
geom_line(size=0.5)+
geom_line(data=sim0.1sum,aes(TIME/(24*7),cu975*1000),size=0.5,linetype="dashed")+
geom_line(data=sim0.1sum,aes(TIME/(24*7),cu025*1000),size=0.5,linetype="dashed")+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")

#CD4 suppression at any time post-dose is defined as ≥ 10% of subjects with CD4 counts < 80% of pre-dose values. You need to interpret the table for the criteria of CD4 suppression. Percent column is the percent of subjects with <80% counts of pre-dose values.

    sim0.1%>%
    select(ID,TIME,CMT,IPRED,BASE)%>%
    group_by(TIME)%>%
    filter(CMT==4)%>%
    mutate(suppression=(IPRED/BASE)*100)%>%
    filter(suppression<80)%>%
    summarise(percent=n_distinct(ID))%>%kable
TIME percent
1.0 24
1.5 55
2.0 79
3.0 94
4.0 97
6.0 98
8.0 98
10.0 98
12.0 98
18.0 98
24.0 98
36.0 98
48.0 98
60.0 97
72.0 97
96.0 95
120.0 91
144.0 88
168.0 80
336.0 29
504.0 3

#0.05 mg dose results

sim0.05<-read.table("C:\\Heller\\PHAR7380\\week11\\SDINDOUT3.res",skip=1,header=T)
#sim0.1<-read.table("/work/ac0837/PHAR7380/week11/indirect2.dir1/NM_run1/SDINDOUT2.res",skip=1,header=T)
sim0.05sum<-sim0.05%>%filter(CMT==4)%>%group_by(TIME)%>%summarise(cmed=median(IPRED),cu975=quantile(IPRED,0.975),cu025=quantile(IPRED,0.025))

#plots for 0.05 mg

ggplot(data=sim0.05%>%filter(CMT==4),aes(TIME/(7*24),IPRED*1000,group=ID))+
geom_line(size=0.5)+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")

#median and 95% CI
ggplot(data=sim0.05sum,aes(TIME/(24*7),cmed*1000))+
geom_line(size=0.5)+
geom_line(data=sim0.05sum,aes(TIME/(24*7),cu975*1000),size=0.5,linetype="dashed")+
geom_line(data=sim0.05sum,aes(TIME/(24*7),cu025*1000),size=0.5,linetype="dashed")+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")

#CD4 suppression at any time post-dose is defined as ≥ 10% of subjects with CD4 counts < 80% of pre-dose values. You need to interpret the table for the criteria of CD4 suppression. Percent column is the percent of subjects with <80% counts of pre-dose values.

    sim0.05%>%
    select(ID,TIME,CMT,IPRED,BASE)%>%
    group_by(TIME)%>%
    filter(CMT==4)%>%
    mutate(suppression=(IPRED/BASE)*100)%>%
    filter(suppression<80)%>%
    summarise(percent=n_distinct(ID))%>%kable
TIME percent
1.5 17
2.0 31
3.0 54
4.0 67
6.0 74
8.0 81
10.0 82
12.0 82
18.0 83
24.0 81
36.0 78
48.0 76
60.0 66
72.0 63
96.0 57
120.0 49
144.0 35
168.0 28
336.0 1

#0.01 mg dose results

sim0.01<-read.table("C:\\Heller\\PHAR7380\\week11\\SDINDOUT4.res",skip=1,header=T)
#sim0.01<-read.table("/work/ac0837/PHAR7380/week11/indirect1.dir1/NM_run1/SDINDOUT1.res",skip=1,header=T)
sim0.01sum<-sim0.01%>%filter(CMT==4)%>%group_by(TIME)%>%summarise(cmed=median(IPRED),cu975=quantile(IPRED,0.975),cu025=quantile(IPRED,0.025))

#plots for 0.01 mg

ggplot(data=sim0.01%>%filter(CMT==4),aes(TIME/(7*24),IPRED*1000,group=ID))+
geom_line(size=0.5)+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")

#median and 95% CI
ggplot(data=sim0.01sum,aes(TIME/(24*7),cmed*1000))+
geom_line(size=0.5)+
geom_line(data=sim0.01sum,aes(TIME/(24*7),cu975*1000),size=0.5,linetype="dashed")+
geom_line(data=sim0.01sum,aes(TIME/(24*7),cu025*1000),size=0.5,linetype="dashed")+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")

#CD4 suppression at any time post-dose is defined as ≥ 10% of subjects with CD4 counts < 80% of pre-dose values. You need to interpret the table for the criteria of CD4 suppression. Percent column is the percent of subjects with <80% counts of pre-dose values.

    sim0.01%>%
    select(ID,TIME,CMT,IPRED,BASE)%>%
    group_by(TIME)%>%
    filter(CMT==4)%>%
    mutate(suppression=(IPRED/BASE)*100)%>%
    filter(suppression<80)%>%
    summarise(percent=n_distinct(ID))%>%kable
TIME percent

#0.03 mg dose results

sim0.03<-read.table("C:\\Heller\\PHAR7380\\week11\\SDINDOUT5.res",skip=1,header=T)
#sim0.03<-read.table("/work/ac0837/PHAR7380/week11/indirect1.dir1/NM_run1/SDINDOUT1.res",skip=1,header=T)
sim0.03sum<-sim0.03%>%filter(CMT==4)%>%group_by(TIME)%>%summarise(cmed=median(IPRED),cu975=quantile(IPRED,0.975),cu025=quantile(IPRED,0.025))

#plots for 0.03 mg

ggplot(data=sim0.03%>%filter(CMT==4),aes(TIME/(7*24),IPRED*1000,group=ID))+
geom_line(size=0.5)+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")

#median and 95% CI
ggplot(data=sim0.03sum,aes(TIME/(24*7),cmed*1000))+
geom_line(size=0.5)+
geom_line(data=sim0.01sum,aes(TIME/(24*7),cu975*1000),size=0.5,linetype="dashed")+
geom_line(data=sim0.01sum,aes(TIME/(24*7),cu025*1000),size=0.5,linetype="dashed")+
scale_x_continuous(limits = c(0,6))+
theme_bw()+
my_theme()+
labs(x="Time after dose (week)",y="CD4 count/mL")

#CD4 suppression at any time post-dose is defined as ≥ 10% of subjects with CD4 counts < 80% of pre-dose values. You need to interpret the table for the criteria of CD4 suppression. Percent column is the percent of subjects with <80% counts of pre-dose values.

    sim0.03%>%
    select(ID,TIME,CMT,IPRED,BASE)%>%
    group_by(TIME)%>%
    filter(CMT==4)%>%
    mutate(suppression=(IPRED/BASE)*100)%>%
    filter(suppression<80)%>%
    summarise(percent=n_distinct(ID))%>%kable
TIME percent
2 10
3 20
4 27
6 40
8 46
10 48
12 47
18 47
24 46
36 40
48 34
60 31
72 28
96 20
120 11
144 8
168 5