---  
title:  "DMP Publication 2024"  
subtitle:  "Dosing and LATIN"  
author:  
  - name: Eric  
    corresponding: true  
    email: echen@ultragenyx.com  
    roles:  
      - Biostatistician  
      - Project administration  
      - Software  
      - Visualization  
    affiliations:  
      - Ultragenyx  
keywords:  
  - XLH  
  - bowing  
  - fracture  
date:  last-modified  
citation:  
  container-title: Analysis  
number-sections:  true  
format:    
    html:  
      self-contained: true  
      code-fold: true  
      code-tools: true  
      coddelink: true  
      comments:  
        hypothesis: true  
      html-math-method: katex  
    pdf: default  
    docx: default  
    jats: default  
    # acs-pdf: default  
    ipynb: default  
format-links:  [ipynb]  
toc:  true  
toc-depth:  5  
---  
 
## Quarto  
 
 Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org> . 
 
## Running Code  
 
```{r, results='asis'}  
#| column: page  
cat ('$$  
\\ small{  
CHG =  \\ beta_0 +  \\ beta_1  \\ times TRT01PN +  \\ beta_2  \\ times AVISITN +  \\ beta_3  \\ times (TRT01PN  \\ times AVISITN) +  \\ beta_4  \\ times STRATAGN +  \\ beta_5  \\ times STRATGLN +  \\ beta_6  \\ times BASE +  \\ epsilon  
}  
$$' ) 
 
cat ('$$  
\\ begin{align*}  
\\ text{CHG Contrast} = & -1  \\ times  \\ beta_{ \\ text{TRT01PN=DTX401}} + 1  \\ times  \\ beta_{ \\ text{TRT01PN=Placebo}} +   
0  \\ times  \\ beta_{ \\ text{TRT01PN=DTX401, AVISITN=Week 36 }} - 1  \\ times  \\ beta_{ \\ text{TRT01PN=DTX401, AVISITN=Week 48}} +  \\\\ &  
+0  \\ times  \\ beta_{ \\ text{TRT01PN=Placebo, AVISITN=Week 36 }} + 1  \\ times  \\ beta_{ \\ text{TRT01PN=Placebo, AVISITN=Week 48}}  
\\ end{align*}  
$$' ) 
   
 
 
 
 
cat ('$$  
\\ begin{align*}  
Improvement = &  \\ beta_0 +  \\ beta_1  \\ times  \\ text{TRTGRPCD} +  \\ beta_2  \\ times  \\ text{SEX} +  \\ beta_3  \\ times  \\ text{AGE} +  \\ beta_4  \\ times  \\ text{age.diag} +  \\ beta_5  \\ times  \\ text{AAGEPHOS} +  \\ beta_6  \\ times  \\ text{AAGEVITD} +  \\ beta_7  \\ times  \\ text{age.first.burmb} +  \\ beta_8  \\ times  \\ text{HEIGHT}  \\\\ &  
+  \\ beta_9  \\ times  \\ text{WEIGHT} +  \\ beta_{10}  \\ times  \\ text{HTZ \\ _MONTH \\ _0 \\ _DMDlnk} +  \\ beta_{11}  \\ times  \\ text{HTZ \\ _diff} +  \\ beta_{12}  \\ times  \\ text{BMI \\ _MONTH \\ _0} +  \\ beta_{13}  \\ times  \\ text{BMI \\ _diff} +  \\ beta_{14}  \\ times  \\ text{RSS \\ _glb \\ _bs \\ _cat} + \\\\ &  \\ beta_{15}  \\ times  \\ text{RSS \\ _kne \\ _bs \\ _cat}   
+  \\ beta_{16}  \\ times  \\ text{phos \\ _AVALZ \\ _MONTH \\ _0 \\ _DMDlnk} +  \\ beta_{17}  \\ times  \\ text{phosZ \\ _diff} +  \\ beta_{18}  \\ times  \\ text{ALPS \\ _MONTH \\ _0 \\ _DMDlnk}  \\\\ & +  \\ beta_{19}  \\ times  \\ text{ALPS \\ _diff} +  \\ beta_{20}  \\ times  \\ text{PTHI \\ _MONTH \\ _0 \\ _DMDlnk} +  \\ beta_{21}  \\ times  \\ text{VD1 \\ _25 \\ _MONTH \\ _0}   
+  \\ beta_{22}  \\ times  \\ text{AverageDose \\ _DMP} + \\\\ &  \\ beta_{23}  \\ times  \\ text{TRTDURW.month} +  \\ beta_{24}  \\ times  \\ text{PHEXBL \\ _BL \\ _dlnk} +  \\ epsilon  
\\ end{align*}  
$$' ) 
```  
 
