\documentclass[10pt]{article} \usepackage{longtable} % allows tables to break \usepackage[pdftex]{lscape} % allows tables to be landscaped %\usepackage[pdftex]{graphicx} \usepackage{pdfpages} \usepackage[letterpaper,margin=1in]{geometry} \usepackage{setspace,relsize} % needed for latex(describe()), \code \usepackage{moreverb} % for verbatimtabinput % \usepackage{tabularx} \usepackage{colortbl} \usepackage{placeins} %\usepackage[dotinlabels]{titletoc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{fancyhdr} \usepackage{graphicx, subfigure} \usepackage{threeparttable} %\usepackage{vmargin} \usepackage{lscape} \usepackage{rotating} \usepackage{endnotes} \usepackage{color} \def\linkcol{blue} \usepackage[pdftex,bookmarks,pagebackref,pdfpagemode=UseOutlines, colorlinks,linkcolor=\linkcol ]{hyperref} %% Setting dummy variable to define what code to execute \def\printid{1} \usepackage{tabularx} % required in the preamble %\setpapersize{USletter} \begin{document} <>= rm(list=ls()) library("MASS") d<-read.csv("original database.csv") # Data cleaning based on email from Jimena on 3 June 2010. My own decisions are labeled (BS) d$EDCOING[d$REGISTRO==2059]<-median(d$EDCOING,na.rm=TRUE) ## child with missing gestational age assigned median (BS) d$INVIRA8[d$REGISTRO==2002]<-0 d$INVIRA1[d$REGISTRO==2001]<-1 d$INVIRA1[d$REGISTRO==2011]<-1 d$INVIRA9[d$REGISTRO==1002]<-0 d$INVIRA4[d$REGISTRO==2043]<-1 d$INVIRA1[d$REGISTRO==1068]<-0 #(BS) d$ETIOL1[d$REGISTRO==2029]<-NA d$IRA2[d$REGISTRO==1037]<-1 #(BS) d$INVIRA2[d$REGISTRO==1037]<-0 #(BS) d$IRA1[d$REGISTRO==1043]<-1 #(BS) d$ETIOL3[d$REGISTRO==2062]<-0 d$ETIOL4[d$REGISTRO==2063]<-0 d$ETIOL3[d$REGISTRO==2066]<-0 d$ETIOL6[d$REGISTRO==2086]<-0 d$ETIOL4[d$REGISTRO==1045]<-0 #(BS) d$ETIOL9[d$REGISTRO==1045]<-0 #(BS) d$ETIOL5[d$REGISTRO==1046]<-0 #(BS) d$ETIOL3[d$REGISTRO==1061]<-0 #(BS) d$ETIOL4[d$REGISTRO==2008]<-0 #(BS) d$ETIOL7[d$REGISTRO==2011]<-0 #(BS) exclude<-ifelse(d$PESONAC>1500,1,0) etiol1<-d$ETIOL1[exclude==0] etiol2<-d$ETIOL2[exclude==0] etiol3<-d$ETIOL3[exclude==0] etiol4<-d$ETIOL4[exclude==0] etiol5<-d$ETIOL5[exclude==0] etiol6<-d$ETIOL6[exclude==0] etiol7<-d$ETIOL7[exclude==0] etiol8<-d$ETIOL8[exclude==0] etiol9<-d$ETIOL9[exclude==0] ira1<-d$IRA1[exclude==0] ira2<-d$IRA2[exclude==0] ira3<-d$IRA3[exclude==0] ira4<-d$IRA4[exclude==0] ira5<-d$IRA5[exclude==0] ira6<-d$IRA6[exclude==0] ira7<-d$IRA7[exclude==0] ira8<-d$IRA8[exclude==0] ira9<-d$IRA9[exclude==0] rhino1<-ifelse(etiol1>=10&ira1==1,1,0) rhino2<-ifelse(etiol2>=10&ira2==1,1,0) rhino3<-ifelse(etiol3>=10&ira3==1,1,0) rhino4<-ifelse(etiol4>=10&ira4==1,1,0) rhino5<-ifelse(etiol5>=10&ira5==1,1,0) rhino6<-ifelse(etiol6>=10&ira6==1,1,0) rhino7<-ifelse(etiol7>=10&ira7==1,1,0) rhino8<-ifelse(etiol8>=10&ira8==1,1,0) rhino9<-ifelse(etiol9>=10&ira9==1,1,0) coinf1<-ifelse(etiol1>10&ira1==1,1,0) coinf2<-ifelse(etiol2>10&ira2==1,1,0) coinf3<-ifelse(etiol3>10&ira3==1,1,0) coinf4<-ifelse(etiol4>10&ira4==1,1,0) coinf5<-ifelse(etiol5>10&ira5==1,1,0) coinf6<-ifelse(etiol6>10&ira6==1,1,0) coinf7<-ifelse(etiol7>10&ira7==1,1,0) coinf8<-ifelse(etiol8>10&ira8==1,1,0) coinf9<-ifelse(etiol9>10&ira9==1,1,0) tot.rhino<-tot.coinf<-0 for (i in 1:length(rhino1)) { tot.rhino[i]<-sum(c(rhino1[i],rhino2[i],rhino3[i],rhino4[i],rhino5[i],rhino6[i],rhino7[i],rhino8[i],rhino9[i]),na.rm=TRUE) tot.coinf[i]<-sum(c(coinf1[i],coinf2[i],coinf3[i],coinf4[i],coinf5[i],coinf6[i],coinf7[i],coinf8[i],coinf9[i]),na.rm=TRUE) } any.rhino<-ifelse(tot.rhino>=1,1,0) tot.rhino.no.coinf<-tot.rhino-tot.coinf any.rhino.no.coinf<-ifelse(tot.rhino.no.coinf>=1,1,0) id<-d$REGISTRO[exclude==0] corrected.age<-d$EDCOING[exclude==0] gest.age<-d$EGEST[exclude==0] weight.bt<-d$PESONAC[exclude==0] maternal.age<-d$EDADMADR[exclude==0] maternal.ed<-d$EDUCMAT[exclude==0] nbi<-d$NBI[exclude==0] ### basic needs unsatisfied smoke<-d$TABACO[exclude==0] asthma<-d$ASMA[exclude==0] ## parents with asthma vent.days<-d$ARMNEO[exclude==0] nicu.days<-d$INTNEO[exclude==0] bpd<-d$DBP[exclude==0] excl.breastfed<-d$LACTEXCL[exclude==0] breastfed<-d$LACTANCI[exclude==0] female<-d$SEXO[exclude==0]-1 sibs<-d$CONVIV[exclude==0] daycare<-d$GUARDERI[exclude==0] ## only one infant was in daycare followup<-12-corrected.age followup[id==1018]<-1 ## this infant died apparently near the first follow-up date. I assigned them 1 month of followup N<-length(female) summary(followup) summary(corrected.age) nicePvalTex<-function(pval){ ifelse(pval<0.001,"<0.001", ifelse(pval<0.06,as.character(round(pval,3)),as.character(round(pval,2)))) } agesum1<-summary(corrected.age[any.rhino==1]) agesum0<-summary(corrected.age[any.rhino==0]) agep<-wilcox.test(corrected.age~any.rhino)$p.value age.tex<-paste(agesum0[3], " (",agesum0[2], ", ", agesum0[5], ")"," & ", agesum1[3], " (",agesum1[2], ", ", agesum1[5], ")"," & ", nicePvalTex(agep),sep="") gagesum1<-summary(gest.age[any.rhino==1]) gagesum0<-summary(gest.age[any.rhino==0]) gagep<-wilcox.test(gest.age~any.rhino)$p.value gage.tex<-paste(gagesum0[3], " (",gagesum0[2], ", ", gagesum0[5], ")"," & ", gagesum1[3], " (",gagesum1[2], ", ", gagesum1[5], ")"," & ", nicePvalTex(gagep),sep="") wtsum1<-summary(weight.bt[any.rhino==1]) wtsum0<-summary(weight.bt[any.rhino==0]) wtp<-wilcox.test(weight.bt~any.rhino)$p.value wt.tex<-paste(wtsum0[3], " (",wtsum0[2], ", ", wtsum0[5], ")"," & ", wtsum1[3], " (",wtsum1[2], ", ", wtsum1[5], ")"," & ", nicePvalTex(wtp),sep="") matagesum1<-summary(maternal.age[any.rhino==1]) matagesum0<-summary(maternal.age[any.rhino==0]) matagep<-wilcox.test(maternal.age~any.rhino)$p.value matage.tex<-paste(matagesum0[3], " (",matagesum0[2], ", ", matagesum0[5], ")"," & ", matagesum1[3], " (",matagesum1[2], ", ", matagesum1[5], ")"," & ", nicePvalTex(matagep),sep="") matedsum1<-summary(maternal.ed[any.rhino==1]) matedsum0<-summary(maternal.ed[any.rhino==0]) matedp<-wilcox.test(maternal.ed~any.rhino)$p.value mated.tex<-paste(matedsum0[3], " (",matedsum0[2], ", ", matedsum0[5], ")"," & ", matedsum1[3], " (",matedsum1[2], ", ", matedsum1[5], ")"," & ", nicePvalTex(matedp),sep="") vdsum1<-summary(vent.days[any.rhino==1]) vdsum0<-summary(vent.days[any.rhino==0]) vdp<-wilcox.test(vent.days~any.rhino)$p.value vd.tex<-paste(vdsum0[3], " (",vdsum0[2], ", ", vdsum0[5], ")"," & ", vdsum1[3], " (",vdsum1[2], ", ", vdsum1[5], ")"," & ", nicePvalTex(vdp),sep="") nicusum1<-summary(nicu.days[any.rhino==1]) nicusum0<-summary(nicu.days[any.rhino==0]) nicup<-wilcox.test(nicu.days~any.rhino)$p.value nicu.tex<-paste(nicusum0[3], " (",nicusum0[2], ", ", nicusum0[5], ")"," & ", nicusum1[3], " (",nicusum1[2], ", ", nicusum1[5], ")"," & ", nicePvalTex(nicup),sep="") sibssum1<-summary(sibs[any.rhino==1]) sibssum0<-summary(sibs[any.rhino==0]) sibsp<-wilcox.test(sibs~any.rhino)$p.value sibs.tex<-paste(sibssum0[3], " (",sibssum0[2], ", ", sibssum0[5], ")"," & ", sibssum1[3], " (",sibssum1[2], ", ", sibssum1[5], ")"," & ", nicePvalTex(sibsp),sep="") nbi.tab<-table(nbi,any.rhino) nbi.prop<-table(nbi,any.rhino)[2,]/apply(table(nbi,any.rhino),2,sum) nbi.p<-chisq.test(table(nbi,any.rhino))$p.value nbi.tex<-paste(nbi.tab[2,1],"/",sum(nbi.tab[,1]), " (", 100*round(nbi.prop[1],2), "\\\\%)", "&", nbi.tab[2,2],"/",sum(nbi.tab[,2]), " (", 100*round(nbi.prop[2],2), "\\\\%)", "&", nicePvalTex(nbi.p),sep="") smoke.tab<-table(smoke,any.rhino) smoke.prop<-table(smoke,any.rhino)[2,]/apply(table(smoke,any.rhino),2,sum) smoke.p<-chisq.test(table(smoke,any.rhino))$p.value smoke.tex<-paste(smoke.tab[2,1],"/",sum(smoke.tab[,1]), " (", 100*round(smoke.prop[1],2), "\\\\%)", "&", smoke.tab[2,2],"/",sum(smoke.tab[,2]), " (", 100*round(smoke.prop[2],2), "\\\\%)", "&", nicePvalTex(smoke.p),sep="") asthma.tab<-table(asthma,any.rhino) asthma.prop<-table(asthma,any.rhino)[2,]/apply(table(asthma,any.rhino),2,sum) asthma.p<-chisq.test(table(asthma,any.rhino))$p.value asthma.tex<-paste(asthma.tab[2,1],"/",sum(asthma.tab[,1]), " (", 100*round(asthma.prop[1],2), "\\\\%)", "&", asthma.tab[2,2],"/",sum(asthma.tab[,2]), " (", 100*round(asthma.prop[2],2), "\\\\%)", "&", nicePvalTex(asthma.p),sep="") bpd.tab<-table(bpd,any.rhino) bpd.prop<-table(bpd,any.rhino)[2,]/apply(table(bpd,any.rhino),2,sum) bpd.p<-chisq.test(table(bpd,any.rhino))$p.value bpd.tex<-paste(bpd.tab[2,1],"/",sum(bpd.tab[,1]), " (", 100*round(bpd.prop[1],2), "\\\\%)", "&", bpd.tab[2,2],"/",sum(bpd.tab[,2]), " (", 100*round(bpd.prop[2],2), "\\\\%)", "&", nicePvalTex(bpd.p),sep="") excl.breastfed.tab<-table(excl.breastfed,any.rhino) excl.breastfed.prop<-table(excl.breastfed,any.rhino)[2,]/apply(table(excl.breastfed,any.rhino),2,sum) excl.breastfed.p<-chisq.test(table(excl.breastfed,any.rhino))$p.value excl.breastfed.tex<-paste(excl.breastfed.tab[2,1],"/",sum(excl.breastfed.tab[,1]), " (", 100*round(excl.breastfed.prop[1],2), "\\\\%)", "&", excl.breastfed.tab[2,2],"/",sum(excl.breastfed.tab[,2]), " (", 100*round(excl.breastfed.prop[2],2), "\\\\%)", "&", nicePvalTex(excl.breastfed.p),sep="") breastfed.tab<-table(breastfed,any.rhino) breastfed.prop<-table(breastfed,any.rhino)[2,]/apply(table(breastfed,any.rhino),2,sum) breastfed.p<-chisq.test(table(breastfed,any.rhino))$p.value breastfed.tex<-paste(breastfed.tab[2,1],"/",sum(breastfed.tab[,1]), " (", 100*round(breastfed.prop[1],2), "\\\\%)", "&", breastfed.tab[2,2],"/",sum(breastfed.tab[,2]), " (", 100*round(breastfed.prop[2],2), "\\\\%)", "&", nicePvalTex(breastfed.p),sep="") female.tab<-table(female,any.rhino) female.prop<-table(female,any.rhino)[2,]/apply(table(female,any.rhino),2,sum) female.p<-chisq.test(table(female,any.rhino))$p.value female.tex<-paste(female.tab[2,1],"/",sum(female.tab[,1]), " (", 100*round(female.prop[1],2), "\\\\%)", "&", female.tab[2,2],"/",sum(female.tab[,2]), " (", 100*round(female.prop[2],2), "\\\\%)", "&", nicePvalTex(female.p),sep="") @ \Sexpr{N} infants were followed from enrollment shortly after birth. Median corrected gestational age at enrollment (interquartile range, IQR) was \Sexpr{round(summary(corrected.age)[3])} months (\Sexpr{round(summary(corrected.age)[2])} -- \Sexpr{round(summary(corrected.age)[5])} months). Infants were followed until a corrected gestational age of 12 months. Total infant-years of follow-up was \Sexpr{round(sum(followup/12,na.rm=TRUE),1)} years. \bigskip \bigskip \begin{threeparttable} \caption{Demographics. Comparing those who had at least one HRV episode to those who had none.} \centering{ \begin{tabular}{llll} \hline \\ & HRV- & HRV+ & p-value\tnote{a} \\ & (n=\Sexpr{table(any.rhino)[1]}) & (n=\Sexpr{table(any.rhino)[2]}) \\ \hline \\ Corrected Gestational Age (wks)\tnote{b} & \Sexpr{age.tex} \\ Gestational Age (wks) & \Sexpr{gage.tex} \\ Weight (g) & \Sexpr{wt.tex} \\ Maternal Age (yrs) & \Sexpr{matage.tex} \\ Maternal Education (yrs) & \Sexpr{mated.tex} \\ Ventilator Days & \Sexpr{vd.tex} \\ NICU Days & \Sexpr{nicu.tex} \\ No. Coinhabitants <10 yrs & \Sexpr{sibs.tex} \\ Basic Needs Unsatisfied & \Sexpr{nbi.tex} \\ Smoking at Home & \Sexpr{smoke.tex} \\ Asthma in Parents & \Sexpr{asthma.tex} \\ BPD & \Sexpr{bpd.tex} \\ Exclusively Breastfed & \Sexpr{excl.breastfed.tex} \\ Breastfed & \Sexpr{breastfed.tex} \\ Female & \Sexpr{female.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on Wilcoxon rank-sum test for continuous variables, Chi-square test for categorical. \item[b] Median (interquartile range) shown for continuous variables. \end{tablenotes} \end{threeparttable} <>= hosp1<-d$INT1[exclude==0] hosp2<-d$INT2[exclude==0] hosp3<-d$INT3[exclude==0] hosp4<-d$INT4[exclude==0] hosp5<-d$INT5[exclude==0] hosp6<-d$INT6[exclude==0] hosp7<-d$INT7[exclude==0] hosp8<-d$INT8[exclude==0] hosp9<-d$INT9[exclude==0] tot.hosp<-tot.rhino.hosp<-tot.coinf.hosp<-0 for (i in 1:length(hosp1)) { tot.hosp[i]<-sum(c(hosp1[i],hosp2[i],hosp3[i],hosp4[i],hosp5[i],hosp6[i],hosp7[i],hosp8[i],hosp9[i]),na.rm=TRUE) tot.rhino.hosp[i]<-sum(c(hosp1[i]*rhino1[i],hosp2[i]*rhino2[i],hosp3[i]*rhino3[i],hosp4[i]*rhino4[i],hosp5[i]*rhino5[i], hosp6[i]*rhino6[i],hosp7[i]*rhino7[i],hosp8[i]*rhino8[i],hosp9[i]*rhino9[i]),na.rm=TRUE) tot.coinf.hosp[i]<-sum(c(hosp1[i]*coinf1[i],hosp2[i]*coinf2[i],hosp3[i]*coinf3[i],hosp4[i]*coinf4[i],hosp5[i]*coinf5[i], hosp6[i]*coinf6[i],hosp7[i]*coinf7[i],hosp8[i]*coinf8[i],hosp9[i]*coinf9[i]),na.rm=TRUE) } any.hosp<-ifelse(tot.hosp>=1,1,0) any.rhino.hosp<-ifelse(tot.rhino.hosp>=1,1,0) tot.rhino.hosp.no.coinf<-tot.rhino.hosp-tot.coinf.hosp any.rhino.hosp.no.coinf<-ifelse(tot.rhino.hosp.no.coinf>=1,1,0) cbind(id[any.rhino.hosp==1],(hosp1*rhino1)[any.rhino.hosp==1],(hosp2*rhino2)[any.rhino.hosp==1], (hosp3*rhino3)[any.rhino.hosp==1],(hosp4*rhino4)[any.rhino.hosp==1],(hosp5*rhino5)[any.rhino.hosp==1], (hosp6*rhino6)[any.rhino.hosp==1],(hosp7*rhino7)[any.rhino.hosp==1],(hosp8*rhino8)[any.rhino.hosp==1], (hosp9*rhino9)[any.rhino.hosp==1]) cbind(id[any.rhino.hosp==1],(rhino1)[any.rhino.hosp==1],(rhino2)[any.rhino.hosp==1], (rhino3)[any.rhino.hosp==1],(rhino4)[any.rhino.hosp==1],(rhino5)[any.rhino.hosp==1], (rhino6)[any.rhino.hosp==1],(rhino7)[any.rhino.hosp==1],(rhino8)[any.rhino.hosp==1], (rhino9)[any.rhino.hosp==1]) agesum1<-summary(corrected.age[any.rhino.hosp==1]) agesum0<-summary(corrected.age[any.rhino.hosp==0]) agep<-wilcox.test(corrected.age~any.rhino.hosp)$p.value age.tex<-paste(agesum0[3], " (",agesum0[2], ", ", agesum0[5], ")"," & ", agesum1[3], " (",agesum1[2], ", ", agesum1[5], ")"," & ", nicePvalTex(agep),sep="") gagesum1<-summary(gest.age[any.rhino.hosp==1]) gagesum0<-summary(gest.age[any.rhino.hosp==0]) gagep<-wilcox.test(gest.age~any.rhino.hosp)$p.value gage.tex<-paste(gagesum0[3], " (",gagesum0[2], ", ", gagesum0[5], ")"," & ", gagesum1[3], " (",gagesum1[2], ", ", gagesum1[5], ")"," & ", nicePvalTex(gagep),sep="") wtsum1<-summary(weight.bt[any.rhino.hosp==1]) wtsum0<-summary(weight.bt[any.rhino.hosp==0]) wtp<-wilcox.test(weight.bt~any.rhino.hosp)$p.value wt.tex<-paste(wtsum0[3], " (",wtsum0[2], ", ", wtsum0[5], ")"," & ", wtsum1[3], " (",wtsum1[2], ", ", wtsum1[5], ")"," & ", nicePvalTex(wtp),sep="") matagesum1<-summary(maternal.age[any.rhino.hosp==1]) matagesum0<-summary(maternal.age[any.rhino.hosp==0]) matagep<-wilcox.test(maternal.age~any.rhino.hosp)$p.value matage.tex<-paste(matagesum0[3], " (",matagesum0[2], ", ", matagesum0[5], ")"," & ", matagesum1[3], " (",matagesum1[2], ", ", matagesum1[5], ")"," & ", nicePvalTex(matagep),sep="") matedsum1<-summary(maternal.ed[any.rhino.hosp==1]) matedsum0<-summary(maternal.ed[any.rhino.hosp==0]) matedp<-wilcox.test(maternal.ed~any.rhino.hosp)$p.value mated.tex<-paste(matedsum0[3], " (",matedsum0[2], ", ", matedsum0[5], ")"," & ", matedsum1[3], " (",matedsum1[2], ", ", matedsum1[5], ")"," & ", nicePvalTex(matedp),sep="") vdsum1<-summary(vent.days[any.rhino.hosp==1]) vdsum0<-summary(vent.days[any.rhino.hosp==0]) vdp<-wilcox.test(vent.days~any.rhino.hosp)$p.value vd.tex<-paste(vdsum0[3], " (",vdsum0[2], ", ", vdsum0[5], ")"," & ", vdsum1[3], " (",vdsum1[2], ", ", vdsum1[5], ")"," & ", nicePvalTex(vdp),sep="") nicusum1<-summary(nicu.days[any.rhino.hosp==1]) nicusum0<-summary(nicu.days[any.rhino.hosp==0]) nicup<-wilcox.test(nicu.days~any.rhino.hosp)$p.value nicu.tex<-paste(nicusum0[3], " (",nicusum0[2], ", ", nicusum0[5], ")"," & ", nicusum1[3], " (",nicusum1[2], ", ", nicusum1[5], ")"," & ", nicePvalTex(nicup),sep="") sibssum1<-summary(sibs[any.rhino.hosp==1]) sibssum0<-summary(sibs[any.rhino.hosp==0]) sibsp<-wilcox.test(sibs~any.rhino.hosp)$p.value sibs.tex<-paste(sibssum0[3], " (",sibssum0[2], ", ", sibssum0[5], ")"," & ", sibssum1[3], " (",sibssum1[2], ", ", sibssum1[5], ")"," & ", nicePvalTex(sibsp),sep="") nbi.tab<-table(nbi,any.rhino.hosp) nbi.prop<-table(nbi,any.rhino.hosp)[2,]/apply(table(nbi,any.rhino.hosp),2,sum) nbi.p<-chisq.test(table(nbi,any.rhino.hosp))$p.value nbi.tex<-paste(nbi.tab[2,1],"/",sum(nbi.tab[,1]), " (", 100*round(nbi.prop[1],2), "\\\\%)", "&", nbi.tab[2,2],"/",sum(nbi.tab[,2]), " (", 100*round(nbi.prop[2],2), "\\\\%)", "&", nicePvalTex(nbi.p),sep="") smoke.tab<-table(smoke,any.rhino.hosp) smoke.prop<-table(smoke,any.rhino.hosp)[2,]/apply(table(smoke,any.rhino.hosp),2,sum) smoke.p<-chisq.test(table(smoke,any.rhino.hosp))$p.value smoke.tex<-paste(smoke.tab[2,1],"/",sum(smoke.tab[,1]), " (", 100*round(smoke.prop[1],2), "\\\\%)", "&", smoke.tab[2,2],"/",sum(smoke.tab[,2]), " (", 100*round(smoke.prop[2],2), "\\\\%)", "&", nicePvalTex(smoke.p),sep="") asthma.tab<-table(asthma,any.rhino.hosp) asthma.prop<-table(asthma,any.rhino.hosp)[2,]/apply(table(asthma,any.rhino.hosp),2,sum) asthma.p<-chisq.test(table(asthma,any.rhino.hosp))$p.value asthma.tex<-paste(asthma.tab[2,1],"/",sum(asthma.tab[,1]), " (", 100*round(asthma.prop[1],2), "\\\\%)", "&", asthma.tab[2,2],"/",sum(asthma.tab[,2]), " (", 100*round(asthma.prop[2],2), "\\\\%)", "&", nicePvalTex(asthma.p),sep="") bpd.tab<-table(bpd,any.rhino.hosp) bpd.prop<-table(bpd,any.rhino.hosp)[2,]/apply(table(bpd,any.rhino.hosp),2,sum) bpd.p<-chisq.test(table(bpd,any.rhino.hosp))$p.value bpd.tex<-paste(bpd.tab[2,1],"/",sum(bpd.tab[,1]), " (", 100*round(bpd.prop[1],2), "\\\\%)", "&", bpd.tab[2,2],"/",sum(bpd.tab[,2]), " (", 100*round(bpd.prop[2],2), "\\\\%)", "&", nicePvalTex(bpd.p),sep="") excl.breastfed.tab<-table(excl.breastfed,any.rhino.hosp) excl.breastfed.prop<-table(excl.breastfed,any.rhino.hosp)[2,]/apply(table(excl.breastfed,any.rhino.hosp),2,sum) excl.breastfed.p<-chisq.test(table(excl.breastfed,any.rhino.hosp))$p.value excl.breastfed.tex<-paste(excl.breastfed.tab[2,1],"/",sum(excl.breastfed.tab[,1]), " (", 100*round(excl.breastfed.prop[1],2), "\\\\%)", "&", excl.breastfed.tab[2,2],"/",sum(excl.breastfed.tab[,2]), " (", 100*round(excl.breastfed.prop[2],2), "\\\\%)", "&", nicePvalTex(excl.breastfed.p),sep="") breastfed.tab<-table(breastfed,any.rhino.hosp) breastfed.prop<-table(breastfed,any.rhino.hosp)[2,]/apply(table(breastfed,any.rhino.hosp),2,sum) breastfed.p<-chisq.test(table(breastfed,any.rhino.hosp))$p.value breastfed.tex<-paste(breastfed.tab[2,1],"/",sum(breastfed.tab[,1]), " (", 100*round(breastfed.prop[1],2), "\\\\%)", "&", breastfed.tab[2,2],"/",sum(breastfed.tab[,2]), " (", 100*round(breastfed.prop[2],2), "\\\\%)", "&", nicePvalTex(breastfed.p),sep="") female.tab<-table(female,any.rhino.hosp) female.prop<-table(female,any.rhino.hosp)[2,]/apply(table(female,any.rhino.hosp),2,sum) female.p<-chisq.test(table(female,any.rhino.hosp))$p.value female.tex<-paste(female.tab[2,1],"/",sum(female.tab[,1]), " (", 100*round(female.prop[1],2), "\\\\%)", "&", female.tab[2,2],"/",sum(female.tab[,2]), " (", 100*round(female.prop[2],2), "\\\\%)", "&", nicePvalTex(female.p),sep="") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Comparing those who had at least one HRV Hospitalization to those who had none.} \centering{ \begin{tabular}{llll} \hline \\ & No HRV Hospitalizations & $\ge 1$ HRV Hospitalization & p-value\tnote{a} \\ & (n=\Sexpr{table(any.rhino.hosp)[1]}) & (n=\Sexpr{table(any.rhino.hosp)[2]}) \\ \hline \\ Corrected Gestational Age (wks)\tnote{b} & \Sexpr{age.tex} \\ Gestational Age (wks) & \Sexpr{gage.tex} \\ Weight (g) & \Sexpr{wt.tex} \\ Maternal Age (yrs) & \Sexpr{matage.tex} \\ Maternal Education (yrs) & \Sexpr{mated.tex} \\ Ventilator Days & \Sexpr{vd.tex} \\ NICU Days & \Sexpr{nicu.tex} \\ No. Coinhabitants <10 yrs & \Sexpr{sibs.tex} \\ Basic Needs Unsatisfied & \Sexpr{nbi.tex} \\ Smoking at Home & \Sexpr{smoke.tex} \\ Asthma in Parents & \Sexpr{asthma.tex} \\ BPD & \Sexpr{bpd.tex} \\ Exclusively Breastfed & \Sexpr{excl.breastfed.tex} \\ Breastfed & \Sexpr{breastfed.tex} \\ Female & \Sexpr{female.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on Wilcoxon rank-sum test for continuous variables, Chi-square test for categorical. \item[b] Median (interquartile range) shown for continuous variables. \end{tablenotes} \end{threeparttable} <>= agesum1<-summary(corrected.age[any.hosp==1]) agesum0<-summary(corrected.age[any.hosp==0]) agep<-wilcox.test(corrected.age~any.hosp)$p.value age.tex<-paste(agesum0[3], " (",agesum0[2], ", ", agesum0[5], ")"," & ", agesum1[3], " (",agesum1[2], ", ", agesum1[5], ")"," & ", nicePvalTex(agep),sep="") gagesum1<-summary(gest.age[any.hosp==1]) gagesum0<-summary(gest.age[any.hosp==0]) gagep<-wilcox.test(gest.age~any.hosp)$p.value gage.tex<-paste(gagesum0[3], " (",gagesum0[2], ", ", gagesum0[5], ")"," & ", gagesum1[3], " (",gagesum1[2], ", ", gagesum1[5], ")"," & ", nicePvalTex(gagep),sep="") wtsum1<-summary(weight.bt[any.hosp==1]) wtsum0<-summary(weight.bt[any.hosp==0]) wtp<-wilcox.test(weight.bt~any.hosp)$p.value wt.tex<-paste(wtsum0[3], " (",wtsum0[2], ", ", wtsum0[5], ")"," & ", wtsum1[3], " (",wtsum1[2], ", ", wtsum1[5], ")"," & ", nicePvalTex(wtp),sep="") matagesum1<-summary(maternal.age[any.hosp==1]) matagesum0<-summary(maternal.age[any.hosp==0]) matagep<-wilcox.test(maternal.age~any.hosp)$p.value matage.tex<-paste(matagesum0[3], " (",matagesum0[2], ", ", matagesum0[5], ")"," & ", matagesum1[3], " (",matagesum1[2], ", ", matagesum1[5], ")"," & ", nicePvalTex(matagep),sep="") matedsum1<-summary(maternal.ed[any.hosp==1]) matedsum0<-summary(maternal.ed[any.hosp==0]) matedp<-wilcox.test(maternal.ed~any.hosp)$p.value mated.tex<-paste(matedsum0[3], " (",matedsum0[2], ", ", matedsum0[5], ")"," & ", matedsum1[3], " (",matedsum1[2], ", ", matedsum1[5], ")"," & ", nicePvalTex(matedp),sep="") vdsum1<-summary(vent.days[any.hosp==1]) vdsum0<-summary(vent.days[any.hosp==0]) vdp<-wilcox.test(vent.days~any.hosp)$p.value vd.tex<-paste(vdsum0[3], " (",vdsum0[2], ", ", vdsum0[5], ")"," & ", vdsum1[3], " (",vdsum1[2], ", ", vdsum1[5], ")"," & ", nicePvalTex(vdp),sep="") nicusum1<-summary(nicu.days[any.hosp==1]) nicusum0<-summary(nicu.days[any.hosp==0]) nicup<-wilcox.test(nicu.days~any.hosp)$p.value nicu.tex<-paste(nicusum0[3], " (",nicusum0[2], ", ", nicusum0[5], ")"," & ", nicusum1[3], " (",nicusum1[2], ", ", nicusum1[5], ")"," & ", nicePvalTex(nicup),sep="") sibssum1<-summary(sibs[any.hosp==1]) sibssum0<-summary(sibs[any.hosp==0]) sibsp<-wilcox.test(sibs~any.hosp)$p.value sibs.tex<-paste(sibssum0[3], " (",sibssum0[2], ", ", sibssum0[5], ")"," & ", sibssum1[3], " (",sibssum1[2], ", ", sibssum1[5], ")"," & ", nicePvalTex(sibsp),sep="") nbi.tab<-table(nbi,any.hosp) nbi.prop<-table(nbi,any.hosp)[2,]/apply(table(nbi,any.hosp),2,sum) nbi.p<-chisq.test(table(nbi,any.hosp))$p.value nbi.tex<-paste(nbi.tab[2,1],"/",sum(nbi.tab[,1]), " (", 100*round(nbi.prop[1],2), "\\\\%)", "&", nbi.tab[2,2],"/",sum(nbi.tab[,2]), " (", 100*round(nbi.prop[2],2), "\\\\%)", "&", nicePvalTex(nbi.p),sep="") smoke.tab<-table(smoke,any.hosp) smoke.prop<-table(smoke,any.hosp)[2,]/apply(table(smoke,any.hosp),2,sum) smoke.p<-chisq.test(table(smoke,any.hosp))$p.value smoke.tex<-paste(smoke.tab[2,1],"/",sum(smoke.tab[,1]), " (", 100*round(smoke.prop[1],2), "\\\\%)", "&", smoke.tab[2,2],"/",sum(smoke.tab[,2]), " (", 100*round(smoke.prop[2],2), "\\\\%)", "&", nicePvalTex(smoke.p),sep="") asthma.tab<-table(asthma,any.hosp) asthma.prop<-table(asthma,any.hosp)[2,]/apply(table(asthma,any.hosp),2,sum) asthma.p<-chisq.test(table(asthma,any.hosp))$p.value asthma.tex<-paste(asthma.tab[2,1],"/",sum(asthma.tab[,1]), " (", 100*round(asthma.prop[1],2), "\\\\%)", "&", asthma.tab[2,2],"/",sum(asthma.tab[,2]), " (", 100*round(asthma.prop[2],2), "\\\\%)", "&", nicePvalTex(asthma.p),sep="") bpd.tab<-table(bpd,any.hosp) bpd.prop<-table(bpd,any.hosp)[2,]/apply(table(bpd,any.hosp),2,sum) bpd.p<-chisq.test(table(bpd,any.hosp))$p.value bpd.tex<-paste(bpd.tab[2,1],"/",sum(bpd.tab[,1]), " (", 100*round(bpd.prop[1],2), "\\\\%)", "&", bpd.tab[2,2],"/",sum(bpd.tab[,2]), " (", 100*round(bpd.prop[2],2), "\\\\%)", "&", nicePvalTex(bpd.p),sep="") excl.breastfed.tab<-table(excl.breastfed,any.hosp) excl.breastfed.prop<-table(excl.breastfed,any.hosp)[2,]/apply(table(excl.breastfed,any.hosp),2,sum) excl.breastfed.p<-chisq.test(table(excl.breastfed,any.hosp))$p.value excl.breastfed.tex<-paste(excl.breastfed.tab[2,1],"/",sum(excl.breastfed.tab[,1]), " (", 100*round(excl.breastfed.prop[1],2), "\\\\%)", "&", excl.breastfed.tab[2,2],"/",sum(excl.breastfed.tab[,2]), " (", 100*round(excl.breastfed.prop[2],2), "\\\\%)", "&", nicePvalTex(excl.breastfed.p),sep="") breastfed.tab<-table(breastfed,any.hosp) breastfed.prop<-table(breastfed,any.hosp)[2,]/apply(table(breastfed,any.hosp),2,sum) breastfed.p<-chisq.test(table(breastfed,any.hosp))$p.value breastfed.tex<-paste(breastfed.tab[2,1],"/",sum(breastfed.tab[,1]), " (", 100*round(breastfed.prop[1],2), "\\\\%)", "&", breastfed.tab[2,2],"/",sum(breastfed.tab[,2]), " (", 100*round(breastfed.prop[2],2), "\\\\%)", "&", nicePvalTex(breastfed.p),sep="") female.tab<-table(female,any.hosp) female.prop<-table(female,any.hosp)[2,]/apply(table(female,any.hosp),2,sum) female.p<-chisq.test(table(female,any.hosp))$p.value female.tex<-paste(female.tab[2,1],"/",sum(female.tab[,1]), " (", 100*round(female.prop[1],2), "\\\\%)", "&", female.tab[2,2],"/",sum(female.tab[,2]), " (", 100*round(female.prop[2],2), "\\\\%)", "&", nicePvalTex(female.p),sep="") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Comparing those who had at least one Hospitalization to those who had none.} \centering{ \begin{tabular}{llll} \hline \\ & No Hospitalizations & $\ge$ 1 Hospitalization & p-value\tnote{a} \\ & (n=\Sexpr{table(any.hosp)[1]}) & (n=\Sexpr{table(any.hosp)[2]}) \\ \hline \\ Corrected Gestational Age (wks)\tnote{b} & \Sexpr{age.tex} \\ Gestational Age (wks) & \Sexpr{gage.tex} \\ Weight (g) & \Sexpr{wt.tex} \\ Maternal Age (yrs) & \Sexpr{matage.tex} \\ Maternal Education (yrs) & \Sexpr{mated.tex} \\ Ventilator Days & \Sexpr{vd.tex} \\ NICU Days & \Sexpr{nicu.tex} \\ No. Coinhabitants <10 yrs & \Sexpr{sibs.tex} \\ Basic Needs Unsatisfied & \Sexpr{nbi.tex} \\ Smoking at Home & \Sexpr{smoke.tex} \\ Asthma in Parents & \Sexpr{asthma.tex} \\ BPD & \Sexpr{bpd.tex} \\ Exclusively Breastfed & \Sexpr{excl.breastfed.tex} \\ Breastfed & \Sexpr{breastfed.tex} \\ Female & \Sexpr{female.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on Wilcoxon rank-sum test for continuous variables, Chi-square test for categorical. \item[b] Median (interquartile range) shown for continuous variables. \end{tablenotes} \end{threeparttable} <>= agesum1<-summary(corrected.age[any.rhino.hosp==1&any.rhino==1]) agesum0<-summary(corrected.age[any.rhino.hosp==0&any.rhino==1]) agep<-wilcox.test(corrected.age[any.rhino==1]~any.rhino.hosp[any.rhino==1])$p.value age.tex<-paste(agesum0[3], " (",agesum0[2], ", ", agesum0[5], ")"," & ", agesum1[3], " (",agesum1[2], ", ", agesum1[5], ")"," & ", nicePvalTex(agep),sep="") gagesum1<-summary(gest.age[any.rhino.hosp==1&any.rhino==1]) gagesum0<-summary(gest.age[any.rhino.hosp==0&any.rhino==1]) gagep<-wilcox.test(gest.age[any.rhino==1]~any.rhino.hosp[any.rhino==1])$p.value gage.tex<-paste(gagesum0[3], " (",gagesum0[2], ", ", gagesum0[5], ")"," & ", gagesum1[3], " (",gagesum1[2], ", ", gagesum1[5], ")"," & ", nicePvalTex(gagep),sep="") wtsum1<-summary(weight.bt[any.rhino.hosp==1&any.rhino==1]) wtsum0<-summary(weight.bt[any.rhino.hosp==0&any.rhino==1]) wtp<-wilcox.test(weight.bt[any.rhino==1]~any.rhino.hosp[any.rhino==1])$p.value wt.tex<-paste(wtsum0[3], " (",wtsum0[2], ", ", wtsum0[5], ")"," & ", wtsum1[3], " (",wtsum1[2], ", ", wtsum1[5], ")"," & ", nicePvalTex(wtp),sep="") matagesum1<-summary(maternal.age[any.rhino.hosp==1&any.rhino==1]) matagesum0<-summary(maternal.age[any.rhino.hosp==0&any.rhino==1]) matagep<-wilcox.test(maternal.age[any.rhino==1]~any.rhino.hosp[any.rhino==1])$p.value matage.tex<-paste(matagesum0[3], " (",matagesum0[2], ", ", matagesum0[5], ")"," & ", matagesum1[3], " (",matagesum1[2], ", ", matagesum1[5], ")"," & ", nicePvalTex(matagep),sep="") matedsum1<-summary(maternal.ed[any.rhino.hosp==1&any.rhino==1]) matedsum0<-summary(maternal.ed[any.rhino.hosp==0&any.rhino==1]) matedp<-wilcox.test(maternal.ed[any.rhino==1]~any.rhino.hosp[any.rhino==1])$p.value mated.tex<-paste(matedsum0[3], " (",matedsum0[2], ", ", matedsum0[5], ")"," & ", matedsum1[3], " (",matedsum1[2], ", ", matedsum1[5], ")"," & ", nicePvalTex(matedp),sep="") vdsum1<-summary(vent.days[any.rhino.hosp==1&any.rhino==1]) vdsum0<-summary(vent.days[any.rhino.hosp==0&any.rhino==1]) vdp<-wilcox.test(vent.days[any.rhino==1]~any.rhino.hosp[any.rhino==1])$p.value vd.tex<-paste(vdsum0[3], " (",vdsum0[2], ", ", vdsum0[5], ")"," & ", vdsum1[3], " (",vdsum1[2], ", ", vdsum1[5], ")"," & ", nicePvalTex(vdp),sep="") nicusum1<-summary(nicu.days[any.rhino.hosp==1&any.rhino==1]) nicusum0<-summary(nicu.days[any.rhino.hosp==0&any.rhino==1]) nicup<-wilcox.test(nicu.days[any.rhino==1]~any.rhino.hosp[any.rhino==1])$p.value nicu.tex<-paste(nicusum0[3], " (",nicusum0[2], ", ", nicusum0[5], ")"," & ", nicusum1[3], " (",nicusum1[2], ", ", nicusum1[5], ")"," & ", nicePvalTex(nicup),sep="") sibssum1<-summary(sibs[any.rhino.hosp==1&any.rhino==1]) sibssum0<-summary(sibs[any.rhino.hosp==0&any.rhino==1]) sibsp<-wilcox.test(sibs[any.rhino==1]~any.rhino.hosp[any.rhino==1])$p.value sibs.tex<-paste(sibssum0[3], " (",sibssum0[2], ", ", sibssum0[5], ")"," & ", sibssum1[3], " (",sibssum1[2], ", ", sibssum1[5], ")"," & ", nicePvalTex(sibsp),sep="") nbi.tab<-table(nbi[any.rhino==1],any.rhino.hosp[any.rhino==1]) nbi.prop<-table(nbi[any.rhino==1],any.rhino.hosp[any.rhino==1])[2,]/apply(table(nbi[any.rhino==1],any.rhino.hosp[any.rhino==1]),2,sum) nbi.p<-chisq.test(table(nbi[any.rhino==1],any.rhino.hosp[any.rhino==1]))$p.value nbi.tex<-paste(nbi.tab[2,1],"/",sum(nbi.tab[,1]), " (", 100*round(nbi.prop[1],2), "\\\\%)", "&", nbi.tab[2,2],"/",sum(nbi.tab[,2]), " (", 100*round(nbi.prop[2],2), "\\\\%)", "&", nicePvalTex(nbi.p),sep="") smoke.tab<-table(smoke[any.rhino==1],any.rhino.hosp[any.rhino==1]) smoke.prop<-table(smoke[any.rhino==1],any.rhino.hosp[any.rhino==1])[2,]/apply(table(smoke[any.rhino==1],any.rhino.hosp[any.rhino==1]),2,sum) smoke.p<-chisq.test(table(smoke[any.rhino==1],any.rhino.hosp[any.rhino==1]))$p.value smoke.tex<-paste(smoke.tab[2,1],"/",sum(smoke.tab[,1]), " (", 100*round(smoke.prop[1],2), "\\\\%)", "&", smoke.tab[2,2],"/",sum(smoke.tab[,2]), " (", 100*round(smoke.prop[2],2), "\\\\%)", "&", nicePvalTex(smoke.p),sep="") asthma.tab<-table(asthma[any.rhino==1],any.rhino.hosp[any.rhino==1]) asthma.prop<-table(asthma[any.rhino==1],any.rhino.hosp[any.rhino==1])[2,]/apply(table(asthma[any.rhino==1],any.rhino.hosp[any.rhino==1]),2,sum) asthma.p<-chisq.test(table(asthma[any.rhino==1],any.rhino.hosp[any.rhino==1]))$p.value asthma.tex<-paste(asthma.tab[2,1],"/",sum(asthma.tab[,1]), " (", 100*round(asthma.prop[1],2), "\\\\%)", "&", asthma.tab[2,2],"/",sum(asthma.tab[,2]), " (", 100*round(asthma.prop[2],2), "\\\\%)", "&", nicePvalTex(asthma.p),sep="") bpd.tab<-table(bpd[any.rhino==1],any.rhino.hosp[any.rhino==1]) bpd.prop<-table(bpd[any.rhino==1],any.rhino.hosp[any.rhino==1])[2,]/apply(table(bpd[any.rhino==1],any.rhino.hosp[any.rhino==1]),2,sum) bpd.p<-chisq.test(table(bpd[any.rhino==1],any.rhino.hosp[any.rhino==1]))$p.value bpd.tex<-paste(bpd.tab[2,1],"/",sum(bpd.tab[,1]), " (", 100*round(bpd.prop[1],2), "\\\\%)", "&", bpd.tab[2,2],"/",sum(bpd.tab[,2]), " (", 100*round(bpd.prop[2],2), "\\\\%)", "&", nicePvalTex(bpd.p),sep="") excl.breastfed.tab<-table(excl.breastfed[any.rhino==1],any.rhino.hosp[any.rhino==1]) excl.breastfed.prop<-table(excl.breastfed[any.rhino==1],any.rhino.hosp[any.rhino==1])[2,]/apply(table(excl.breastfed[any.rhino==1],any.rhino.hosp[any.rhino==1]),2,sum) excl.breastfed.p<-chisq.test(table(excl.breastfed[any.rhino==1],any.rhino.hosp[any.rhino==1]))$p.value excl.breastfed.tex<-paste(excl.breastfed.tab[2,1],"/",sum(excl.breastfed.tab[,1]), " (", 100*round(excl.breastfed.prop[1],2), "\\\\%)", "&", excl.breastfed.tab[2,2],"/",sum(excl.breastfed.tab[,2]), " (", 100*round(excl.breastfed.prop[2],2), "\\\\%)", "&", nicePvalTex(excl.breastfed.p),sep="") breastfed.tab<-table(breastfed[any.rhino==1],any.rhino.hosp[any.rhino==1]) breastfed.prop<-table(breastfed[any.rhino==1],any.rhino.hosp[any.rhino==1])[2,]/ apply(table(breastfed[any.rhino==1],any.rhino.hosp[any.rhino==1]),2,sum) breastfed.p<-chisq.test(table(breastfed[any.rhino==1],any.rhino.hosp[any.rhino==1]))$p.value breastfed.tex<-paste(breastfed.tab[2,1],"/",sum(breastfed.tab[,1]), " (", 100*round(breastfed.prop[1],2), "\\\\%)", "&", breastfed.tab[2,2],"/",sum(breastfed.tab[,2]), " (", 100*round(breastfed.prop[2],2), "\\\\%)", "&", nicePvalTex(breastfed.p),sep="") female.tab<-table(female[any.rhino==1],any.rhino.hosp[any.rhino==1]) female.prop<-table(female[any.rhino==1],any.rhino.hosp[any.rhino==1])[2,]/apply(table(female[any.rhino==1],any.rhino.hosp[any.rhino==1]),2,sum) female.p<-chisq.test(table(female[any.rhino==1],any.rhino.hosp[any.rhino==1]))$p.value female.tex<-paste(female.tab[2,1],"/",sum(female.tab[,1]), " (", 100*round(female.prop[1],2), "\\\\%)", "&", female.tab[2,2],"/",sum(female.tab[,2]), " (", 100*round(female.prop[2],2), "\\\\%)", "&", nicePvalTex(female.p),sep="") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Comparing those with at least one HRV Hospitalization to those who had at least one HRV Episode but were not Hospitalized.} \centering{ \begin{tabular}{llll} \hline \\ & No HRV Hospitalizations & $\ge 1$ HRV Hospitalization & p-value\tnote{a} \\ & (n=\Sexpr{table(any.rhino.hosp[any.rhino==1])[1]}) & (n=\Sexpr{table(any.rhino.hosp[any.rhino==1])[2]}) \\ \hline \\ Corrected Gestational Age (wks)\tnote{b} & \Sexpr{age.tex} \\ Gestational Age (wks) & \Sexpr{gage.tex} \\ Weight (g) & \Sexpr{wt.tex} \\ Maternal Age (yrs) & \Sexpr{matage.tex} \\ Maternal Education (yrs) & \Sexpr{mated.tex} \\ Ventilator Days & \Sexpr{vd.tex} \\ NICU Days & \Sexpr{nicu.tex} \\ No. Coinhabitants <10 yrs & \Sexpr{sibs.tex} \\ Basic Needs Unsatisfied & \Sexpr{nbi.tex} \\ Smoking at Home & \Sexpr{smoke.tex} \\ Asthma in Parents & \Sexpr{asthma.tex} \\ BPD & \Sexpr{bpd.tex} \\ Exclusively Breastfed & \Sexpr{excl.breastfed.tex} \\ Breastfed & \Sexpr{breastfed.tex} \\ Female & \Sexpr{female.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on Wilcoxon rank-sum test for continuous variables, Chi-square test for categorical. \item[b] Median (interquartile range) shown for continuous variables. \end{tablenotes} \end{threeparttable} <>= mod.hrv1<-glm(any.rhino~weight.bt+bpd+breastfed+asthma+smoke+maternal.age,family="binomial") wt.tex<-paste(round(exp(mod.hrv1$coeff[2]*100),2), " & (", round(exp((mod.hrv1$coeff[2]-1.96*summary(mod.hrv1)$coeff[2,2])*100),2),", ", round(exp((mod.hrv1$coeff[2]+1.96*summary(mod.hrv1)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.hrv1)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.hrv1$coeff[3]),2), " & (", round(exp((mod.hrv1$coeff[3]-1.96*summary(mod.hrv1)$coeff[3,2])),2),", ", round(exp((mod.hrv1$coeff[3]+1.96*summary(mod.hrv1)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.hrv1)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.hrv1$coeff[4]),2), " & (", round(exp((mod.hrv1$coeff[4]-1.96*summary(mod.hrv1)$coeff[4,2])),2),", ", round(exp((mod.hrv1$coeff[4]+1.96*summary(mod.hrv1)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.hrv1)$coeff[4,4]),sep="") asthma.tex<-paste(round(exp(mod.hrv1$coeff[5]),2), " & (", round(exp((mod.hrv1$coeff[5]-1.96*summary(mod.hrv1)$coeff[5,2])),2),", ", round(exp((mod.hrv1$coeff[5]+1.96*summary(mod.hrv1)$coeff[5,2])),2),") &", nicePvalTex(summary(mod.hrv1)$coeff[5,4]),sep="") smoke.tex<-paste(round(exp(mod.hrv1$coeff[6]),2), " & (", round(exp((mod.hrv1$coeff[6]-1.96*summary(mod.hrv1)$coeff[6,2])),2),", ", round(exp((mod.hrv1$coeff[6]+1.96*summary(mod.hrv1)$coeff[6,2])),2),") &", nicePvalTex(summary(mod.hrv1)$coeff[6,4]),sep="") matage.tex<-paste(round(exp(mod.hrv1$coeff[7]),2), " & (", round(exp((mod.hrv1$coeff[7]-1.96*summary(mod.hrv1)$coeff[7,2])),2),", ", round(exp((mod.hrv1$coeff[7]+1.96*summary(mod.hrv1)$coeff[7,2])),2),") &", nicePvalTex(summary(mod.hrv1)$coeff[7,4]),sep="") mod.hrv1.int<-glm(any.rhino~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+female+female*breastfed,family="binomial") mod.hrv1.int2<-glm(any.rhino~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+female,family="binomial") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted odds ratios for any HRV.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & OR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ Asthma in Parents & \Sexpr{asthma.tex} \\ Smoking at home & \Sexpr{smoke.tex} \\ Maternal age & \Sexpr{matage.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable logistic regression model. \end{tablenotes} \end{threeparttable} In secondary analyses, sex was not associated with HRV (p=\Sexpr{nicePvalTex(summary(mod.hrv1.int2)$coeff[8,4])}) nor was there an interaction between sex and breastfeeding (p= \Sexpr{nicePvalTex(summary(mod.hrv1.int)$coeff[9,4])}). <>= mod.hrv.inc<-glm.nb(tot.rhino~1+offset(log(followup))) #mod.hrv.inc<-glm.nb(tot.rhino~1) round(exp(mod.hrv.inc$coeff[1])*100*12) ## converting to per 100 infant-years of follow-up round(exp(mod.hrv.inc$coeff[1]-1.96*summary(mod.hrv.inc)$coeff[1,2])*100*12) round(exp(mod.hrv.inc$coeff[1]+1.96*summary(mod.hrv.inc)$coeff[1,2])*100*12) mod.hrv3<-glm(tot.rhino~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+offset(log(followup)),family="poisson") mod.hrv3a<-glm(tot.rhino~weight.bt+bpd+breastfed+asthma+smoke+maternal.age,offset=log(followup),family="poisson") library(MASS) mod.hrv2<-glm.nb(tot.rhino~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+offset(log(followup))) ### NB results are probably better because of overdispersion comparable. mod.hrv2.bpd<-glm.nb(tot.rhino~bpd+offset(log(followup))) summary(mod.hrv2.bpd) summary(mod.hrv2) wt.tex<-paste(round(exp(mod.hrv2$coeff[2]*100),2), " & (", round(exp((mod.hrv2$coeff[2]-1.96*summary(mod.hrv2)$coeff[2,2])*100),2),", ", round(exp((mod.hrv2$coeff[2]+1.96*summary(mod.hrv2)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.hrv2)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.hrv2$coeff[3]),2), " & (", round(exp((mod.hrv2$coeff[3]-1.96*summary(mod.hrv2)$coeff[3,2])),2),", ", round(exp((mod.hrv2$coeff[3]+1.96*summary(mod.hrv2)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.hrv2)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.hrv2$coeff[4]),2), " & (", round(exp((mod.hrv2$coeff[4]-1.96*summary(mod.hrv2)$coeff[4,2])),2),", ", round(exp((mod.hrv2$coeff[4]+1.96*summary(mod.hrv2)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.hrv2)$coeff[4,4]),sep="") asthma.tex<-paste(round(exp(mod.hrv2$coeff[5]),2), " & (", round(exp((mod.hrv2$coeff[5]-1.96*summary(mod.hrv2)$coeff[5,2])),2),", ", round(exp((mod.hrv2$coeff[5]+1.96*summary(mod.hrv2)$coeff[5,2])),2),") &", nicePvalTex(summary(mod.hrv2)$coeff[5,4]),sep="") smoke.tex<-paste(round(exp(mod.hrv2$coeff[6]),2), " & (", round(exp((mod.hrv2$coeff[6]-1.96*summary(mod.hrv2)$coeff[6,2])),2),", ", round(exp((mod.hrv2$coeff[6]+1.96*summary(mod.hrv2)$coeff[6,2])),2),") &", nicePvalTex(summary(mod.hrv2)$coeff[6,4]),sep="") matage.tex<-paste(round(exp(mod.hrv2$coeff[7]),2), " & (", round(exp((mod.hrv2$coeff[7]-1.96*summary(mod.hrv2)$coeff[7,2])),2),", ", round(exp((mod.hrv2$coeff[7]+1.96*summary(mod.hrv2)$coeff[7,2])),2),") &", nicePvalTex(summary(mod.hrv2)$coeff[7,4]),sep="") mod.hrv2.int<-glm.nb(tot.rhino~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+female*breastfed+offset(log(followup))) mod.hrv2.int2<-glm.nb(tot.rhino~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+female+offset(log(followup))) @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted relative risks for HRV-associated episode.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & RR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ Asthma in Parents & \Sexpr{asthma.tex} \\ Smoking at home & \Sexpr{smoke.tex} \\ Maternal age & \Sexpr{matage.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable negative binomial regression model using number of HRV-associated episodes. \end{tablenotes} \end{threeparttable} In secondary analyses, sex was not associated with HRV (p=\Sexpr{nicePvalTex(summary(mod.hrv2.int2)$coeff[8,4])}) nor was there an interaction between sex and breastfeeding (p= \Sexpr{nicePvalTex(summary(mod.hrv2.int)$coeff[9,4])}). \bigskip Incidence of HRV episode was \Sexpr{round(exp(mod.hrv.inc$coeff[1])*100*12)} per 100 infant-years of follow-up (95\% CI = \Sexpr{round(exp(mod.hrv.inc$coeff[1]-1.96*summary(mod.hrv.inc)$coeff[1,2])*100*12)} - \Sexpr{round(exp(mod.hrv.inc$coeff[1]+1.96*summary(mod.hrv.inc)$coeff[1,2])*100*12)}). <>= mod.rhino1<-glm(any.rhino.hosp~weight.bt+bpd+breastfed,family="binomial") wt.tex<-paste(round(exp(mod.rhino1$coeff[2]*100),2), " & (", round(exp((mod.rhino1$coeff[2]-1.96*summary(mod.rhino1)$coeff[2,2])*100),2),", ", round(exp((mod.rhino1$coeff[2]+1.96*summary(mod.rhino1)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.rhino1)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.rhino1$coeff[3]),2), " & (", round(exp((mod.rhino1$coeff[3]-1.96*summary(mod.rhino1)$coeff[3,2])),2),", ", round(exp((mod.rhino1$coeff[3]+1.96*summary(mod.rhino1)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.rhino1)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.rhino1$coeff[4]),2), " & (", round(exp((mod.rhino1$coeff[4]-1.96*summary(mod.rhino1)$coeff[4,2])),2),", ", round(exp((mod.rhino1$coeff[4]+1.96*summary(mod.rhino1)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.rhino1)$coeff[4,4]),sep="") mod.rhino1.int<-glm(any.rhino.hosp~weight.bt+bpd+breastfed+female*breastfed,family="binomial") mod.rhino1.int2<-glm(any.rhino.hosp~weight.bt+bpd+breastfed+female,family="binomial") mod.rhino1.asthma<-glm(any.rhino.hosp~weight.bt+bpd+breastfed+asthma,family="binomial") mod.rhino1.matage<-glm(any.rhino.hosp~weight.bt+bpd+breastfed+maternal.age,family="binomial") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted odds ratios for any HRV-associated hospitalization.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & OR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable logistic regression model. \end{tablenotes} \end{threeparttable} In secondary analyses, sex, maternal age, and parental asthma were not associated with HRV hospitalization (p=\Sexpr{nicePvalTex(summary(mod.rhino1.int2)$coeff[5,4])}, \Sexpr{nicePvalTex(summary(mod.rhino1.matage)$coeff[5,4])}, and \Sexpr{nicePvalTex(summary(mod.rhino1.asthma)$coeff[5,4])}, respectively), and there was little evidence of an interaction between sex and breastfeeding (p= \Sexpr{nicePvalTex(summary(mod.rhino1.int)$coeff[6,4])}). <>= mod.hrvhosp.inc<-glm.nb(tot.rhino.hosp~1+offset(log(followup))) round(exp(mod.hrvhosp.inc$coeff[1])*100*12) round(exp(mod.hrvhosp.inc$coeff[1]-1.96*summary(mod.hrvhosp.inc)$coeff[1,2])*100*12) round(exp(mod.hrvhosp.inc$coeff[1]+1.96*summary(mod.hrvhosp.inc)$coeff[1,2])*100*12) mod.rhino2<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed+offset(log(followup)),family="poisson") library(MASS) # mod.rhino3<-glm.nb(tot.rhino.hosp~weight.bt+bpd+breastfed) ### Poisson regression is fine because dispersion parameter is almost exactly 1. Poisson and NB results are comparable. wt.tex<-paste(round(exp(mod.rhino2$coeff[2]*100),2), " & (", round(exp((mod.rhino2$coeff[2]-1.96*summary(mod.rhino2)$coeff[2,2])*100),2),", ", round(exp((mod.rhino2$coeff[2]+1.96*summary(mod.rhino2)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.rhino2)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.rhino2$coeff[3]),2), " & (", round(exp((mod.rhino2$coeff[3]-1.96*summary(mod.rhino2)$coeff[3,2])),2),", ", round(exp((mod.rhino2$coeff[3]+1.96*summary(mod.rhino2)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.rhino2)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.rhino2$coeff[4]),2), " & (", round(exp((mod.rhino2$coeff[4]-1.96*summary(mod.rhino2)$coeff[4,2])),2),", ", round(exp((mod.rhino2$coeff[4]+1.96*summary(mod.rhino2)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.rhino2)$coeff[4,4]),sep="") mod.rhino2.int<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed+female+female*breastfed+offset(log(followup)),family="poisson") mod.rhino2.int2<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed+female+offset(log(followup)),family="poisson") mod.rhino2.asthma<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed+asthma+offset(log(followup)),family="poisson") mod.rhino2.matage<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed+maternal.age+offset(log(followup)),family="poisson") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted relative risks for HRV-associated hospitalizations.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & RR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable poisson regression model using number of hospitalizations (no evidence of overdispersion). \end{tablenotes} \end{threeparttable} In secondary analyses, sex, maternal age, and parental asthma were not associated with number of HRV hospitalizations (p=\Sexpr{nicePvalTex(summary(mod.rhino2.int2)$coeff[5,4])}, \Sexpr{nicePvalTex(summary(mod.rhino2.matage)$coeff[5,4])}, and \Sexpr{nicePvalTex(summary(mod.rhino2.asthma)$coeff[5,4])}, respectively), and there was little evidence of an interaction between sex and breastfeeding (p= \Sexpr{nicePvalTex(summary(mod.rhino2.int)$coeff[6,4])}). \bigskip Incidence of HRV-associated hospitalization was \Sexpr{round(exp(mod.hrvhosp.inc$coeff[1])*100*12)} per 100 infant-years of follow-up (95\% CI = \Sexpr{round(exp(mod.hrvhosp.inc$coeff[1]-1.96*summary(mod.hrvhosp.inc)$coeff[1,2])*100*12)} - \Sexpr{round(exp(mod.hrvhosp.inc$coeff[1]+1.96*summary(mod.hrvhosp.inc)$coeff[1,2])*100*12)}). <>= mod.any1<-glm(any.hosp~weight.bt+bpd+breastfed,family="binomial") wt.tex<-paste(round(exp(mod.any1$coeff[2]*100),2), " & (", round(exp((mod.any1$coeff[2]-1.96*summary(mod.any1)$coeff[2,2])*100),2),", ", round(exp((mod.any1$coeff[2]+1.96*summary(mod.any1)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.any1)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.any1$coeff[3]),2), " & (", round(exp((mod.any1$coeff[3]-1.96*summary(mod.any1)$coeff[3,2])),2),", ", round(exp((mod.any1$coeff[3]+1.96*summary(mod.any1)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.any1)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.any1$coeff[4]),2), " & (", round(exp((mod.any1$coeff[4]-1.96*summary(mod.any1)$coeff[4,2])),2),", ", round(exp((mod.any1$coeff[4]+1.96*summary(mod.any1)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.any1)$coeff[4,4]),sep="") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted odds ratios for any hospitalization.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & OR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable logistic regression model. \end{tablenotes} \end{threeparttable} <>= mod.hosp.inc<-glm.nb(tot.hosp~1+offset(log(followup))) round(exp(mod.hosp.inc$coeff[1])*100*12) round(exp(mod.hosp.inc$coeff[1]-1.96*summary(mod.hosp.inc)$coeff[1,2])*100*12) round(exp(mod.hosp.inc$coeff[1]+1.96*summary(mod.hosp.inc)$coeff[1,2])*100*12) ### There is over-dispersion, so negative binomial regression is best. #mod.any2<-glm(tot.hosp~weight.bt+bpd+breastfed+offset(log(followup)),family="poisson") mod.any3<-glm.nb(tot.hosp~weight.bt+bpd+breastfed+offset(log(followup))) wt.tex<-paste(round(exp(mod.any3$coeff[2]*100),2), " & (", round(exp((mod.any3$coeff[2]-1.96*summary(mod.any3)$coeff[2,2])*100),2),", ", round(exp((mod.any3$coeff[2]+1.96*summary(mod.any3)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.any3)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.any3$coeff[3]),2), " & (", round(exp((mod.any3$coeff[3]-1.96*summary(mod.any3)$coeff[3,2])),2),", ", round(exp((mod.any3$coeff[3]+1.96*summary(mod.any3)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.any3)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.any3$coeff[4]),2), " & (", round(exp((mod.any3$coeff[4]-1.96*summary(mod.any3)$coeff[4,2])),2),", ", round(exp((mod.any3$coeff[4]+1.96*summary(mod.any3)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.any3)$coeff[4,4]),sep="") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted relative risks for hospitalizations.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & RR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable negative binomial regression model using number of hospitalizations (there was evidence of overdispersion in the poisson model). \end{tablenotes} \end{threeparttable} \bigskip Incidence of hospitalization was \Sexpr{round(exp(mod.hosp.inc$coeff[1])*100*12)} per 100 infant-years of follow-up (95\% CI = \Sexpr{round(exp(mod.hosp.inc$coeff[1]-1.96*summary(mod.hosp.inc)$coeff[1,2])*100*12)} - \Sexpr{round(exp(mod.hosp.inc$coeff[1]+1.96*summary(mod.hosp.inc)$coeff[1,2])*100*12)}). <>= mod.rhino1<-glm(any.rhino.hosp~weight.bt+bpd+breastfed,subset=any.rhino==1,family="binomial") wt.tex<-paste(round(exp(mod.rhino1$coeff[2]*100),2), " & (", round(exp((mod.rhino1$coeff[2]-1.96*summary(mod.rhino1)$coeff[2,2])*100),2),", ", round(exp((mod.rhino1$coeff[2]+1.96*summary(mod.rhino1)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.rhino1)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.rhino1$coeff[3]),2), " & (", round(exp((mod.rhino1$coeff[3]-1.96*summary(mod.rhino1)$coeff[3,2])),2),", ", round(exp((mod.rhino1$coeff[3]+1.96*summary(mod.rhino1)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.rhino1)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.rhino1$coeff[4]),2), " & (", round(exp((mod.rhino1$coeff[4]-1.96*summary(mod.rhino1)$coeff[4,2])),2),", ", round(exp((mod.rhino1$coeff[4]+1.96*summary(mod.rhino1)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.rhino1)$coeff[4,4]),sep="") mod.rhino1.int<-glm(any.rhino.hosp~weight.bt+bpd+breastfed+female*breastfed,subset=any.rhino==1,family="binomial") mod.rhino1.int2<-glm(any.rhino.hosp~weight.bt+bpd+breastfed+female,subset=any.rhino==1,family="binomial") mod.rhino1.asthma<-glm(any.rhino.hosp~weight.bt+bpd+breastfed+asthma,subset=any.rhino==1,family="binomial") mod.rhino1.matage<-glm(any.rhino.hosp~weight.bt+bpd+breastfed+maternal.age,subset=any.rhino==1,family="binomial") mod.rhino.no.coinf<-glm(any.rhino.hosp.no.coinf~weight.bt+bpd+breastfed,subset=any.rhino.no.coinf==1,family="binomial") mod.rhino.no.coinf2<-glm(any.rhino.hosp.no.coinf~weight.bt+bpd,subset=any.rhino.no.coinf==1,family="binomial") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted odds ratios for any HRV-associated hospitalization among those who had at least one HRV-episode.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & OR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable logistic regression model. \end{tablenotes} \end{threeparttable} In secondary analyses, sex, maternal age, and parental asthma were not associated with HRV hospitalization (p=\Sexpr{nicePvalTex(summary(mod.rhino1.int2)$coeff[5,4])}, \Sexpr{nicePvalTex(summary(mod.rhino1.matage)$coeff[5,4])}, and \Sexpr{nicePvalTex(summary(mod.rhino1.asthma)$coeff[5,4])}, respectively), and there was little evidence of an interaction between sex and breastfeeding (p= \Sexpr{nicePvalTex(summary(mod.rhino1.int)$coeff[6,4])}). \bigskip In secondary analyses, we also looked at the rate of HRV-associated hospitalizations among those who had at least one HRV-associated episode, \textbf{excluding coinfection episodes}. \Sexpr{sum(any.rhino.hosp.no.coinf[breastfed==1])}/ \Sexpr{sum(any.rhino.hosp.no.coinf)} patients with at least one HRV-associated episode who were hospitalized breastfed whereas \Sexpr{sum(breastfed[any.rhino.hosp.no.coinf==0&any.rhino.no.coinf==1])}/ \Sexpr{sum(1-any.rhino.hosp.no.coinf[any.rhino.no.coinf==1])} infants with at least on HRV-associated episode who were not hospitalize breastfed (p \Sexpr{nicePvalTex(fisher.test(table(breastfed[any.rhino.no.coinf==1],any.rhino.hosp.no.coinf[any.rhino.no.coinf==1]))$p.value)}). Adjusted analyses were not possible due to small numbers. \Sexpr{sum(any.rhino.hosp.no.coinf[bpd==1])}/ \Sexpr{sum(any.rhino.hosp.no.coinf)} patients with at least one HRV-associated episode and were hospitalized had BPD whereas \Sexpr{sum(bpd[any.rhino.hosp.no.coinf==0&any.rhino.no.coinf==1])}/ \Sexpr{sum(1-any.rhino.hosp.no.coinf[any.rhino.no.coinf==1])} infants with at least on HRV-associated episode who were not hospitalized had BPD (p = \Sexpr{nicePvalTex(fisher.test(table(bpd[any.rhino.no.coinf==1],any.rhino.hosp.no.coinf[any.rhino.no.coinf==1]))$p.value)}). After adjusting for weight, p= \Sexpr{nicePvalTex(summary(mod.rhino.no.coinf2)$coeff[3,4])}. <>= mod.rhino2<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed,subset=any.rhino==1,family="poisson") wt.tex<-paste(round(exp(mod.rhino2$coeff[2]*100),2), " & (", round(exp((mod.rhino2$coeff[2]-1.96*summary(mod.rhino2)$coeff[2,2])*100),2),", ", round(exp((mod.rhino2$coeff[2]+1.96*summary(mod.rhino2)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.rhino2)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.rhino2$coeff[3]),2), " & (", round(exp((mod.rhino2$coeff[3]-1.96*summary(mod.rhino2)$coeff[3,2])),2),", ", round(exp((mod.rhino2$coeff[3]+1.96*summary(mod.rhino2)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.rhino2)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.rhino2$coeff[4]),2), " & (", round(exp((mod.rhino2$coeff[4]-1.96*summary(mod.rhino2)$coeff[4,2])),2),", ", round(exp((mod.rhino2$coeff[4]+1.96*summary(mod.rhino2)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.rhino2)$coeff[4,4]),sep="") mod.rhino2.int<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed+female+female*breastfed,subset=any.rhino==1,family="poisson") mod.rhino2.int2<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed+female,subset=any.rhino==1,family="poisson") mod.rhino2.asthma<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed+asthma,subset=any.rhino==1,family="poisson") mod.rhino2.matage<-glm(tot.rhino.hosp~weight.bt+bpd+breastfed+maternal.age,subset=any.rhino==1,family="poisson") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted relative risks for HRV-associated hospitalizations among those who had at least one HRV-episode.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & RR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable poisson regression model using number of hospitalizations (no evidence of overdispersion). \end{tablenotes} \end{threeparttable} In secondary analyses, sex, maternal age, and parental asthma were not associated with number of HRV hospitalizations for those who had at least one HRV-associated episode (p=\Sexpr{nicePvalTex(summary(mod.rhino2.int2)$coeff[5,4])}, \Sexpr{nicePvalTex(summary(mod.rhino2.matage)$coeff[5,4])}, and \Sexpr{nicePvalTex(summary(mod.rhino2.asthma)$coeff[5,4])}, respectively), and there was little evidence of an interaction between sex and breastfeeding (p= \Sexpr{nicePvalTex(summary(mod.rhino2.int)$coeff[6,4])}). <>= bronch1<-ifelse(d$IRA1DIAG[exclude==0]==4|d$IRA1DIAG[exclude==0]==7,1,0) bronch2<-ifelse(d$IRA2DIAG[exclude==0]==4|d$IRA2DIAG[exclude==0]==7,1,0) bronch3<-ifelse(d$IRA3DIAG[exclude==0]==4|d$IRA3DIAG[exclude==0]==7,1,0) bronch4<-ifelse(d$IRA4DIAG[exclude==0]==4|d$IRA4DIAG[exclude==0]==7,1,0) bronch5<-ifelse(d$IRA5DIAG[exclude==0]==4|d$IRA5DIAG[exclude==0]==7,1,0) bronch6<-ifelse(d$IRA6DIAG[exclude==0]==4|d$IRA6DIAG[exclude==0]==7,1,0) bronch7<-ifelse(d$IRA7DIAG[exclude==0]==4|d$IRA7DIAG[exclude==0]==7,1,0) bronch8<-ifelse(d$IRA8DIAG[exclude==0]==4|d$IRA8DIAG[exclude==0]==7,1,0) bronch9<-ifelse(d$IRA9DIAG[exclude==0]==4|d$IRA9DIAG[exclude==0]==7,1,0) tot.bronch<-tot.rhino.bronch<-tot.bronch.hosp<-0 for (i in 1:length(bronch1)) { tot.bronch[i]<-sum(c(bronch1[i],bronch2[i],bronch3[i],bronch4[i],bronch5[i],bronch6[i],bronch7[i], bronch8[i],bronch9[i]),na.rm=TRUE) tot.rhino.bronch[i]<-sum(c(bronch1[i]*rhino1[i],bronch2[i]*rhino2[i],bronch3[i]*rhino3[i],bronch4[i]*rhino4[i], bronch5[i]*rhino5[i],bronch6[i]*rhino6[i],bronch7[i]*rhino7[i],bronch8[i]*rhino8[i], bronch9[i]*rhino9[i]),na.rm=TRUE) tot.bronch.hosp[i]<-sum(c(bronch1[i]*hosp1[i],bronch2[i]*hosp2[i],bronch3[i]*hosp3[i],bronch4[i]*hosp4[i], bronch5[i]*hosp5[i],bronch6[i]*hosp6[i],bronch7[i]*hosp7[i],bronch8[i]*hosp8[i], bronch9[i]*hosp9[i]),na.rm=TRUE) } any.bronch<-ifelse(tot.bronch>=1,1,0) any.rhino.bronch<-ifelse(tot.rhino.bronch>=1,1,0) any.bronch.hosp<-ifelse(tot.bronch.hosp>=1,1,0) mod.bronch1<-glm(any.rhino.bronch~weight.bt+bpd+breastfed+asthma+smoke+maternal.age,family="binomial") wt.tex<-paste(round(exp(mod.bronch1$coeff[2]*100),2), " & (", round(exp((mod.bronch1$coeff[2]-1.96*summary(mod.bronch1)$coeff[2,2])*100),2),", ", round(exp((mod.bronch1$coeff[2]+1.96*summary(mod.bronch1)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.bronch1)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.bronch1$coeff[3]),2), " & (", round(exp((mod.bronch1$coeff[3]-1.96*summary(mod.bronch1)$coeff[3,2])),2),", ", round(exp((mod.bronch1$coeff[3]+1.96*summary(mod.bronch1)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.bronch1)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.bronch1$coeff[4]),2), " & (", round(exp((mod.bronch1$coeff[4]-1.96*summary(mod.bronch1)$coeff[4,2])),2),", ", round(exp((mod.bronch1$coeff[4]+1.96*summary(mod.bronch1)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.bronch1)$coeff[4,4]),sep="") asthma.tex<-paste(round(exp(mod.bronch1$coeff[5]),2), " & (", round(exp((mod.bronch1$coeff[5]-1.96*summary(mod.bronch1)$coeff[5,2])),2),", ", round(exp((mod.bronch1$coeff[5]+1.96*summary(mod.bronch1)$coeff[5,2])),2),") &", nicePvalTex(summary(mod.bronch1)$coeff[5,4]),sep="") smoke.tex<-paste(round(exp(mod.bronch1$coeff[6]),2), " & (", round(exp((mod.bronch1$coeff[6]-1.96*summary(mod.bronch1)$coeff[6,2])),2),", ", round(exp((mod.bronch1$coeff[6]+1.96*summary(mod.bronch1)$coeff[6,2])),2),") &", nicePvalTex(summary(mod.bronch1)$coeff[6,4]),sep="") matage.tex<-paste(round(exp(mod.bronch1$coeff[7]),2), " & (", round(exp((mod.bronch1$coeff[7]-1.96*summary(mod.bronch1)$coeff[7,2])),2),", ", round(exp((mod.bronch1$coeff[7]+1.96*summary(mod.bronch1)$coeff[7,2])),2),") &", nicePvalTex(summary(mod.bronch1)$coeff[7,4]),sep="") mod.bronch1.int<-glm(any.rhino.bronch~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+female+female*breastfed,family="binomial") mod.bronch1.int2<-glm(any.rhino.bronch~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+female,family="binomial") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted odds ratios for any HRV-associated bronchiolitis.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & OR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ Asthma in Parents & \Sexpr{asthma.tex} \\ Smoking at home & \Sexpr{smoke.tex} \\ Maternal age & \Sexpr{matage.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable logistic regression model. \end{tablenotes} \end{threeparttable} In secondary analyses, sex was not associated with HRV-associated bronchiolitis (p=\Sexpr{nicePvalTex(summary(mod.bronch1.int2)$coeff[8,4])}) nor was there an interaction between sex and breastfeeding (p= \Sexpr{nicePvalTex(summary(mod.bronch1.int)$coeff[9,4])}). <>= mod.bronch.inc<-glm.nb(tot.rhino.bronch~1+offset(log(followup))) round(exp(mod.bronch.inc$coeff[1])*100*12) round(exp(mod.bronch.inc$coeff[1]-1.96*summary(mod.bronch.inc)$coeff[1,2])*100*12) round(exp(mod.bronch.inc$coeff[1]+1.96*summary(mod.bronch.inc)$coeff[1,2])*100*12) mod.bronch3<-glm(tot.rhino.bronch~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+offset(log(followup)),family="poisson") library(MASS) mod.bronch2<-glm.nb(tot.rhino.bronch~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+offset(log(followup))) ### NB results are probably better because of overdispersion comparable. wt.tex<-paste(round(exp(mod.bronch2$coeff[2]*100),2), " & (", round(exp((mod.bronch2$coeff[2]-1.96*summary(mod.bronch2)$coeff[2,2])*100),2),", ", round(exp((mod.bronch2$coeff[2]+1.96*summary(mod.bronch2)$coeff[2,2])*100),2),") &", nicePvalTex(summary(mod.bronch2)$coeff[2,4]),sep="") bpd.tex<-paste(round(exp(mod.bronch2$coeff[3]),2), " & (", round(exp((mod.bronch2$coeff[3]-1.96*summary(mod.bronch2)$coeff[3,2])),2),", ", round(exp((mod.bronch2$coeff[3]+1.96*summary(mod.bronch2)$coeff[3,2])),2),") &", nicePvalTex(summary(mod.bronch2)$coeff[3,4]),sep="") breast.tex<-paste(round(exp(mod.bronch2$coeff[4]),2), " & (", round(exp((mod.bronch2$coeff[4]-1.96*summary(mod.bronch2)$coeff[4,2])),2),", ", round(exp((mod.bronch2$coeff[4]+1.96*summary(mod.bronch2)$coeff[4,2])),2),") &", nicePvalTex(summary(mod.bronch2)$coeff[4,4]),sep="") asthma.tex<-paste(round(exp(mod.bronch2$coeff[5]),2), " & (", round(exp((mod.bronch2$coeff[5]-1.96*summary(mod.bronch2)$coeff[5,2])),2),", ", round(exp((mod.bronch2$coeff[5]+1.96*summary(mod.bronch2)$coeff[5,2])),2),") &", nicePvalTex(summary(mod.bronch2)$coeff[5,4]),sep="") smoke.tex<-paste(round(exp(mod.bronch2$coeff[6]),2), " & (", round(exp((mod.bronch2$coeff[6]-1.96*summary(mod.bronch2)$coeff[6,2])),2),", ", round(exp((mod.bronch2$coeff[6]+1.96*summary(mod.bronch2)$coeff[6,2])),2),") &", nicePvalTex(summary(mod.bronch2)$coeff[6,4]),sep="") matage.tex<-paste(round(exp(mod.bronch2$coeff[7]),2), " & (", round(exp((mod.bronch2$coeff[7]-1.96*summary(mod.bronch2)$coeff[7,2])),2),", ", round(exp((mod.bronch2$coeff[7]+1.96*summary(mod.bronch2)$coeff[7,2])),2),") &", nicePvalTex(summary(mod.bronch2)$coeff[7,4]),sep="") mod.bronch2.int<-glm.nb(tot.rhino.bronch~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+female*breastfed+ offset(log(followup))) mod.bronch2.int2<-glm.nb(tot.rhino.bronch~weight.bt+bpd+breastfed+asthma+smoke+maternal.age+female+offset(log(followup))) @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Adjusted relative risks for HRV-associated bronchiolitis.\tnote{a}} \centering{ \begin{tabular}{llll} \hline \\ & RR & 95\% CI & p-value \\ \hline \\ Weight (per 100g) & \Sexpr{wt.tex} \\ BPD & \Sexpr{bpd.tex} \\ Breastfed & \Sexpr{breast.tex} \\ Asthma in Parents & \Sexpr{asthma.tex} \\ Smoking at home & \Sexpr{smoke.tex} \\ Maternal age & \Sexpr{matage.tex} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] Based on multivariable negative binomial regression model using number of HRV-associated episodes. \end{tablenotes} \end{threeparttable} In secondary analyses, sex was not associated with HRV-bronchiolits (p=\Sexpr{nicePvalTex(summary(mod.bronch2.int2)$coeff[8,4])}) nor was there an interaction between sex and breastfeeding (p= \Sexpr{nicePvalTex(summary(mod.bronch2.int)$coeff[9,4])}). \bigskip Incidence of HRV-associated bronchiolitis was \Sexpr{round(exp(mod.bronch.inc$coeff[1])*100*12)} per 100 infant-years of follow-up (95\% CI = \Sexpr{round(exp(mod.bronch.inc$coeff[1]-1.96*summary(mod.bronch.inc)$coeff[1,2])*100*12)} - \Sexpr{round(exp(mod.bronch.inc$coeff[1]+1.96*summary(mod.bronch.inc)$coeff[1,2])*100*12)}). <>= a<-data.frame(id=d$REGISTRO, virus1=d$ETIOL1,sev1=d$IRA1ERIN,hosp1=d$INT1,winter1=d$INVIRA1,month1=d$IRA1MES,hospdays1=d$DIASINT1,ventdays1=d$ARM1, virus2=d$ETIOL2,sev2=d$IRA2ERIN,hosp2=d$INT2,winter2=d$INVIRA2,month2=d$IRA2MES,hospdays2=d$DIASINT2,ventdays2=d$ARM2, virus3=d$ETIOL3,sev3=d$IRA3ERIN,hosp3=d$INT3,winter3=d$INVIRA3,month3=d$IRA3MES,hospdays3=d$DIASINT3,ventdays3=d$ARM3, virus4=d$ETIOL4,sev4=d$IRA4ERIN,hosp4=d$INT4,winter4=d$INVIRA4,month4=d$IRA4MES,hospdays4=d$DIASINT4,ventdays4=d$ARM4, virus5=d$ETIOL5,sev5=d$IRA5ERIN,hosp5=d$INT5,winter5=d$INVIRA5,month5=d$IRA5MES,hospdays5=d$DIASINT5,ventdays5=d$ARM5, virus6=d$ETIOL6,sev6=d$IRA6ERIN,hosp6=d$INT6,winter6=d$INVIRA6,month6=d$IRA6MES,hospdays6=d$DIASINT6,ventdays6=d$ARM6, virus7=d$ETIOL7,sev7=d$IRA7ERIN,hosp7=d$INT7,winter7=d$INVIRA7,month7=d$IRA7MES,hospdays7=d$DIASINT7,ventdays7=d$ARM7, virus8=d$ETIOL8,sev8=d$IRA8ERIN,hosp8=d$INT8,winter8=d$INVIRA8,month8=d$IRA8MES,hospdays8=d$DIASINT8,ventdays8=d$ARM8, virus9=d$ETIOL9,sev9=d$IRA9ERIN,hosp9=d$INT9,winter9=d$INVIRA9,month9=d$IRA9MES,hospdays9=d$DIASINT9,ventdays9=d$ARM9, age1=d$IRA1EDAD,age2=d$IRA2EDAD,age3=d$IRA3EDAD,age4=d$IRA4EDAD,age5=d$IRA5EDAD,age6=d$IRA6EDAD,age7=d$IRA7EDAD, age8=d$IRA8EDAD,age9=d$IRA9EDAD, diag1=d$IRA1DIAG,diag2=d$IRA2DIAG,diag3=d$IRA3DIAG,diag4=d$IRA4DIAG,diag5=d$IRA5DIAG,diag6=d$IRA6DIAG,diag7=d$IRA7DIAG, diag8=d$IRA8DIAG,diag9=d$IRA9DIAG, episode.no1=d$IRA1,episode.no2=d$IRA2,episode.no3=d$IRA3,episode.no4=d$IRA4,episode.no5=d$IRA5,episode.no6=d$IRA6,episode.no7=d$IRA7, episode.no8=d$IRA8,episode.no9=d$IRA9) df.virus<-reshape(a[,which(names(a) %in% c("id","virus1","virus2","virus3","virus4","virus5","virus6","virus7","virus8","virus9"))], varying=list(c("virus1","virus2","virus3","virus4","virus5","virus6","virus7","virus8","virus9")), direction="long",timevar="episode",v.names="virus") df.sev<-reshape(a[,which(names(a) %in% c("id","sev1","sev2","sev3","sev4","sev5","sev6","sev7","sev8","sev9"))], varying=list(c("sev1","sev2","sev3","sev4","sev5","sev6","sev7","sev8","sev9")), direction="long",timevar="episode",v.names="sev") df.hosp<-reshape(a[,which(names(a) %in% c("id","hosp1","hosp2","hosp3","hosp4","hosp5","hosp6","hosp7","hosp8","hosp9"))], varying=list(c("hosp1","hosp2","hosp3","hosp4","hosp5","hosp6","hosp7","hosp8","hosp9")), direction="long",timevar="episode",v.names="hosp") df.winter<-reshape(a[,which(names(a) %in% c("id","winter1","winter2","winter3","winter4","winter5","winter6","winter7","winter8","winter9"))], varying=list(c("winter1","winter2","winter3","winter4","winter5","winter6","winter7","winter8","winter9")), direction="long",timevar="episode",v.names="winter") df.month<-reshape(a[,which(names(a) %in% c("id","month1","month2","month3","month4","month5","month6","month7","month8","month9"))], varying=list(c("month1","month2","month3","month4","month5","month6","month7","month8","month9")), direction="long",timevar="episode",v.names="month") df.hospdays<-reshape(a[,which(names(a) %in% c("id","hospdays1","hospdays2","hospdays3","hospdays4","hospdays5","hospdays6","hospdays7","hospdays8","hospdays9"))], varying=list(c("hospdays1","hospdays2","hospdays3","hospdays4","hospdays5","hospdays6","hospdays7", "hospdays8","hospdays9")), direction="long",timevar="episode",v.names="hospdays") df.ventdays<-reshape(a[,which(names(a) %in% c("id","ventdays1","ventdays2","ventdays3","ventdays4","ventdays5","ventdays6","ventdays7","ventdays8","ventdays9"))], varying=list(c("ventdays1","ventdays2","ventdays3","ventdays4","ventdays5","ventdays6","ventdays7", "ventdays8","ventdays9")), direction="long",timevar="episode",v.names="ventdays") df.age<-reshape(a[,which(names(a) %in% c("id","age1","age2","age3","age4","age5","age6","age7","age8","age9"))], varying=list(c("age1","age2","age3","age4","age5","age6","age7", "age8","age9")), direction="long",timevar="episode",v.names="age") df.diag<-reshape(a[,which(names(a) %in% c("id","diag1","diag2","diag3","diag4","diag5","diag6","diag7","diag8","diag9"))], varying=list(c("diag1","diag2","diag3","diag4","diag5","diag6","diag7", "diag8","diag9")), direction="long",timevar="episode",v.names="diag") df.episode<-reshape(a[,which(names(a) %in% c("id","episode.no1","episode.no2","episode.no3","episode.no4","episode.no5","episode.no6","episode.no7","episode.no8","episode.no9"))], varying=list(c("episode.no1","episode.no2","episode.no3","episode.no4","episode.no5","episode.no6","episode.no7", "episode.no8","episode.no9")), direction="long",timevar="episode",v.names="episode.no") b1<-merge(df.virus,df.sev,by=c("id","episode")) b2<-merge(b1,df.hosp,by=c("id","episode")) b3<-merge(b2,df.winter,by=c("id","episode")) b4<-merge(b3,df.month,by=c("id","episode")) b5<-merge(b4,df.hospdays,by=c("id","episode")) b6<-merge(b5,df.ventdays,by=c("id","episode")) b7<-merge(b6,df.age,by=c("id","episode")) b8<-merge(b7,df.diag,by=c("id","episode")) b9<-merge(b8,df.episode,by=c("id","episode")) b.tot<-b9[which(!is.na(b9$episode.no)&b9$episode.no==1),] #b.tot<-b8[which(!is.na(b8$virus),] b<-b.tot[which(b.tot$id!=d$REGISTRO[exclude==1]),] virus.type1<-ifelse(b$virus==0,"Negative", ifelse(b$virus==10,"HRV", ifelse(b$virus>10,"Coinfection", ifelse(b$virus<10,"not HRV",99)))) virus.type<-ifelse(b$virus==10,"bHRV+", #### a and b added so things would be in the right order on tables ifelse(b$virus>10,"Coinfection", ifelse(b$virus<10,"aHRV-",99))) table(virus.type) nsev<-table(b$sev,virus.type) psev<-matrix(NA,5,3) for (i in 1:5) { psev[i,]<-round(100*table(b$sev,virus.type)[i,]/table(virus.type)) } #chisq.test(table(b$sev,virus.type)) pval.sev<-nicePvalTex(wilcox.test(b$sev[virus.type=="bHRV+"],b$sev[virus.type=="aHRV-"])$p.value) nhosp<-table(b$hosp,virus.type)[2,] phosp<-round(100*table(b$hosp,virus.type)[2,]/table(virus.type)) pval.hosp<-nicePvalTex(chisq.test(table(b$hosp,virus.type)[,-3])$p.value) shospdays1<-summary(b$hospdays[virus.type=="aHRV-"&b$hosp==1])[c(2,3,5)] shospdays2<-summary(b$hospdays[virus.type=="bHRV+"&b$hosp==1])[c(2,3,5)] shospdays3<-summary(b$hospdays[virus.type=="Coinfection"&b$hosp==1])[c(2,3,5)] pval.hospdays<-nicePvalTex(wilcox.test(b$hospdays[virus.type=="bHRV+"&b$hosp==1], b$hospdays[virus.type=="aHRV-"&b$hosp==1])$p.value) shospdays1.tex<-paste(shospdays1[2]," (",shospdays1[1],", ",shospdays1[3],")", sep="") shospdays2.tex<-paste(shospdays2[2]," (",shospdays2[1],", ",shospdays2[3],")", sep="") shospdays3.tex<-paste(shospdays3[2]," (",shospdays3[1],", ",shospdays3[3],")", sep="") #table(b$hospdays~virus.type) table(b$ventdays,virus.type) nvent<-table(b$ventdays>0,virus.type)[2,] pvent<-round(100*table(b$ventdays>0,virus.type)[2,]/table(virus.type)) pval.vent<-nicePvalTex(chisq.test(table(b$ventdays>0,virus.type)[,-3])$p.value) nwint<-table(b$winter,virus.type)[2,] pwint<-round(100*table(b$winter,virus.type)[2,]/table(virus.type)) pval.wint<-nicePvalTex(chisq.test(table(b$winter,virus.type)[,-3])$p.value) nmonth<-table(b$month,virus.type) pmonth<-matrix(NA,12,3) for (i in 1:12) { pmonth[i,]<-round(100*nmonth[i,]/table(virus.type)) } pval.month<-nicePvalTex(chisq.test(table(b$month,virus.type)[,-3])$p.value) b$id[b$month==7&b$winter==0] b$episode[b$month==7&b$winter==0] b$id[b$month==8&b$winter==0] b$episode[b$month==8&b$winter==0] b$id[b$month==1&b$winter==1] b$episode[b$month==1&b$winter==1] b$id[b$month==4&b$winter==1] b$episode[b$month==4&b$winter==1] b$id[b$sev<5&b$ventdays>0] b$episode[b$sev<5&b$ventdays>0] sage1<-summary(b$age[virus.type=="aHRV-"])[c(2,3,5)] sage2<-summary(b$age[virus.type=="bHRV+"])[c(2,3,5)] sage3<-summary(b$age[virus.type=="Coinfection"])[c(2,3,5)] pval.age<-nicePvalTex(wilcox.test(b$age[virus.type=="aHRV-"],b$age[virus.type=="bHRV+"])$p.value) sage1.tex<-paste(sage1[2]," (",sage1[1],", ",sage1[3],")", sep="") sage2.tex<-paste(sage2[2]," (",sage2[1],", ",sage2[3],")", sep="") sage3.tex<-paste(sage3[2]," (",sage3[1],", ",sage3[3],")", sep="") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Comparison of episodes by viral etiology.} \centering{ \begin{tabular}{lllll} \hline \\ & HRV- & HRV+ & Coinfection & P-value\tnote{a} \\ & (n=\Sexpr{table(virus.type)[1]}) & (n=\Sexpr{table(virus.type)[2]}) & (n=\Sexpr{table(virus.type)[3]}) \\ \hline \\ Severity & & & & \Sexpr{pval.sev} \\ \hspace{.2in} 1 & \Sexpr{nsev[1,1]} (\Sexpr{psev[1,1]}\%) & \Sexpr{nsev[1,2]} (\Sexpr{psev[1,2]}\%) & \Sexpr{nsev[1,3]} (\Sexpr{psev[1,3]}\%) \\ \hspace{.2in} 2 & \Sexpr{nsev[2,1]} (\Sexpr{psev[2,1]}\%) & \Sexpr{nsev[2,2]} (\Sexpr{psev[2,2]}\%) & \Sexpr{nsev[2,3]} (\Sexpr{psev[2,3]}\%) \\ \hspace{.2in} 3 & \Sexpr{nsev[3,1]} (\Sexpr{psev[3,1]}\%) & \Sexpr{nsev[3,2]} (\Sexpr{psev[3,2]}\%) & \Sexpr{nsev[3,3]} (\Sexpr{psev[3,3]}\%) \\ \hspace{.2in} 4 & \Sexpr{nsev[4,1]} (\Sexpr{psev[4,1]}\%) & \Sexpr{nsev[4,2]} (\Sexpr{psev[4,2]}\%) & \Sexpr{nsev[4,3]} (\Sexpr{psev[4,3]}\%) \\ \hspace{.2in} 5 & \Sexpr{nsev[5,1]} (\Sexpr{psev[5,1]}\%) & \Sexpr{nsev[5,2]} (\Sexpr{psev[5,2]}\%) & \Sexpr{nsev[5,3]} (\Sexpr{psev[5,3]}\%) \\ \\ Hospitalization & \Sexpr{nhosp[1]} (\Sexpr{phosp[1]}\%) & \Sexpr{nhosp[2]} (\Sexpr{phosp[2]}\%) & \Sexpr{nhosp[3]} (\Sexpr{phosp[3]}\%) & \Sexpr{pval.hosp} \\ \hspace{.2in} Days Hospitalized\tnote{b} &\Sexpr{shospdays1.tex} &\Sexpr{shospdays2.tex} &\Sexpr{shospdays3.tex} & \Sexpr{pval.hospdays} \\ \\ Ventilator & \Sexpr{nvent[1]} (\Sexpr{pvent[1]}\%) & \Sexpr{nvent[2]} (\Sexpr{pvent[2]}\%) & \Sexpr{nvent[3]} (\Sexpr{pvent[3]}\%) & \Sexpr{pval.vent} \\ \\ %\hspace{.2in} Days on Ventilator \\ Winter & \Sexpr{nwint[1]} (\Sexpr{pwint[1]}\%) & \Sexpr{nwint[2]} (\Sexpr{pwint[2]}\%) & \Sexpr{nwint[3]} (\Sexpr{pwint[3]}\%) & \Sexpr{pval.wint} \\ \\ Month & & & & \Sexpr{pval.month} \\ \hspace{.2in} January & \Sexpr{nmonth[1,1]} (\Sexpr{pmonth[1,1]}\%) & \Sexpr{nmonth[1,2]} (\Sexpr{pmonth[1,2]}\%) & \Sexpr{nmonth[1,3]} (\Sexpr{pmonth[1,3]}\%) \\ \hspace{.2in} February & \Sexpr{nmonth[2,1]} (\Sexpr{pmonth[2,1]}\%) & \Sexpr{nmonth[2,2]} (\Sexpr{pmonth[2,2]}\%) & \Sexpr{nmonth[2,3]} (\Sexpr{pmonth[2,3]}\%) \\ \hspace{.2in} March & \Sexpr{nmonth[3,1]} (\Sexpr{pmonth[3,1]}\%) & \Sexpr{nmonth[3,2]} (\Sexpr{pmonth[3,2]}\%) & \Sexpr{nmonth[3,3]} (\Sexpr{pmonth[3,3]}\%) \\ \hspace{.2in} April & \Sexpr{nmonth[4,1]} (\Sexpr{pmonth[4,1]}\%) & \Sexpr{nmonth[4,2]} (\Sexpr{pmonth[4,2]}\%) & \Sexpr{nmonth[4,3]} (\Sexpr{pmonth[4,3]}\%) \\ \hspace{.2in} May & \Sexpr{nmonth[5,1]} (\Sexpr{pmonth[5,1]}\%) & \Sexpr{nmonth[5,2]} (\Sexpr{pmonth[5,2]}\%) & \Sexpr{nmonth[5,3]} (\Sexpr{pmonth[5,3]}\%) \\ \hspace{.2in} June & \Sexpr{nmonth[6,1]} (\Sexpr{pmonth[6,1]}\%) & \Sexpr{nmonth[6,2]} (\Sexpr{pmonth[6,2]}\%) & \Sexpr{nmonth[6,3]} (\Sexpr{pmonth[6,3]}\%) \\ \hspace{.2in} July & \Sexpr{nmonth[7,1]} (\Sexpr{pmonth[7,1]}\%) & \Sexpr{nmonth[7,2]} (\Sexpr{pmonth[7,2]}\%) & \Sexpr{nmonth[7,3]} (\Sexpr{pmonth[7,3]}\%) \\ \hspace{.2in} August & \Sexpr{nmonth[8,1]} (\Sexpr{pmonth[8,1]}\%) & \Sexpr{nmonth[8,2]} (\Sexpr{pmonth[8,2]}\%) & \Sexpr{nmonth[8,3]} (\Sexpr{pmonth[8,3]}\%) \\ \hspace{.2in} September & \Sexpr{nmonth[9,1]} (\Sexpr{pmonth[9,1]}\%) & \Sexpr{nmonth[9,2]} (\Sexpr{pmonth[9,2]}\%) & \Sexpr{nmonth[9,3]} (\Sexpr{pmonth[9,3]}\%) \\ \hspace{.2in} October & \Sexpr{nmonth[10,1]} (\Sexpr{pmonth[10,1]}\%) & \Sexpr{nmonth[10,2]} (\Sexpr{pmonth[10,2]}\%) & \Sexpr{nmonth[10,3]} (\Sexpr{pmonth[10,3]}\%) \\ \hspace{.2in} November & \Sexpr{nmonth[11,1]} (\Sexpr{pmonth[11,1]}\%) & \Sexpr{nmonth[11,2]} (\Sexpr{pmonth[11,2]}\%) & \Sexpr{nmonth[11,3]} (\Sexpr{pmonth[11,3]}\%) \\ \hspace{.2in} December & \Sexpr{nmonth[12,1]} (\Sexpr{pmonth[12,1]}\%) & \Sexpr{nmonth[12,2]} (\Sexpr{pmonth[12,2]}\%) & \Sexpr{nmonth[12,3]} (\Sexpr{pmonth[12,3]}\%) \\ \\ Age (months)\tnote{c} &\Sexpr{sage1.tex} &\Sexpr{sage2.tex} &\Sexpr{sage3.tex} & \Sexpr{pval.age} \\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] P-values compare HRV- with HRV+ using Wilcoxon rank-sum or chi-square tests as appropriate. \item[b] Median (IQR) among those hospitalized \item[c] Median (IQR) \end{tablenotes} \end{threeparttable} <>= virus.type<-ifelse(b$virus==0,"Negative", ifelse(b$virus==10,"HRV", ifelse(b$virus>10,"Coinfection", ifelse(b$virus<10,"not HRV",99)))) rsv<-ifelse(b$virus==2,1,0) table(virus.type) nsev<-table(b$sev,virus.type) psev<-matrix(NA,5,4) for (i in 1:5) { psev[i,]<-round(100*table(b$sev,virus.type)[i,]/table(virus.type)) } pval.sev1<-nicePvalTex(wilcox.test(b$sev[virus.type=="HRV"],b$sev[virus.type=="Negative"])$p.value) pval.sev2<-nicePvalTex(wilcox.test(b$sev[virus.type=="HRV"],b$sev[virus.type=="not HRV"])$p.value) nsev.rsv<-table(b$sev,rsv)[,2] psev.rsv<-round(100*nsev.rsv/sum(nsev.rsv)) pval.sev.rsv<-nicePvalTex(wilcox.test(b$sev[virus.type=="HRV"],b$sev[rsv==1])$p.value) nhosp<-table(b$hosp,virus.type)[2,] phosp<-round(100*table(b$hosp,virus.type)[2,]/table(virus.type)) pval.hosp1<-nicePvalTex(chisq.test(table(b$hosp,virus.type)[,c(-1,-4)])$p.value) pval.hosp2<-nicePvalTex(chisq.test(table(b$hosp,virus.type)[,c(-1,-3)])$p.value) nhosp.rsv<-table(b$hosp,rsv)[2,2] phosp.rsv<-round(100*nhosp.rsv/sum(table(b$hosp,rsv)[,2])) pval.hosp.rsv<-nicePvalTex(chisq.test(cbind(table(b$hosp,virus.type)[,2],table(b$hosp,rsv)[,2]))$p.value) shospdays1<-summary(b$hospdays[virus.type=="Coinfection"&b$hosp==1])[c(2,3,5)] shospdays2<-summary(b$hospdays[virus.type=="HRV"&b$hosp==1])[c(2,3,5)] shospdays3<-summary(b$hospdays[virus.type=="Negative"&b$hosp==1])[c(2,3,5)] shospdays4<-summary(b$hospdays[virus.type=="not HRV"&b$hosp==1])[c(2,3,5)] pval.hospdays1<-nicePvalTex(wilcox.test(b$hospdays[virus.type=="HRV"&b$hosp==1], b$hospdays[virus.type=="Negative"&b$hosp==1])$p.value) pval.hospdays2<-nicePvalTex(wilcox.test(b$hospdays[virus.type=="HRV"&b$hosp==1], b$hospdays[virus.type=="not HRV"&b$hosp==1])$p.value) shospdays1.tex<-paste(shospdays1[2]," (",shospdays1[1],", ",shospdays1[3],")", sep="") shospdays2.tex<-paste(shospdays2[2]," (",shospdays2[1],", ",shospdays2[3],")", sep="") shospdays3.tex<-paste(shospdays3[2]," (",shospdays3[1],", ",shospdays3[3],")", sep="") shospdays4.tex<-paste(shospdays4[2]," (",shospdays4[1],", ",shospdays4[3],")", sep="") shospdays.rsv<-summary(b$hospdays[rsv==1&b$hosp==1])[c(2,3,5)] pval.hospdays.rsv<-nicePvalTex(wilcox.test(b$hospdays[virus.type=="HRV"&b$hosp==1], b$hospdays[rsv==1&b$hosp==1])$p.value) shospdays.rsv.tex<-paste(shospdays.rsv[2]," (",shospdays.rsv[1],", ",shospdays.rsv[3],")", sep="") #table(b$hospdays~virus.type) table(b$ventdays,virus.type) nvent<-table(b$ventdays>0,virus.type)[2,] pvent<-round(100*table(b$ventdays>0,virus.type)[2,]/table(virus.type)) pval.vent1<-nicePvalTex(chisq.test(table(b$ventdays>0,virus.type)[,c(-1,-4)])$p.value) pval.vent2<-nicePvalTex(chisq.test(table(b$ventdays>0,virus.type)[,c(-1,-3)])$p.value) table(b$ventdays,rsv) nvent.rsv<-table(b$ventdays>0,rsv)[2,2] pvent.rsv<-round(100*nvent.rsv/sum(table(b$ventdays>0,rsv)[,2])) pval.vent.rsv<-nicePvalTex(chisq.test(cbind(table(b$ventdays>0,virus.type)[,2],table(b$ventdays>0,rsv)[,2]))$p.value) nwint<-table(b$winter,virus.type)[2,] pwint<-round(100*table(b$winter,virus.type)[2,]/table(virus.type)) pval.wint1<-nicePvalTex(chisq.test(table(b$winter,virus.type)[,c(-1,-4)])$p.value) pval.wint2<-nicePvalTex(chisq.test(table(b$winter,virus.type)[,c(-1,-3)])$p.value) nwint.rsv<-table(b$winter,rsv)[2,2] pwint.rsv<-round(100*nwint.rsv/sum(table(b$winter,rsv)[,2])) pval.wint.rsv<-nicePvalTex(chisq.test(cbind(table(b$winter,virus.type)[,2],table(b$winter,rsv)[,2]))$p.value) nmonth<-table(b$month,virus.type) pmonth<-matrix(NA,12,4) for (i in 1:12) { pmonth[i,]<-round(100*nmonth[i,]/table(virus.type)) } pval.month1<-nicePvalTex(chisq.test(table(b$month,virus.type)[,c(-1,-4)])$p.value) pval.month2<-nicePvalTex(chisq.test(table(b$month,virus.type)[,c(-1,-3)])$p.value) nmonth.rsv<-table(b$month,rsv)[,2] pmonth.rsv<-round(100*nmonth.rsv/sum(table(b$month,rsv)[,2])) pval.month.rsv<-nicePvalTex(chisq.test(cbind(table(b$month,virus.type)[,2],table(b$month,rsv)[,2]))$p.value) sage1<-summary(b$age[virus.type=="Coinfection"])[c(2,3,5)] sage2<-summary(b$age[virus.type=="HRV"])[c(2,3,5)] sage3<-summary(b$age[virus.type=="Negative"])[c(2,3,5)] sage4<-summary(b$age[virus.type=="not HRV"])[c(2,3,5)] pval.age1<-nicePvalTex(wilcox.test(b$age[virus.type=="HRV"],b$age[virus.type=="Negative"])$p.value) pval.age2<-nicePvalTex(wilcox.test(b$age[virus.type=="HRV"],b$age[virus.type=="not HRV"])$p.value) sage1.tex<-paste(sage1[2]," (",sage1[1],", ",sage1[3],")", sep="") sage2.tex<-paste(sage2[2]," (",sage2[1],", ",sage2[3],")", sep="") sage3.tex<-paste(sage3[2]," (",sage3[1],", ",sage3[3],")", sep="") sage4.tex<-paste(sage4[2]," (",sage4[1],", ",sage4[3],")", sep="") sage.rsv<-summary(b$age[rsv==1])[c(2,3,5)] pval.age.rsv<-nicePvalTex(wilcox.test(b$age[virus.type=="HRV"],b$age[rsv==1])$p.value) sage.rsv.tex<-paste(sage.rsv[2]," (",sage.rsv[1],", ",sage.rsv[3],")", sep="") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Comparison of episodes by viral etiology.} \centering{ \begin{tabular}{llllllllll} \hline \\ & Coinfection\tnote{f} & HRV+ & Negative & Other virus & RSV+ & P-value\tnote{a} & P-value\tnote{b} & P-value\tnote{c} \\ & (n=\Sexpr{table(virus.type)[1]}) & (n=\Sexpr{table(virus.type)[2]}) & (n=\Sexpr{table(virus.type)[3]}) & (n=\Sexpr{table(virus.type)[4]}) & (n=\Sexpr{sum(rsv,na.rm=TRUE)}) \\ \hline \\ Severity & & & & & & \Sexpr{pval.sev1} & \Sexpr{pval.sev2} & \Sexpr{pval.sev.rsv} \\ \hspace{.2in} 1 & \Sexpr{nsev[1,1]} (\Sexpr{psev[1,1]}\%) & \Sexpr{nsev[1,2]} (\Sexpr{psev[1,2]}\%) & \Sexpr{nsev[1,3]} (\Sexpr{psev[1,3]}\%) & \Sexpr{nsev[1,4]} (\Sexpr{psev[1,4]}\%) & \Sexpr{nsev.rsv[1]} (\Sexpr{psev.rsv[1]}\%) \\ \hspace{.2in} 2 & \Sexpr{nsev[2,1]} (\Sexpr{psev[2,1]}\%) & \Sexpr{nsev[2,2]} (\Sexpr{psev[2,2]}\%) & \Sexpr{nsev[2,3]} (\Sexpr{psev[2,3]}\%) & \Sexpr{nsev[2,4]} (\Sexpr{psev[2,4]}\%) & \Sexpr{nsev.rsv[2]} (\Sexpr{psev.rsv[2]}\%) \\ \hspace{.2in} 3 & \Sexpr{nsev[3,1]} (\Sexpr{psev[3,1]}\%) & \Sexpr{nsev[3,2]} (\Sexpr{psev[3,2]}\%) & \Sexpr{nsev[3,3]} (\Sexpr{psev[3,3]}\%) & \Sexpr{nsev[3,4]} (\Sexpr{psev[3,4]}\%) & \Sexpr{nsev.rsv[3]} (\Sexpr{psev.rsv[3]}\%) \\ \hspace{.2in} 4 & \Sexpr{nsev[4,1]} (\Sexpr{psev[4,1]}\%) & \Sexpr{nsev[4,2]} (\Sexpr{psev[4,2]}\%) & \Sexpr{nsev[4,3]} (\Sexpr{psev[4,3]}\%) & \Sexpr{nsev[4,4]} (\Sexpr{psev[4,4]}\%) & \Sexpr{nsev.rsv[4]} (\Sexpr{psev.rsv[4]}\%) \\ \hspace{.2in} 5 & \Sexpr{nsev[5,1]} (\Sexpr{psev[5,1]}\%) & \Sexpr{nsev[5,2]} (\Sexpr{psev[5,2]}\%) & \Sexpr{nsev[5,3]} (\Sexpr{psev[5,3]}\%) & \Sexpr{nsev[5,4]} (\Sexpr{psev[5,4]}\%) & \Sexpr{nsev.rsv[5]} (\Sexpr{psev.rsv[5]}\%) \\ \\ Hospitalization & \Sexpr{nhosp[1]} (\Sexpr{phosp[1]}\%) & \Sexpr{nhosp[2]} (\Sexpr{phosp[2]}\%) & \Sexpr{nhosp[3]} (\Sexpr{phosp[3]}\%) & \Sexpr{nhosp[4]} (\Sexpr{phosp[4]}\%) & \Sexpr{nhosp.rsv} (\Sexpr{phosp.rsv}\%) & \Sexpr{pval.hosp1} & \Sexpr{pval.hosp2} &\Sexpr{pval.hosp.rsv} \\ \hspace{.2in} Days Hospitalized\tnote{d} &\Sexpr{shospdays1.tex} &\Sexpr{shospdays2.tex} &\Sexpr{shospdays3.tex} &\Sexpr{shospdays4.tex} & \Sexpr{shospdays.rsv.tex} & \Sexpr{pval.hospdays1} & \Sexpr{pval.hospdays2} & \Sexpr{pval.hospdays.rsv} \\ \\ Ventilator & \Sexpr{nvent[1]} (\Sexpr{pvent[1]}\%) & \Sexpr{nvent[2]} (\Sexpr{pvent[2]}\%) & \Sexpr{nvent[3]} (\Sexpr{pvent[3]}\%) & \Sexpr{nvent[4]} (\Sexpr{pvent[4]}\%) & \Sexpr{nvent.rsv} (\Sexpr{pvent.rsv}\%) & \Sexpr{pval.vent1} & \Sexpr{pval.vent2} & \Sexpr{pval.vent.rsv} \\ \\ %\hspace{.2in} Days on Ventilator \\ Winter & \Sexpr{nwint[1]} (\Sexpr{pwint[1]}\%) & \Sexpr{nwint[2]} (\Sexpr{pwint[2]}\%) & \Sexpr{nwint[3]} (\Sexpr{pwint[3]}\%) & \Sexpr{nwint[4]} (\Sexpr{pwint[4]}\%) & \Sexpr{nwint.rsv} (\Sexpr{pwint.rsv}\%) & \Sexpr{pval.wint1} & \Sexpr{pval.wint2} & \Sexpr{pval.wint.rsv} \\ \\ Month & & & & & & \Sexpr{pval.month1} & \Sexpr{pval.month2} & \Sexpr{pval.month.rsv} \\ \hspace{.2in} January & \Sexpr{nmonth[1,1]} (\Sexpr{pmonth[1,1]}\%) & \Sexpr{nmonth[1,2]} (\Sexpr{pmonth[1,2]}\%) & \Sexpr{nmonth[1,3]} (\Sexpr{pmonth[1,3]}\%) & \Sexpr{nmonth[1,4]} (\Sexpr{pmonth[1,4]}\%) & \Sexpr{nmonth.rsv[1]} (\Sexpr{pmonth.rsv[1]}\%) \\ \hspace{.2in} February & \Sexpr{nmonth[2,1]} (\Sexpr{pmonth[2,1]}\%) & \Sexpr{nmonth[2,2]} (\Sexpr{pmonth[2,2]}\%) & \Sexpr{nmonth[2,3]} (\Sexpr{pmonth[2,3]}\%) & \Sexpr{nmonth[2,4]} (\Sexpr{pmonth[2,4]}\%) & \Sexpr{nmonth.rsv[2]} (\Sexpr{pmonth.rsv[2]}\%) \\ \hspace{.2in} March & \Sexpr{nmonth[3,1]} (\Sexpr{pmonth[3,1]}\%) & \Sexpr{nmonth[3,2]} (\Sexpr{pmonth[3,2]}\%) & \Sexpr{nmonth[3,3]} (\Sexpr{pmonth[3,3]}\%) & \Sexpr{nmonth[3,4]} (\Sexpr{pmonth[3,4]}\%) & \Sexpr{nmonth.rsv[3]} (\Sexpr{pmonth.rsv[3]}\%) \\ \hspace{.2in} April & \Sexpr{nmonth[4,1]} (\Sexpr{pmonth[4,1]}\%) & \Sexpr{nmonth[4,2]} (\Sexpr{pmonth[4,2]}\%) & \Sexpr{nmonth[4,3]} (\Sexpr{pmonth[4,3]}\%) & \Sexpr{nmonth[4,4]} (\Sexpr{pmonth[4,4]}\%) & \Sexpr{nmonth.rsv[4]} (\Sexpr{pmonth.rsv[4]}\%) \\ \hspace{.2in} May & \Sexpr{nmonth[5,1]} (\Sexpr{pmonth[5,1]}\%) & \Sexpr{nmonth[5,2]} (\Sexpr{pmonth[5,2]}\%) & \Sexpr{nmonth[5,3]} (\Sexpr{pmonth[5,3]}\%) & \Sexpr{nmonth[5,4]} (\Sexpr{pmonth[5,4]}\%) & \Sexpr{nmonth.rsv[5]} (\Sexpr{pmonth.rsv[5]}\%) \\ \hspace{.2in} June & \Sexpr{nmonth[6,1]} (\Sexpr{pmonth[6,1]}\%) & \Sexpr{nmonth[6,2]} (\Sexpr{pmonth[6,2]}\%) & \Sexpr{nmonth[6,3]} (\Sexpr{pmonth[6,3]}\%) & \Sexpr{nmonth[6,4]} (\Sexpr{pmonth[6,4]}\%) & \Sexpr{nmonth.rsv[6]} (\Sexpr{pmonth.rsv[6]}\%) \\ \hspace{.2in} July & \Sexpr{nmonth[7,1]} (\Sexpr{pmonth[7,1]}\%) & \Sexpr{nmonth[7,2]} (\Sexpr{pmonth[7,2]}\%) & \Sexpr{nmonth[7,3]} (\Sexpr{pmonth[7,3]}\%) & \Sexpr{nmonth[7,4]} (\Sexpr{pmonth[7,4]}\%) & \Sexpr{nmonth.rsv[7]} (\Sexpr{pmonth.rsv[7]}\%) \\ \hspace{.2in} August & \Sexpr{nmonth[8,1]} (\Sexpr{pmonth[8,1]}\%) & \Sexpr{nmonth[8,2]} (\Sexpr{pmonth[8,2]}\%) & \Sexpr{nmonth[8,3]} (\Sexpr{pmonth[8,3]}\%) & \Sexpr{nmonth[8,4]} (\Sexpr{pmonth[8,4]}\%) & \Sexpr{nmonth.rsv[8]} (\Sexpr{pmonth.rsv[8]}\%) \\ \hspace{.2in} September & \Sexpr{nmonth[9,1]} (\Sexpr{pmonth[9,1]}\%) & \Sexpr{nmonth[9,2]} (\Sexpr{pmonth[9,2]}\%) & \Sexpr{nmonth[9,3]} (\Sexpr{pmonth[9,3]}\%) & \Sexpr{nmonth[9,4]} (\Sexpr{pmonth[9,4]}\%) & \Sexpr{nmonth.rsv[9]} (\Sexpr{pmonth.rsv[9]}\%) \\ \hspace{.2in} October & \Sexpr{nmonth[10,1]} (\Sexpr{pmonth[10,1]}\%) & \Sexpr{nmonth[10,2]} (\Sexpr{pmonth[10,2]}\%) & \Sexpr{nmonth[10,3]} (\Sexpr{pmonth[10,3]}\%) & \Sexpr{nmonth[10,4]} (\Sexpr{pmonth[10,4]}\%) & \Sexpr{nmonth.rsv[10]} (\Sexpr{pmonth.rsv[10]}\%) \\ \hspace{.2in} November & \Sexpr{nmonth[11,1]} (\Sexpr{pmonth[11,1]}\%) & \Sexpr{nmonth[11,2]} (\Sexpr{pmonth[11,2]}\%) & \Sexpr{nmonth[11,3]} (\Sexpr{pmonth[11,3]}\%) & \Sexpr{nmonth[11,4]} (\Sexpr{pmonth[11,4]}\%) & \Sexpr{nmonth.rsv[11]} (\Sexpr{pmonth.rsv[11]}\%) \\ \hspace{.2in} December & \Sexpr{nmonth[12,1]} (\Sexpr{pmonth[12,1]}\%) & \Sexpr{nmonth[12,2]} (\Sexpr{pmonth[12,2]}\%) & \Sexpr{nmonth[12,3]} (\Sexpr{pmonth[12,3]}\%) & \Sexpr{nmonth[12,4]} (\Sexpr{pmonth[12,4]}\%) & \Sexpr{nmonth.rsv[12]} (\Sexpr{pmonth.rsv[12]}\%) \\ \\ Age (months)\tnote{e} &\Sexpr{sage1.tex} &\Sexpr{sage2.tex} &\Sexpr{sage3.tex} &\Sexpr{sage4.tex} &\Sexpr{sage.rsv.tex} & \Sexpr{pval.age1} & \Sexpr{pval.age2} & \Sexpr{pval.age.rsv}\\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] P-values compare HRV+ with Negative using Wilcoxon rank-sum or chi-square tests as appropriate. \item[b] P-values compare HRV+ with Other virus using Wilcoxon rank-sum or chi-square tests as appropriate. \item[c] P-values compare HRV+ with RSV+ using Wilcoxon rank-sum or chi-square tests as appropriate. \item[d] Median (IQR) among those hospitalized \item[e] Median (IQR) \item[f] Coinfection with HRV are only ones listed. \end{tablenotes} \end{threeparttable} <>= virus.type<-ifelse(b$virus==0,"Negative", ifelse(b$virus==10,"HRV", ifelse(b$virus>10,"Coinfection", ifelse(b$virus<10,"not HRV",99)))) rsv<-ifelse(b$virus==2,1,0) table(virus.type) nsev<-table(b$sev[b$hosp==1],virus.type[b$hosp==1]) psev<-matrix(NA,5,4) for (i in 1:5) { psev[i,]<-round(100*table(b$sev[b$hosp==1],virus.type[b$hosp==1])[i,]/table(virus.type[b$hosp==1])) } pval.sev1<-nicePvalTex(wilcox.test(b$sev[virus.type=="HRV"&b$hosp==1],b$sev[virus.type=="Negative"&b$hosp==1])$p.value) pval.sev2<-nicePvalTex(wilcox.test(b$sev[virus.type=="HRV"&b$hosp==1],b$sev[virus.type=="not HRV"&b$hosp==1])$p.value) nsev.rsv<-table(b$sev[b$hosp==1],rsv[b$hosp==1])[,2] psev.rsv<-round(100*nsev.rsv/sum(nsev.rsv)) pval.sev.rsv<-nicePvalTex(wilcox.test(b$sev[virus.type=="HRV"&b$hosp==1],b$sev[rsv==1&b$hosp==1])$p.value) shospdays1<-summary(b$hospdays[virus.type=="Coinfection"&b$hosp==1])[c(2,3,5)] shospdays2<-summary(b$hospdays[virus.type=="HRV"&b$hosp==1])[c(2,3,5)] shospdays3<-summary(b$hospdays[virus.type=="Negative"&b$hosp==1])[c(2,3,5)] shospdays4<-summary(b$hospdays[virus.type=="not HRV"&b$hosp==1])[c(2,3,5)] pval.hospdays1<-nicePvalTex(wilcox.test(b$hospdays[virus.type=="HRV"&b$hosp==1], b$hospdays[virus.type=="Negative"&b$hosp==1])$p.value) pval.hospdays2<-nicePvalTex(wilcox.test(b$hospdays[virus.type=="HRV"&b$hosp==1], b$hospdays[virus.type=="not HRV"&b$hosp==1])$p.value) shospdays1.tex<-paste(shospdays1[2]," (",shospdays1[1],", ",shospdays1[3],")", sep="") shospdays2.tex<-paste(shospdays2[2]," (",shospdays2[1],", ",shospdays2[3],")", sep="") shospdays3.tex<-paste(shospdays3[2]," (",shospdays3[1],", ",shospdays3[3],")", sep="") shospdays4.tex<-paste(shospdays4[2]," (",shospdays4[1],", ",shospdays4[3],")", sep="") shospdays.rsv<-summary(b$hospdays[rsv==1&b$hosp==1])[c(2,3,5)] pval.hospdays.rsv<-nicePvalTex(wilcox.test(b$hospdays[virus.type=="HRV"&b$hosp==1], b$hospdays[rsv==1&b$hosp==1])$p.value) shospdays.rsv.tex<-paste(shospdays.rsv[2]," (",shospdays.rsv[1],", ",shospdays.rsv[3],")", sep="") #table(b$hospdays~virus.type) table(b$ventdays[b$hosp==1],virus.type[b$hosp==1]) nvent<-table(b$ventdays[b$hosp==1]>0,virus.type[b$hosp==1])[2,] pvent<-round(100*table(b$ventdays[b$hosp==1]>0,virus.type[b$hosp==1])[2,]/table(virus.type[b$hosp==1])) pval.vent1<-nicePvalTex(chisq.test(table(b$ventdays[b$hosp==1]>0,virus.type[b$hosp==1])[,c(-1,-4)])$p.value) pval.vent2<-nicePvalTex(chisq.test(table(b$ventdays[b$hosp==1]>0,virus.type[b$hosp==1])[,c(-1,-3)])$p.value) table(b$ventdays[b$hosp==1],rsv[b$hosp==1]) nvent.rsv<-table(b$ventdays[b$hosp==1]>0,rsv[b$hosp==1])[2,2] pvent.rsv<-round(100*nvent.rsv/sum(table(b$ventdays[b$hosp==1]>0,rsv[b$hosp==1])[,2])) pval.vent.rsv<-nicePvalTex(chisq.test(cbind(table(b$ventdays[b$hosp==1]>0,virus.type[b$hosp==1])[,2],table(b$ventdays[b$hosp==1]>0,rsv[b$hosp==1])[,2]))$p.value) nwint<-table(b$winter[b$hosp==1],virus.type[b$hosp==1])[2,] pwint<-round(100*table(b$winter[b$hosp==1],virus.type[b$hosp==1])[2,]/table(virus.type[b$hosp==1])) pval.wint1<-nicePvalTex(chisq.test(table(b$winter[b$hosp==1],virus.type[b$hosp==1])[,c(-1,-4)])$p.value) pval.wint2<-nicePvalTex(chisq.test(table(b$winter[b$hosp==1],virus.type[b$hosp==1])[,c(-1,-3)])$p.value) nwint.rsv<-table(b$winter[b$hosp==1],rsv[b$hosp==1])[2,2] pwint.rsv<-round(100*nwint.rsv/sum(table(b$winter[b$hosp==1],rsv[b$hosp==1])[,2])) pval.wint.rsv<-nicePvalTex(chisq.test(cbind(table(b$winter[b$hosp==1],virus.type[b$hosp==1])[,2],table(b$winter[b$hosp==1],rsv[b$hosp==1])[,2]))$p.value) nmonth<-table(b$month[b$hosp==1],virus.type[b$hosp==1]) pmonth<-matrix(NA,12,4) for (i in 1:length(unique(b$month[b$hosp==1]))) { pmonth[i,]<-round(100*nmonth[i,]/table(virus.type[b$hosp==1])) } pval.month1<-nicePvalTex(chisq.test(table(b$month[b$hosp==1],virus.type[b$hosp==1])[-4,c(-1,-4)])$p.value) pval.month2<-nicePvalTex(chisq.test(table(b$month[b$hosp==1],virus.type[b$hosp==1])[c(-1,-2,-3),c(-1,-3)])$p.value) nmonth.rsv<-table(b$month[b$hosp==1],rsv[b$hosp==1])[,2] pmonth.rsv<-round(100*nmonth.rsv/sum(table(b$month[b$hosp==1],rsv[b$hosp==1])[,2])) pval.month.rsv<-nicePvalTex(chisq.test(cbind(table(b$month[b$hosp==1],virus.type[b$hosp==1])[,2],table(b$month[b$hosp==1],rsv[b$hosp==1])[,2])[c(-1,-2,-3,-7)])$p.value) sage1<-summary(b$age[virus.type=="Coinfection"&b$hosp==1])[c(2,3,5)] sage2<-summary(b$age[virus.type=="HRV"&b$hosp==1])[c(2,3,5)] sage3<-summary(b$age[virus.type=="Negative"&b$hosp==1])[c(2,3,5)] sage4<-summary(b$age[virus.type=="not HRV"&b$hosp==1])[c(2,3,5)] pval.age1<-nicePvalTex(wilcox.test(b$age[virus.type=="HRV"&b$hosp==1],b$age[virus.type=="Negative"&b$hosp==1])$p.value) pval.age2<-nicePvalTex(wilcox.test(b$age[virus.type=="HRV"&b$hosp==1],b$age[virus.type=="not HRV"&b$hosp==1])$p.value) sage1.tex<-paste(sage1[2]," (",sage1[1],", ",sage1[3],")", sep="") sage2.tex<-paste(sage2[2]," (",sage2[1],", ",sage2[3],")", sep="") sage3.tex<-paste(sage3[2]," (",sage3[1],", ",sage3[3],")", sep="") sage4.tex<-paste(sage4[2]," (",sage4[1],", ",sage4[3],")", sep="") sage.rsv<-summary(b$age[rsv==1&b$hosp==1])[c(2,3,5)] pval.age.rsv<-nicePvalTex(wilcox.test(b$age[virus.type=="HRV"&b$hosp==1],b$age[rsv==1&b$hosp==1])$p.value) sage.rsv.tex<-paste(sage.rsv[2]," (",sage.rsv[1],", ",sage.rsv[3],")", sep="") @ \bigskip \bigskip \bigskip \begin{threeparttable} \caption{Comparison of hospitalizations by viral etiology. (I DON'T TRUST PVALUES BECAUSE OF SMALL NUMBERS)} \centering{ \begin{tabular}{llllllllll} \hline \\ & Coinfection\tnote{f} & HRV+ & Negative & Other virus & RSV+ & P-value\tnote{a} & P-value\tnote{b} & P-value\tnote{c} \\ & (n=\Sexpr{table(virus.type[b$hosp==1])[1]}) & (n=\Sexpr{table(virus.type[b$hosp==1])[2]}) & (n=\Sexpr{table(virus.type[b$hosp==1])[3]}) & (n=\Sexpr{table(virus.type[b$hosp==1])[4]}) & (n=\Sexpr{sum(rsv[b$hosp==1],na.rm=TRUE)}) \\ \hline \\ Severity & & & & & & \Sexpr{pval.sev1} & \Sexpr{pval.sev2} & \Sexpr{pval.sev.rsv} \\ \hspace{.2in} 1 & \Sexpr{nsev[1,1]} (\Sexpr{psev[1,1]}\%) & \Sexpr{nsev[1,2]} (\Sexpr{psev[1,2]}\%) & \Sexpr{nsev[1,3]} (\Sexpr{psev[1,3]}\%) & \Sexpr{nsev[1,4]} (\Sexpr{psev[1,4]}\%) & \Sexpr{nsev.rsv[1]} (\Sexpr{psev.rsv[1]}\%) \\ \hspace{.2in} 2 & \Sexpr{nsev[2,1]} (\Sexpr{psev[2,1]}\%) & \Sexpr{nsev[2,2]} (\Sexpr{psev[2,2]}\%) & \Sexpr{nsev[2,3]} (\Sexpr{psev[2,3]}\%) & \Sexpr{nsev[2,4]} (\Sexpr{psev[2,4]}\%) & \Sexpr{nsev.rsv[2]} (\Sexpr{psev.rsv[2]}\%) \\ \hspace{.2in} 3 & \Sexpr{nsev[3,1]} (\Sexpr{psev[3,1]}\%) & \Sexpr{nsev[3,2]} (\Sexpr{psev[3,2]}\%) & \Sexpr{nsev[3,3]} (\Sexpr{psev[3,3]}\%) & \Sexpr{nsev[3,4]} (\Sexpr{psev[3,4]}\%) & \Sexpr{nsev.rsv[3]} (\Sexpr{psev.rsv[3]}\%) \\ \hspace{.2in} 4 & \Sexpr{nsev[4,1]} (\Sexpr{psev[4,1]}\%) & \Sexpr{nsev[4,2]} (\Sexpr{psev[4,2]}\%) & \Sexpr{nsev[4,3]} (\Sexpr{psev[4,3]}\%) & \Sexpr{nsev[4,4]} (\Sexpr{psev[4,4]}\%) & \Sexpr{nsev.rsv[4]} (\Sexpr{psev.rsv[4]}\%) \\ \hspace{.2in} 5 & \Sexpr{nsev[5,1]} (\Sexpr{psev[5,1]}\%) & \Sexpr{nsev[5,2]} (\Sexpr{psev[5,2]}\%) & \Sexpr{nsev[5,3]} (\Sexpr{psev[5,3]}\%) & \Sexpr{nsev[5,4]} (\Sexpr{psev[5,4]}\%) & \Sexpr{nsev.rsv[5]} (\Sexpr{psev.rsv[5]}\%) \\ \\ \hspace{.2in} Days Hospitalized\tnote{d} &\Sexpr{shospdays1.tex} &\Sexpr{shospdays2.tex} &\Sexpr{shospdays3.tex} &\Sexpr{shospdays4.tex} & \Sexpr{shospdays.rsv.tex} & \Sexpr{pval.hospdays1} & \Sexpr{pval.hospdays2} & \Sexpr{pval.hospdays.rsv} \\ \\ Ventilator & \Sexpr{nvent[1]} (\Sexpr{pvent[1]}\%) & \Sexpr{nvent[2]} (\Sexpr{pvent[2]}\%) & \Sexpr{nvent[3]} (\Sexpr{pvent[3]}\%) & \Sexpr{nvent[4]} (\Sexpr{pvent[4]}\%) & \Sexpr{nvent.rsv} (\Sexpr{pvent.rsv}\%) & \Sexpr{pval.vent1} & \Sexpr{pval.vent2} & \Sexpr{pval.vent.rsv} \\ \\ %\hspace{.2in} Days on Ventilator \\ Winter & \Sexpr{nwint[1]} (\Sexpr{pwint[1]}\%) & \Sexpr{nwint[2]} (\Sexpr{pwint[2]}\%) & \Sexpr{nwint[3]} (\Sexpr{pwint[3]}\%) & \Sexpr{nwint[4]} (\Sexpr{pwint[4]}\%) & \Sexpr{nwint.rsv} (\Sexpr{pwint.rsv}\%) & \Sexpr{pval.wint1} & \Sexpr{pval.wint2} & \Sexpr{pval.wint.rsv} \\ \\ Month & & & & & & \Sexpr{pval.month1} & \Sexpr{pval.month2} & \Sexpr{pval.month.rsv} \\ \hspace{.2in} January & 0 (0\%) & 0 (0\%) & 0 (0\%) & 0 (0\%) & 0 (0\%) \\ \hspace{.2in} February & \Sexpr{nmonth[1,1]} (\Sexpr{pmonth[1,1]}\%) & \Sexpr{nmonth[1,2]} (\Sexpr{pmonth[1,2]}\%) & \Sexpr{nmonth[1,3]} (\Sexpr{pmonth[1,3]}\%) & \Sexpr{nmonth[1,4]} (\Sexpr{pmonth[1,4]}\%) & \Sexpr{nmonth.rsv[1]} (\Sexpr{pmonth.rsv[1]}\%) \\ \hspace{.2in} March & \Sexpr{nmonth[2,1]} (\Sexpr{pmonth[2,1]}\%) & \Sexpr{nmonth[2,2]} (\Sexpr{pmonth[2,2]}\%) & \Sexpr{nmonth[2,3]} (\Sexpr{pmonth[2,3]}\%) & \Sexpr{nmonth[2,4]} (\Sexpr{pmonth[2,4]}\%) & \Sexpr{nmonth.rsv[2]} (\Sexpr{pmonth.rsv[2]}\%) \\ \hspace{.2in} April & \Sexpr{nmonth[3,1]} (\Sexpr{pmonth[3,1]}\%) & \Sexpr{nmonth[3,2]} (\Sexpr{pmonth[3,2]}\%) & \Sexpr{nmonth[3,3]} (\Sexpr{pmonth[3,3]}\%) & \Sexpr{nmonth[3,4]} (\Sexpr{pmonth[3,4]}\%) & \Sexpr{nmonth.rsv[3]} (\Sexpr{pmonth.rsv[3]}\%) \\ \hspace{.2in} May & \Sexpr{nmonth[4,1]} (\Sexpr{pmonth[4,1]}\%) & \Sexpr{nmonth[4,2]} (\Sexpr{pmonth[4,2]}\%) & \Sexpr{nmonth[4,3]} (\Sexpr{pmonth[4,3]}\%) & \Sexpr{nmonth[4,4]} (\Sexpr{pmonth[4,4]}\%) & \Sexpr{nmonth.rsv[4]} (\Sexpr{pmonth.rsv[4]}\%) \\ \hspace{.2in} June & \Sexpr{nmonth[5,1]} (\Sexpr{pmonth[5,1]}\%) & \Sexpr{nmonth[5,2]} (\Sexpr{pmonth[5,2]}\%) & \Sexpr{nmonth[5,3]} (\Sexpr{pmonth[5,3]}\%) & \Sexpr{nmonth[5,4]} (\Sexpr{pmonth[5,4]}\%) & \Sexpr{nmonth.rsv[5]} (\Sexpr{pmonth.rsv[5]}\%) \\ \hspace{.2in} July & \Sexpr{nmonth[6,1]} (\Sexpr{pmonth[6,1]}\%) & \Sexpr{nmonth[6,2]} (\Sexpr{pmonth[6,2]}\%) & \Sexpr{nmonth[6,3]} (\Sexpr{pmonth[6,3]}\%) & \Sexpr{nmonth[6,4]} (\Sexpr{pmonth[6,4]}\%) & \Sexpr{nmonth.rsv[6]} (\Sexpr{pmonth.rsv[6]}\%) \\ \hspace{.2in} August & \Sexpr{nmonth[7,1]} (\Sexpr{pmonth[7,1]}\%) & \Sexpr{nmonth[7,2]} (\Sexpr{pmonth[7,2]}\%) & \Sexpr{nmonth[7,3]} (\Sexpr{pmonth[7,3]}\%) & \Sexpr{nmonth[7,4]} (\Sexpr{pmonth[7,4]}\%) & \Sexpr{nmonth.rsv[7]} (\Sexpr{pmonth.rsv[7]}\%) \\ \hspace{.2in} September & \Sexpr{nmonth[8,1]} (\Sexpr{pmonth[8,1]}\%) & \Sexpr{nmonth[8,2]} (\Sexpr{pmonth[8,2]}\%) & \Sexpr{nmonth[8,3]} (\Sexpr{pmonth[8,3]}\%) & \Sexpr{nmonth[8,4]} (\Sexpr{pmonth[8,4]}\%) & \Sexpr{nmonth.rsv[8]} (\Sexpr{pmonth.rsv[8]}\%) \\ \hspace{.2in} October & \Sexpr{nmonth[9,1]} (\Sexpr{pmonth[9,1]}\%) & \Sexpr{nmonth[9,2]} (\Sexpr{pmonth[9,2]}\%) & \Sexpr{nmonth[9,3]} (\Sexpr{pmonth[9,3]}\%) & \Sexpr{nmonth[9,4]} (\Sexpr{pmonth[9,4]}\%) & \Sexpr{nmonth.rsv[9]} (\Sexpr{pmonth.rsv[9]}\%) \\ \hspace{.2in} November & \Sexpr{nmonth[10,1]} (\Sexpr{pmonth[10,1]}\%) & \Sexpr{nmonth[10,2]} (\Sexpr{pmonth[10,2]}\%) & \Sexpr{nmonth[10,3]} (\Sexpr{pmonth[10,3]}\%) & \Sexpr{nmonth[10,4]} (\Sexpr{pmonth[10,4]}\%) & \Sexpr{nmonth.rsv[10]} (\Sexpr{pmonth.rsv[10]}\%) \\ \hspace{.2in} December & 0 (0\%) & 0 (0\%) & 0 (0\%) & 0 (0\%) & 0 (0\%) \\ Age (months)\tnote{e} &\Sexpr{sage1.tex} &\Sexpr{sage2.tex} &\Sexpr{sage3.tex} &\Sexpr{sage4.tex} &\Sexpr{sage.rsv.tex} & \Sexpr{pval.age1} & \Sexpr{pval.age2} & \Sexpr{pval.age.rsv}\\ \\ \hline \end{tabular} } \begin{tablenotes} \item[a] P-values compare HRV+ with Negative using Wilcoxon rank-sum or chi-square tests as appropriate. \item[b] P-values compare HRV+ with Other virus using Wilcoxon rank-sum or chi-square tests as appropriate. \item[c] P-values compare HRV+ with RSV+ using Wilcoxon rank-sum or chi-square tests as appropriate. \item[d] Median (IQR) among those hospitalized \item[e] Median (IQR) \item[f] Coinfection with HRV are only ones listed. \end{tablenotes} \end{threeparttable} \bigskip Of the \Sexpr{table(virus.type[b$hosp==1])[1]} hospitalizations with co-infections, \Sexpr{sum(b$virus[virus.type=="Coinfection"&b$hosp==1]==12)} were co-infection between RSV and HRV, and \Sexpr{sum(b$virus[virus.type=="Coinfection"&b$hosp==1]==13)} was a co-infection between RSV and HMPV. <>= bro<-with(b, ifelse(diag==4|diag==7,1,0)) hrv.pos<-ifelse(b$virus==10|b$virus==12|b$virus==13|b$virus==14,1,0) rsv.pos<-ifelse(b$virus==2|b$virus==12,1,0) id<-b$id age<-b$age unique.id<-unique(id) first.rsv<-first.hrv<-first.episode<-NULL for (i in 1:length(unique.id)) { first.rsv[i]<-min(age[id==unique.id[i]&rsv.pos==1]) first.hrv[i]<-min(age[id==unique.id[i]&hrv.pos==1]) first.episode[i]<-min(age[id==unique.id[i]]) } summary.age.rsv<-summary(first.rsv[first.rsv<10000]) ### Getting rid of the infinites summary.age.hrv<-summary(first.hrv[first.hrv<10000]) summary.age.episode<-summary(first.episode[first.episode<10000]) wilcox.test(first.rsv[first.rsv<10000],first.hrv[first.hrv<10000]) table(b$virus) table(b$virus[b$hosp==1]) table(b$virus[bro==1]) @ \end{document}