```{r, results='asis'}  
cat ('$$  
\\ begin{align*}  
\\ text{Normalized difference} = &  \\ beta_0 +  \\ beta_1  \\ times  \\ text{TRTGRPCD} +   \\ beta_2  \\ times  \\ text{age.first.burmb} +  \\ beta_{3}  \\ times  \\ text{HTZ \\ _MONTH \\ _0 \\ _DMDlnk} +  \\ beta_{4}  \\ times  \\ text{HTZ \\ _diff} +  \\ beta_{5}  \\ times  \\ text{PHEXBL \\ _BL \\ _dlnk} +  \\ epsilon  
\\ end{align*}  
$$' ) 
```  
 
```{r}  
library (tern) 
library (nestcolor) 
 
 adsl <-  tern_ex_adsl 
 adlb <-  tern_ex_adlb %>%  dplyr:: filter (ANL01FL ==  "Y" , PARAMCD ==  "ALT" , AVISIT !=  "SCREENING" ) 
 adlb$ AVISIT <-  droplevels (adlb$ AVISIT) 
 adlb <-  dplyr:: mutate (adlb, AVISIT =  forcats:: fct_reorder (AVISIT, AVISITN, min)) 
 
# Mean with CI  
g_lineplot (adlb, adsl, subtitle =  "Laboratory Test:" ) 
 
 
# Mean with CI, no stratification with group_var  
g_lineplot (adlb, variables =  control_lineplot_vars (group_var =  NA ,x =  "AVISIT" , 
   y =  "AVAL" )) 
 
 
# Mean, upper whisker of CI, no group_var(strata) counts N  
g_lineplot ( 
   adlb, 
   whiskers =  "mean_ci_upr" , 
   title =  "Plot of Mean and Upper 95% Confidence Limit by Visit"  
 ) 
 
 
# Median with CI  
g_lineplot ( 
   adlb, 
   adsl, 
   mid =  "median" , 
   interval =  "median_ci" , 
   whiskers =  c ("median_ci_lwr" , "median_ci_upr" ), 
   title =  "Plot of Median and 95% Confidence Limits by Visit"  
 ) 
 
 
# Mean, +/- SD  
g_lineplot (adlb, adsl, 
   interval =  "mean_sdi" , 
   whiskers =  c ("mean_sdi_lwr" , "mean_sdi_upr" ), 
   title =  "Plot of Median +/- SD by Visit"  
 ) 
 
 
# Mean with CI plot with stats table  
g_lineplot (adlb, adsl, table =  c ("n" , "mean" , "mean_ci" )) 
 
 
# Mean with CI, table and customized confidence level  
g_lineplot ( 
   adlb, 
   adsl, 
   table =  c ("n" , "mean" , "mean_ci" ), 
   control =  control_analyze_vars (conf_level =  0.80 ), 
   title =  "Plot of Mean and 80% Confidence Limits by Visit"  
 ) 
 
 
# Mean with CI, table, filtered data  
 adlb_f <-  dplyr:: filter (adlb, ARMCD !=  "ARM A"  |  AVISIT ==  "BASELINE" ) 
g_lineplot (adlb_f, table =  c ("n" , "mean" )) 
 
 
 
```  
 
```{r}  
 adsl<- pharmaverseadam:: adsl 
 admh<- pharmaverseadam:: admh 
 adcm<- pharmaverseadam:: adcm 
 adex<- pharmaverseadam:: adex 
 adae<- pharmaverseadam:: adae 
 adlb<- pharmaverseadam:: adlb 
```  
 
```{r}  
#| warning: false  
#| column: page  
library (dataxray) 
 adsl %>%  make_xray () %>%   view_xray () 
```