Solution: anti-fungal treatment exercise
|
|
- Kory Austin
- 5 years ago
- Views:
Transcription
1 Solution: anti-fungal treatment exercise Course repeated measurements - R exercise class 5 December 5, 2017 Contents 1 Question 1: Import data Data management Inspection of the dataset Computation of the prevalence Question 2: Scheduled vs. observed visit times 6 3 Question 3: Population average model Definition of the interaction Model fitting Inference Display of the fitted prevalence Question 4: Continuous time population average model Model fitting Inference Question 6: Subject specific model with random intercept Fitting the model Inference Question 7: Subject specific model with random intercept and random slope Model fitting Inference NOTE: This document contains an example of R code and related software outputs that answers the questions of the exercise. The focus is here on the implementation using the R software and not on the interpretation - we refer to the SAS solution for a more detailed discussion of the results. 1
2 Load the packages that will be necessary for the analysis: library(data.table) # data management library(lme4) # subject specific model library(geepack) # population average models library(doby) # esticon function library(ggplot2) # graphical display 1 Question 1: Import data 1.1 Data management We first specify the location of the data through a variable called path.data: path.data <- " jufo/courses/rm2017/onycholysis.txt" Then we use the function fread to import the dataset: dtw.ony <- fread(path.data, header = TRUE, na.strings = ".") str(dtw.ony) Classes data.table and data.frame : 294 obs. of 16 variables: $ id : int $ treatment: int $ response1: int $ time1 : int $ response2: int $ time2 : num $ response3: int $ time3 : num $ response4: int $ time4 : num $ response5: int $ time5 : num $ response6: int $ time6 : num $ response7: int 0 NA $ time7 : num 13.1 NA attr(*, ".internal.selfref")=<externalptr> [optional] We ensure that all time variables are of type numeric by converting time1 from integer to numeric: dtw.ony[, time1 := as.double(time1)] 2
3 We convert the dataset to the long format: dtl.ony <- melt(dtw.ony, id.vars = c("id","treatment"), measure.vars = list(paste0("time",1:7), paste0("response",1:7)), value.name = c("time","response"), variable.name = "visit") str(dtl.ony) Classes data.table and data.frame : 2058 obs. of 5 variables: $ id : int $ treatment: int $ visit : Factor w/ 7 levels "1","2","3","4",..: $ time : num $ response : int attr(*, ".internal.selfref")=<externalptr> We convert the id and treatment variables to factor: dtl.ony[, id := as.factor(id)] dtl.ony[, treatment := factor(treatment, levels = 0:1, labels = c("200mg","250mg"))] We also add to the dataset the scheduled visit times: dtl.ony[, expected.timeweek := as.numeric(na)] dtl.ony[visit=="1", expected.timeweek := 0] dtl.ony[visit=="2", expected.timeweek := 4] dtl.ony[visit=="3", expected.timeweek := 8] dtl.ony[visit=="4", expected.timeweek := 12] dtl.ony[visit=="5", expected.timeweek := 24] dtl.ony[visit=="6", expected.timeweek := 36] dtl.ony[visit=="7", expected.timeweek := 48] and create a new visit variable, visit.num, which indexes the visit with numbers (and not characters): dtl.ony[,visit.num := as.numeric(visit)] 3
4 1.2 Inspection of the dataset The summary method provides useful information about the dataset: summary(dtl.ony) id treatment visit time response expected.timeweek visit.num 1 : 7 200mg:1022 1:294 Min. : Min. : Min. : 0.00 Min. :1 2 : 7 250mg:1036 2:294 1st Qu.: st Qu.: st Qu.: st Qu.:2 3 : 7 3:294 Median : Median : Median :12.00 Median :4 4 : 7 4:294 Mean : Mean : Mean :18.86 Mean :4 6 : 7 5:294 3rd Qu.: rd Qu.: rd Qu.: rd Qu.:6 7 : 7 6:294 Max. : Max. : Max. :48.00 Max. :7 (Other):2016 7:294 NA s :150 NA s :150 We see 294 patients, each having 7 visits. However we also have 150 missing values for time and response so the data is not available for all the visits. A closer inspection of the treatment variable: dtl.ony[,print(c(visit =.GRP, table(treatment))), by = "visit"] Empty data.table (0 rows) of 1 col: visit shows that the treatment variable is in reality the group variable. setnames(dtl.ony, old = "treatment", new = "group") The treatment variable is the group variable except at baseline where we assume that 200mg was given to all patients: dtl.ony[, treatment := as.character(group)] dtl.ony[visit == "1", treatment := "200mg"] dtl.ony[, treatment := as.factor(treatment)] 4
5 We can check that we obtain the expected variable: dtl.ony[,print(c(visit =.GRP, table(treatment))), by = "visit"] Empty data.table (0 rows) of 1 col: visit 1.3 Computation of the prevalence dtl.ony[,.(n.row =.N, n.obs = sum(!is.na(response)), n.response = sum(response, na.rm = TRUE), prevalence = mean(response, na.rm = TRUE)), by = c("group","visit")] group visit n.row n.obs n.response prevalence 1: 250mg : 200mg : 250mg : 200mg : 250mg : 200mg : 250mg : 200mg : 250mg : 200mg : 250mg : 200mg : 250mg : 200mg
6 2 Question 2: Scheduled vs. observed visit times Given that a year contains 52 weeks and 12 months, we convert the time variable from months to weeks using: dtl.ony[,timeweek := time * 52 / 12] We can then compute the quantiles of the observed visit times and compare them to the expected ones: dtl.ony[,.("expected" = expected.timeweek[1], "observed (median)" = median(timeweek, na.rm = TRUE), "observed (min)" = min(timeweek, na.rm = TRUE), "observed (max)" = max(timeweek, na.rm = TRUE)), by = c("visit","group")] visit group expected observed (median) observed (min) observed (max) 1: 1 250mg : 1 200mg : 2 250mg : 2 200mg : 3 250mg : 3 200mg : 4 250mg : 4 200mg : 5 250mg : 5 200mg : 6 250mg : 6 200mg : 7 250mg : 7 200mg We can also provide a graphical display: gg.time <- ggplot(dtl.ony, aes(x = as.factor(visit))) gg.time <- gg.time + geom_line(aes(y = expected.timeweek, group = "expected", size = "expected")) gg.time <- gg.time + geom_boxplot(aes(y = timeweek, color = as.factor(response))) gg.time <- gg.time + labs(x = "visit", y = "time (weeks)", color = "response", size = "") gg.time 6
7 visit time (weeks) response 0 1 expected 3 Question 3: Population average model 3.1 Definition of the interaction We first consider the mean effects. Due to baseline adjustement the design matrix including an interaction is not of full rank: X <- model.matrix( treatment * visit, data = dtl.ony) groupeffect <- X[,"treatment250mg"] interaction <- rowsums(x[,paste0("treatment250mg:visit",2:7)]) range(interaction-groupeffect) [1] 0 0 Indeed there should not be a treatment effect at baseline. To solve that we can create manually an interaction variable: 7
8 dtl.ony[, treatmentivisit := paste0(treatment,visit)] dtl.ony[treatment == "200mg", treatmentivisit := "baseline"] dtl.ony[visit == 1, treatmentivisit := "baseline"] We specify convert the new variable to factor specifying that baseline is the reference level: dtl.ony[, treatmentivisit := relevel(as.factor(treatmentivisit),"baseline")] 8
9 We can check that this variable gives the expected values: dtl.ony[,table(treatmentivisit,visit,group)],, group = 200mg visit treatmentivisit baseline mg mg mg mg mg mg ,, group = 250mg visit treatmentivisit baseline mg mg mg mg mg mg Model fitting According to the documentation of the geeglm function "Data are assumed to be sorted so that observations on a cluster are contiguous rows for all entities in the formula" so we need to reorder by id. To be safe, we also reorder by visit. setkeyv(dtl.ony, c("id","visit")) dtl.ony[1:10] id group visit time response expected.timeweek visit.num treatment timeweek treatmentivisit 1: 1 250mg mg baseline 2: 1 250mg mg mg2 3: 1 250mg mg mg3 4: 1 250mg mg mg4 5: 1 250mg mg mg5 6: 1 250mg mg mg6 7: 1 250mg mg mg7 8: 2 200mg mg baseline 9: 2 200mg mg baseline 10: 2 200mg mg baseline 9
10 We are now ready to fit the model: gee.un <- geeglm(response visit + treatmentivisit, id = id, data = dtl.ony, family = binomial(link = "logit"), corstr = "unstructured") Compared to "standard" mixed models, population average models are not estimated by maximum likelihood and therefore loglik cannot return the value of the likelihood: loglik(gee.un) log Lik. (df=13) We can still use summary to obtain display the model coefficients: summary(gee.un)$coefficients Estimate Std.err Wald Pr(> W ) (Intercept) e-06 visit e-01 visit e-02 visit e-04 visit e-08 visit e-09 visit e-08 treatmentivisit250mg e-01 treatmentivisit250mg e-01 treatmentivisit250mg e-01 treatmentivisit250mg e-01 treatmentivisit250mg e-01 treatmentivisit250mg e-02 A manual extraction is necessary to obtain the correlation matrix: corr.coef <- summary(gee.un)$corr[,"estimate"] n.corr.coef <- length(corr.coef) Mcorr <- matrix(na, 7, 7) Mcorr[lower.tri(Mcorr)] <- corr.coef Mcorr [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] NA NA NA NA NA NA NA [2,] NA NA NA NA NA NA [3,] NA NA NA NA NA [4,] NA NA NA NA [5,] NA NA NA [6,] NA NA [7,] NA 10
11 A more reliable extraction could be done by reading the position of the coefficients from their names instead of assuming they follow a specific order: name.corr.coef <- rownames(summary(gee.un)$corr) ls.position.corr.coef <- strsplit(gsub("alpha.","",name.corr.coef),":") position.corr.coef <- do.call(rbind,lapply(ls.position.corr.coef, as.numeric)) rownames(position.corr.coef) <- name.corr.coef colnames(position.corr.coef) <- c("row","column") position.corr.coef[1:10,] row column alpha.1:2 1 2 alpha.1:3 1 3 alpha.1:4 1 4 alpha.1:5 1 5 alpha.1:6 1 6 alpha.1:7 1 7 alpha.2:3 2 3 alpha.2:4 2 4 alpha.2:5 2 5 alpha.2: Inference We can compute odd ratios as the exponential of the coefficients: ORvisit7 <- exp(coef(gee.un)["visit7"]) ORvisit7 visit We can also compute the confidence intervals for the coefficients from the standard errors given in the summary: beta.visit7 <- summary(gee.un)$coef["visit7","estimate"] betase.visit7 <- summary(gee.un)$coef["visit7","std.err"] quantile.norm <- qnorm(c(lower = 0.025, estimate = 0.5, upper = 0.975)) CI.visit7 <- exp(beta.visit7 + quantile.norm * betase.visit7) CI.visit7 lower estimate upper
12 Automatic computation of the standard errors for any linear combination of the coefficients can be obtained using the esticon function of the doby package. First a need to create a contrast matrix encoding the linear combinations we are interested in: name.coef <- names(coef(gee.un)) n.coef <- length(name.coef) C <- matrix(0, nrow = 3, ncol = n.coef, dimnames = list(c("diffp-200mg","diffp-250mg","treatment-lastvisit"), name.coef)) C["diffP-200mg","visit7"] <- 1 C["diffP-250mg",c("visit7","treatmentIvisit250mg7")] <- c(1,1) C["treatment-lastVisit","treatmentIvisit250mg7"] <- 1 C (Intercept) visit2 visit3 visit4 visit5 visit6 visit7 treatmentivisit250mg2 diffp-200mg diffp-250mg treatment-lastvisit treatmentivisit250mg3 treatmentivisit250mg4 treatmentivisit250mg5 treatmentivisit250mg6 diffp-200mg diffp-250mg treatment-lastvisit treatmentivisit250mg7 diffp-200mg 0 diffp-250mg 1 treatment-lastvisit 1 Then we can apply esticon to obtain the punctual estimate and the standard errors relative to each linear combination: resc <- esticon(gee.un, cm = C, conf.int = TRUE, joint.test = FALSE) resc beta0 Estimate Std.Error X2.value DF Pr(> X^2 ) Lower Upper diffp-200mg diffp-250mg treatment-lastvisit and then applying the exponential function to obtain the odd ratios with their confidence intervals: OR.CI <- cbind(exp(resc[,c("estimate","lower","upper")]), p.value = resc[,"pr(> X^2 )"]) OR.CI Estimate Lower Upper p.value diffp-200mg diffp-250mg treatment-lastvisit
13 We can also compare the present model to the model without treatment effect using a Wald test: gee.un0 <- geeglm(response visit, id = id, data = dtl.ony, family = binomial(link = "logit"), corstr = "unstructured") anova(gee.un0,gee.un) Analysis of Wald statistic Table Model 1 response ~ visit + treatmentivisit Model 2 response ~ visit Df X2 P(> Chi ) So there is no evidence for a treatment effect. 3.4 Display of the fitted prevalence We can obtain the fitted values using fitted: fitted.values <- fitted(gee.un) length(fitted.values) [1] 1908 The number of fitted values matches the number of non missing observations: dtl.ony[!is.na(response),.n] [1] 1908 So we can store the fitted values in the original dataset, excluding the rows corresponding to missing observations: dtl.ony[!is.na(response), fitted := fitted.values] We can then plot the fitted values by group: gg.gee <- ggplot(dtl.ony[!is.na(response)], aes(x = expected.timeweek, y = fitted, group = group, color = group)) gg.gee <- gg.gee + geom_point() + geom_line() gg.gee <- gg.gee + labs(x = "expected visit time (weeks)", y = "fitted prevalence", color = "treatment group") gg.gee 13
14 expected visit time (weeks) fitted prevalence treatment group 200mg 250mg We can make the same plot on the logit scale: dtl.ony[!is.na(response), fitted.logit := log(fitted.values/(1-fitted.values))] gg.gee_logit <- ggplot(dtl.ony[!is.na(response)], aes(x = expected.timeweek, y = fitted.logit, group = group, color = group)) gg.gee_logit <- gg.gee_logit + geom_point() + geom_line() gg.gee_logit <- gg.gee_logit + labs(x = "expected visit time (weeks)", y = "logit(fitted prevalence)", color = "treatment group") gg.gee_logit 14
15 expected visit time (weeks) logit(fitted prevalence) treatment group 200mg 250mg 4 Question 4: Continuous time population average model 4.1 Model fitting geecont.un <- geeglm(response treatment:time, id = id, data = dtl.ony[visit.num < 6], family = binomial(link = "logit"), corstr = "unstructured") summary(geecont.un)$coef Estimate Std.err Wald Pr(> W ) (Intercept) e-07 treatment200mg:time e-08 treatment250mg:time e-09 15
16 4.2 Inference name.coef <- names(coef(geecont.un)) n.coef <- length(name.coef) C2 <- matrix(0, nrow = 3, ncol = n.coef, dimnames = list(c("200mg/month","250mg/month","250mg vs. 200mg/month"), name.coef)) C2["200mg/month","treatment200mg:time"] <- 1 C2["250mg/month","treatment250mg:time"] <- 1 C2["250mg vs. 200mg/month",c("treatment250mg:time","treatment200mg:time")] <- c(1,-1) C2 (Intercept) treatment200mg:time treatment250mg:time 200mg/month mg/month mg vs. 200mg/month resc2 <- esticon(geecont.un, cm = C2, conf.int = TRUE, joint.test = FALSE) OR.CI2 <- cbind(exp(resc2[,c("estimate","lower","upper")]), p.value = resc2[,"pr(> X^2 )"]) OR.CI2 Estimate Lower Upper p.value 200mg/month mg/month mg vs. 200mg/month
17 5 Question 6: Subject specific model with random intercept 5.1 Fitting the model glmer.intercept <- glmer(formula = response time:treatment + (1 id), data = dtl.ony[visit.num < 6], family = binomial(link = "logit")) loglik(glmer.intercept) log Lik (df=4) summary(glmer.intercept)$coef Estimate Std. Error z value Pr(> z ) (Intercept) e-31 time:treatment200mg e-12 time:treatment250mg e-14 VarCorr(glmer.intercept) Groups Name Std.Dev. id (Intercept) Inference Using the approach proposed for objects estimated with the geeglm function, we obtain: name.coef <- names(fixef(glmer.intercept)) n.coef <- length(name.coef) C3 <- matrix(0, nrow = 3, ncol = n.coef, dimnames = list(c("200mg/month","250mg/month","250mg vs. 200mg/month"), name.coef)) C3["200mg/month",c("time:treatment200mg")] <- 1 C3["250mg/month",c("time:treatment250mg")] <- 1 C3["250mg vs. 200mg/month",c("time:treatment250mg","time:treatment200mg")] <- c(1,-1) C3 (Intercept) time:treatment200mg time:treatment250mg 200mg/month mg/month mg vs. 200mg/month
18 resc3 <- resc3 esticon(glmer.intercept, cm = C3, conf.int = TRUE, joint.test = FALSE) beta0 Estimate Std.Error X2.value DF Pr(> X^2 ) Lower Upper 200mg/month mg/month mg vs. 200mg/month OR.CI3 <- cbind(exp(resc3[,c("estimate","lower","upper")]), p.value = resc3[,"pr(> X^2 )"]) OR.CI3 Estimate Lower Upper p.value 200mg/month mg/month mg vs. 200mg/month Note: method. Confidence intervals about the parameters can also be obtained using the confint CI.confint <- confint(glmer.intercept, method="wald") CI.confint 2.5 % 97.5 %.sig01 NA NA (Intercept) time:treatment200mg time:treatment250mg Here we use set the argument method to "Wald" to save computation time but the default option "profile" should give more reliable confidence intervals. Confidence interval for the odd ratios can be obtain by applying the exponential function: exp(ci.confint) 2.5 % 97.5 %.sig01 NA NA (Intercept) time:treatment200mg time:treatment250mg
19 6 Question 7: Subject specific model with random intercept and random slope 6.1 Model fitting system.time( glmer.slope <- glmer(formula = response time:treatment + (time id), data = dtl.ony[visit.num < 6], family = binomial(link = "logit")) ) loglik(glmer.slope) user system elapsed log Lik (df=6) summary(glmer.slope)$coef Estimate Std. Error z value Pr(> z ) (Intercept) e-40 time:treatment200mg e-12 time:treatment250mg e-15 VarCorr(glmer.slope) Groups Name Std.Dev. Corr id (Intercept) time Inference name.coef <- names(fixef(glmer.slope)) n.coef <- length(name.coef) C4 <- matrix(0, nrow = 3, ncol = n.coef, dimnames = list(c("200mg/month","250mg/month","250mg vs. 200mg/month"), name.coef)) C4["200mg/month",c("time:treatment200mg")] <- 1 C4["250mg/month",c("time:treatment250mg")] <- 1 C4["250mg vs. 200mg/month",c("time:treatment250mg","time:treatment200mg")] <- c(1,-1) C4 (Intercept) time:treatment200mg time:treatment250mg 200mg/month mg/month mg vs. 200mg/month
20 resc4 <- resc4 esticon(glmer.slope, cm = C4, conf.int = TRUE, joint.test = FALSE) beta0 Estimate Std.Error X2.value DF Pr(> X^2 ) Lower Upper 200mg/month mg/month mg vs. 200mg/month OR.CI4 <- cbind(exp(resc4[,c("estimate","lower","upper")]), p.value = resc4[,"pr(> X^2 )"]) OR.CI4 Estimate Lower Upper p.value 200mg/month e e mg/month e e mg vs. 200mg/month e e
Solution Anti-fungal treatment (R software)
Contents Solution Anti-fungal treatment (R software) Question 1: Data import 2 Question 2: Compliance with the timetable 4 Question 3: population average model 5 Question 4: continuous time model 9 Question
More informationSolution pigs exercise
Solution pigs exercise Course repeated measurements - R exercise class 2 November 24, 2017 Contents 1 Question 1: Import data 3 1.1 Data management..................................... 3 1.2 Inspection
More informationFitting mixed models in R
Fitting mixed models in R Contents 1 Packages 2 2 Specifying the variance-covariance matrix (nlme package) 3 2.1 Illustration:.................................... 3 2.2 Technical point: why to use as.numeric(time)
More informationA Handbook of Statistical Analyses Using R 2nd Edition. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R 2nd Edition Brian S. Everitt and Torsten Hothorn CHAPTER 12 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues
More informationA Handbook of Statistical Analyses Using R 2nd Edition. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R 2nd Edition Brian S. Everitt and Torsten Hothorn CHAPTER 12 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues
More informationA Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn
A Handbook of Statistical Analyses Using R Brian S. Everitt and Torsten Hothorn CHAPTER 10 Analysing Longitudinal Data I: Computerised Delivery of Cognitive Behavioural Therapy Beat the Blues 10.1 Introduction
More informationIntroduction to SAS proc mixed
Faculty of Health Sciences Introduction to SAS proc mixed Analysis of repeated measurements, 2017 Julie Forman Department of Biostatistics, University of Copenhagen 2 / 28 Preparing data for analysis The
More informationIntroductory Statistics with R: Simple Inferences for continuous data
Introductory Statistics with R: Simple Inferences for continuous data Statistical Packages STAT 1301 / 2300, Fall 2014 Sungkyu Jung Department of Statistics University of Pittsburgh E-mail: sungkyu@pitt.edu
More informationlme4 Luke Chang Last Revised July 16, Fitting Linear Mixed Models with a Varying Intercept
lme4 Luke Chang Last Revised July 16, 2010 1 Using lme4 1.1 Fitting Linear Mixed Models with a Varying Intercept We will now work through the same Ultimatum Game example from the regression section and
More informationIntroduction and Background to Multilevel Analysis
Introduction and Background to Multilevel Analysis Dr. J. Kyle Roberts Southern Methodist University Simmons School of Education and Human Development Department of Teaching and Learning Background and
More informationIntroduction to SAS proc mixed
Faculty of Health Sciences Introduction to SAS proc mixed Analysis of repeated measurements, 2017 Julie Forman Department of Biostatistics, University of Copenhagen Outline Data in wide and long format
More informationSTAT3401: Advanced data analysis Week 10: Models for Clustered Longitudinal Data
STAT3401: Advanced data analysis Week 10: Models for Clustered Longitudinal Data Berwin Turlach School of Mathematics and Statistics Berwin.Turlach@gmail.com The University of Western Australia Models
More informationWorkshop 9.3a: Randomized block designs
-1- Workshop 93a: Randomized block designs Murray Logan November 23, 16 Table of contents 1 Randomized Block (RCB) designs 1 2 Worked Examples 12 1 Randomized Block (RCB) designs 11 RCB design Simple Randomized
More informationValue Added Modeling
Value Added Modeling Dr. J. Kyle Roberts Southern Methodist University Simmons School of Education and Human Development Department of Teaching and Learning Background for VAMs Recall from previous lectures
More informationSTAT 526 Advanced Statistical Methodology
STAT 526 Advanced Statistical Methodology Fall 2017 Lecture Note 10 Analyzing Clustered/Repeated Categorical Data 0-0 Outline Clustered/Repeated Categorical Data Generalized Linear Mixed Models Generalized
More informationQ30b Moyale Observed counts. The FREQ Procedure. Table 1 of type by response. Controlling for site=moyale. Improved (1+2) Same (3) Group only
Moyale Observed counts 12:28 Thursday, December 01, 2011 1 The FREQ Procedure Table 1 of by Controlling for site=moyale Row Pct Improved (1+2) Same () Worsened (4+5) Group only 16 51.61 1.2 14 45.16 1
More informationA brief introduction to mixed models
A brief introduction to mixed models University of Gothenburg Gothenburg April 6, 2017 Outline An introduction to mixed models based on a few examples: Definition of standard mixed models. Parameter estimation.
More informationM. H. Gonçalves 1 M. S. Cabral 2 A. Azzalini 3
M. H. Gonçalves 1 M. S. Cabral 2 A. Azzalini 3 1 University of Algarve, Portugal 2 University of Lisbon, Portugal 3 Università di Padova, Italy user!2010, July 21-23 1 2 3 4 5 What is bild? an R. parametric
More informationlm statistics Chris Parrish
lm statistics Chris Parrish 2017-04-01 Contents s e and R 2 1 experiment1................................................. 2 experiment2................................................. 3 experiment3.................................................
More informationPackage CorrMixed. R topics documented: August 4, Type Package
Type Package Package CorrMixed August 4, 2016 Title Estimate Correlations Between Repeatedly Measured Endpoints (E.g., Reliability) Based on Linear Mixed-Effects Models Version 0.1-13 Date 2015-03-08 Author
More informationGeneralized Linear Mixed-Effects Models. Copyright c 2015 Dan Nettleton (Iowa State University) Statistics / 58
Generalized Linear Mixed-Effects Models Copyright c 2015 Dan Nettleton (Iowa State University) Statistics 510 1 / 58 Reconsideration of the Plant Fungus Example Consider again the experiment designed to
More informationUsing R in 200D Luke Sonnet
Using R in 200D Luke Sonnet Contents Working with data frames 1 Working with variables........................................... 1 Analyzing data............................................... 3 Random
More informationSAS Syntax and Output for Data Manipulation: CLDP 944 Example 3a page 1
CLDP 944 Example 3a page 1 From Between-Person to Within-Person Models for Longitudinal Data The models for this example come from Hoffman (2015) chapter 3 example 3a. We will be examining the extent to
More informationAnalysis of Covariance: Comparing Regression Lines
Chapter 7 nalysis of Covariance: Comparing Regression ines Suppose that you are interested in comparing the typical lifetime (hours) of two tool types ( and ). simple analysis of the data given below would
More informationRegression Analysis in R
Regression Analysis in R 1 Purpose The purpose of this activity is to provide you with an understanding of regression analysis and to both develop and apply that knowledge to the use of the R statistical
More informationAnswer to exercise: Blood pressure lowering drugs
Answer to exercise: Blood pressure lowering drugs The data set bloodpressure.txt contains data from a cross-over trial, involving three different formulations of a drug for lowering of blood pressure:
More informationAnalysis of binary repeated measures data with R
Analysis of binary repeated measures data with R Right-handed basketball players take right and left-handed shots from 3 locations in a different random order for each player. Hit or miss is recorded.
More informationLinear Regression. In this lecture we will study a particular type of regression model: the linear regression model
1 Linear Regression 2 Linear Regression In this lecture we will study a particular type of regression model: the linear regression model We will first consider the case of the model with one predictor
More informationLogistic Regression. Interpretation of linear regression. Other types of outcomes. 0-1 response variable: Wound infection. Usual linear regression
Logistic Regression Usual linear regression (repetition) y i = b 0 + b 1 x 1i + b 2 x 2i + e i, e i N(0,σ 2 ) or: y i N(b 0 + b 1 x 1i + b 2 x 2i,σ 2 ) Example (DGA, p. 336): E(PEmax) = 47.355 + 1.024
More informationModels for Binary Outcomes
Models for Binary Outcomes Introduction The simple or binary response (for example, success or failure) analysis models the relationship between a binary response variable and one or more explanatory variables.
More informationMeasuring relationships among multiple responses
Measuring relationships among multiple responses Linear association (correlation, relatedness, shared information) between pair-wise responses is an important property used in almost all multivariate analyses.
More informationNon-Gaussian Response Variables
Non-Gaussian Response Variables What is the Generalized Model Doing? The fixed effects are like the factors in a traditional analysis of variance or linear model The random effects are different A generalized
More informationMODULE 6 LOGISTIC REGRESSION. Module Objectives:
MODULE 6 LOGISTIC REGRESSION Module Objectives: 1. 147 6.1. LOGIT TRANSFORMATION MODULE 6. LOGISTIC REGRESSION Logistic regression models are used when a researcher is investigating the relationship between
More informationESTIMATE PROP. IMPAIRED PRE- AND POST-INTERVENTION FOR THIN LIQUID SWALLOW TASKS. The SURVEYFREQ Procedure
ESTIMATE PROP. IMPAIRED PRE- AND POST-INTERVENTION FOR THIN LIQUID SWALLOW TASKS 18:58 Sunday, July 26, 2015 1 The SURVEYFREQ Procedure Data Summary Number of Clusters 30 Number of Observations 360 time_cat
More informationContinuous soil attribute modeling and mapping: Multiple linear regression
Continuous soil attribute modeling and mapping: Multiple linear regression Soil Security Laboratory 2017 1 Multiple linear regression Multiple linear regression (MLR) is where we regress a target variable
More informationSAS Syntax and Output for Data Manipulation:
CLP 944 Example 5 page 1 Practice with Fixed and Random Effects of Time in Modeling Within-Person Change The models for this example come from Hoffman (2015) chapter 5. We will be examining the extent
More informationPackage depth.plot. December 20, 2015
Package depth.plot December 20, 2015 Type Package Title Multivariate Analogy of Quantiles Version 0.1 Date 2015-12-19 Maintainer Could be used to obtain spatial depths, spatial ranks and outliers of multivariate
More informationST505/S697R: Fall Homework 2 Solution.
ST505/S69R: Fall 2012. Homework 2 Solution. 1. 1a; problem 1.22 Below is the summary information (edited) from the regression (using R output); code at end of solution as is code and output for SAS. a)
More informationLogistic Regression. 1 Analysis of the budworm moth data 1. 2 Estimates and confidence intervals for the parameters 2
Logistic Regression Ulrich Halekoh, Jørgen Vinslov Hansen, Søren Højsgaard Biometry Research Unit Danish Institute of Agricultural Sciences March 31, 2006 Contents 1 Analysis of the budworm moth data 1
More informationIntroduction to mtm: An R Package for Marginalized Transition Models
Introduction to mtm: An R Package for Marginalized Transition Models Bryan A. Comstock and Patrick J. Heagerty Department of Biostatistics University of Washington 1 Introduction Marginalized transition
More informationMultivariate Analysis of Variance
Chapter 15 Multivariate Analysis of Variance Jolicouer and Mosimann studied the relationship between the size and shape of painted turtles. The table below gives the length, width, and height (all in mm)
More informationPower analysis examples using R
Power analysis examples using R Code The pwr package can be used to analytically compute power for various designs. The pwr examples below are adapted from the pwr package vignette, which is available
More informationContrasting Marginal and Mixed Effects Models Recall: two approaches to handling dependence in Generalized Linear Models:
Contrasting Marginal and Mixed Effects Models Recall: two approaches to handling dependence in Generalized Linear Models: Marginal models: based on the consequences of dependence on estimating model parameters.
More informationThe evdbayes Package
The evdbayes Package April 19, 2006 Version 1.0-5 Date 2006-18-04 Title Bayesian Analysis in Extreme Theory Author Alec Stephenson and Mathieu Ribatet. Maintainer Mathieu Ribatet
More informationStatistics. Introduction to R for Public Health Researchers. Processing math: 100%
Statistics Introduction to R for Public Health Researchers Statistics Now we are going to cover how to perform a variety of basic statistical tests in R. Correlation T-tests/Rank-sum tests Linear Regression
More informationOutline. Statistical inference for linear mixed models. One-way ANOVA in matrix-vector form
Outline Statistical inference for linear mixed models Rasmus Waagepetersen Department of Mathematics Aalborg University Denmark general form of linear mixed models examples of analyses using linear mixed
More informationPackage misctools. November 25, 2016
Version 0.6-22 Date 2016-11-25 Title Miscellaneous Tools and Utilities Author, Ott Toomet Package misctools November 25, 2016 Maintainer Depends R (>= 2.14.0) Suggests Ecdat
More informationSurvival Regression Models
Survival Regression Models David M. Rocke May 18, 2017 David M. Rocke Survival Regression Models May 18, 2017 1 / 32 Background on the Proportional Hazards Model The exponential distribution has constant
More informationSTAT 510 Final Exam Spring 2015
STAT 510 Final Exam Spring 2015 Instructions: The is a closed-notes, closed-book exam No calculator or electronic device of any kind may be used Use nothing but a pen or pencil Please write your name and
More informationModels for Count and Binary Data. Poisson and Logistic GWR Models. 24/07/2008 GWR Workshop 1
Models for Count and Binary Data Poisson and Logistic GWR Models 24/07/2008 GWR Workshop 1 Outline I: Modelling counts Poisson regression II: Modelling binary events Logistic Regression III: Poisson Regression
More informationRandom Coefficients Model Examples
Random Coefficients Model Examples STAT:5201 Week 15 - Lecture 2 1 / 26 Each subject (or experimental unit) has multiple measurements (this could be over time, or it could be multiple measurements on a
More informationMLDS: Maximum Likelihood Difference Scaling in R
MLDS: Maximum Likelihood Difference Scaling in R Kenneth Knoblauch Inserm U 846 Département Neurosciences Intégratives Institut Cellule Souche et Cerveau Bron, France Laurence T. Maloney Department of
More informationPackage LBLGXE. R topics documented: July 20, Type Package
Type Package Package LBLGXE July 20, 2015 Title Bayesian Lasso for detecting Rare (or Common) Haplotype Association and their interactions with Environmental Covariates Version 1.2 Date 2015-07-09 Author
More informationPAPER 206 APPLIED STATISTICS
MATHEMATICAL TRIPOS Part III Thursday, 1 June, 2017 9:00 am to 12:00 pm PAPER 206 APPLIED STATISTICS Attempt no more than FOUR questions. There are SIX questions in total. The questions carry equal weight.
More informationFinite Mixture Model Diagnostics Using Resampling Methods
Finite Mixture Model Diagnostics Using Resampling Methods Bettina Grün Johannes Kepler Universität Linz Friedrich Leisch Universität für Bodenkultur Wien Abstract This paper illustrates the implementation
More informationOverdispersion Workshop in generalized linear models Uppsala, June 11-12, Outline. Overdispersion
Biostokastikum Overdispersion is not uncommon in practice. In fact, some would maintain that overdispersion is the norm in practice and nominal dispersion the exception McCullagh and Nelder (1989) Overdispersion
More informationA Tutorial on fitting Cumulative Link Models with the ordinal Package
A Tutorial on fitting Cumulative Link Models with the ordinal Package Rune Haubo B Christensen September 10, 2012 Abstract It is shown by example how a cumulative link mixed model is fitted with the clm
More informationModel Based Statistics in Biology. Part V. The Generalized Linear Model. Chapter 18.1 Logistic Regression (Dose - Response)
Model Based Statistics in Biology. Part V. The Generalized Linear Model. Logistic Regression ( - Response) ReCap. Part I (Chapters 1,2,3,4), Part II (Ch 5, 6, 7) ReCap Part III (Ch 9, 10, 11), Part IV
More informationLongitudinal Modeling with Logistic Regression
Newsom 1 Longitudinal Modeling with Logistic Regression Longitudinal designs involve repeated measurements of the same individuals over time There are two general classes of analyses that correspond to
More informationHomework1 Yang Sun 2017/9/11
Homework1 Yang Sun 2017/9/11 1. Describe data According to the data description, the response variable is AmountSpent; the predictors are, Age, Gender, OwnHome, Married, Location, Salary, Children, History,
More informationR Analysis Example Replication C11
R Analysis Example Replication C11 # Chapter 11 Longitudinal Analysis HRS data # Use data sets previously prepared in SAS for this chapter to reduce code burden in R # Complete Case 1 Wave # 11.3.1 Example:
More informationIntroduction to lnmle: An R Package for Marginally Specified Logistic-Normal Models for Longitudinal Binary Data
Introduction to lnmle: An R Package for Marginally Specified Logistic-Normal Models for Longitudinal Binary Data Bryan A. Comstock and Patrick J. Heagerty Department of Biostatistics University of Washington
More informationAdvanced Quantitative Data Analysis
Chapter 24 Advanced Quantitative Data Analysis Daniel Muijs Doing Regression Analysis in SPSS When we want to do regression analysis in SPSS, we have to go through the following steps: 1 As usual, we choose
More informationPackage anoint. July 19, 2015
Type Package Title Analysis of Interactions Version 1.4 Date 2015-07-10 Package anoint July 19, 2015 Author Ravi Varadhan and Stephanie Kovalchik Maintainer Stephanie Kovalchik
More informationSTAT Lecture 11: Bayesian Regression
STAT 491 - Lecture 11: Bayesian Regression Generalized Linear Models Generalized linear models (GLMs) are a class of techniques that include linear regression, logistic regression, and Poisson regression.
More informationThe nltm Package. July 24, 2006
The nltm Package July 24, 2006 Version 1.2 Date 2006-07-17 Title Non-linear Transformation Models Author Gilda Garibotti, Alexander Tsodikov Maintainer Gilda Garibotti Depends
More informationYou can specify the response in the form of a single variable or in the form of a ratio of two variables denoted events/trials.
The GENMOD Procedure MODEL Statement MODEL response = < effects > < /options > ; MODEL events/trials = < effects > < /options > ; You can specify the response in the form of a single variable or in the
More informationPackage sklarsomega. May 24, 2018
Type Package Package sklarsomega May 24, 2018 Title Measuring Agreement Using Sklar's Omega Coefficient Version 1.0 Date 2018-05-22 Author John Hughes Maintainer John Hughes
More informationCorrelated Data: Linear Mixed Models with Random Intercepts
1 Correlated Data: Linear Mixed Models with Random Intercepts Mixed Effects Models This lecture introduces linear mixed effects models. Linear mixed models are a type of regression model, which generalise
More informationSAS Code for Data Manipulation: SPSS Code for Data Manipulation: STATA Code for Data Manipulation: Psyc 945 Example 1 page 1
Psyc 945 Example page Example : Unconditional Models for Change in Number Match 3 Response Time (complete data, syntax, and output available for SAS, SPSS, and STATA electronically) These data come from
More informationModels for longitudinal data
Faculty of Health Sciences Contents Models for longitudinal data Analysis of repeated measurements, NFA 016 Julie Lyng Forman & Lene Theil Skovgaard Department of Biostatistics, University of Copenhagen
More informationIntroduction to Mixed Models in R
Introduction to Mixed Models in R Galin Jones School of Statistics University of Minnesota http://www.stat.umn.edu/ galin March 2011 Second in a Series Sponsored by Quantitative Methods Collaborative.
More informationSimple logistic regression
Simple logistic regression Biometry 755 Spring 2009 Simple logistic regression p. 1/47 Model assumptions 1. The observed data are independent realizations of a binary response variable Y that follows a
More informationSTAT 7030: Categorical Data Analysis
STAT 7030: Categorical Data Analysis 5. Logistic Regression Peng Zeng Department of Mathematics and Statistics Auburn University Fall 2012 Peng Zeng (Auburn University) STAT 7030 Lecture Notes Fall 2012
More informationRepeated measures, part 1, simple methods
enote 11 1 enote 11 Repeated measures, part 1, simple methods enote 11 INDHOLD 2 Indhold 11 Repeated measures, part 1, simple methods 1 11.1 Intro......................................... 2 11.1.1 Main
More informationDiscriminant Analysis
Chapter 16 Discriminant Analysis A researcher collected data on two external features for two (known) sub-species of an insect. She can use discriminant analysis to find linear combinations of the features
More informationLinear Regression. Data Model. β, σ 2. Process Model. ,V β. ,s 2. s 1. Parameter Model
Regression: Part II Linear Regression y~n X, 2 X Y Data Model β, σ 2 Process Model Β 0,V β s 1,s 2 Parameter Model Assumptions of Linear Model Homoskedasticity No error in X variables Error in Y variables
More informationSAS Macro for Generalized Method of Moments Estimation for Longitudinal Data with Time-Dependent Covariates
Paper 10260-2016 SAS Macro for Generalized Method of Moments Estimation for Longitudinal Data with Time-Dependent Covariates Katherine Cai, Jeffrey Wilson, Arizona State University ABSTRACT Longitudinal
More informationStat 5303 (Oehlert): Randomized Complete Blocks 1
Stat 5303 (Oehlert): Randomized Complete Blocks 1 > library(stat5303libs);library(cfcdae);library(lme4) > immer Loc Var Y1 Y2 1 UF M 81.0 80.7 2 UF S 105.4 82.3 3 UF V 119.7 80.4 4 UF T 109.7 87.2 5 UF
More informationRegression Methods for Survey Data
Regression Methods for Survey Data Professor Ron Fricker! Naval Postgraduate School! Monterey, California! 3/26/13 Reading:! Lohr chapter 11! 1 Goals for this Lecture! Linear regression! Review of linear
More information(U 338-E) 2018 Nuclear Decommissioning Cost Triennial Proceeding A Workpapers
(U 338-E) 2018 Nuclear Decommissioning Cost Triennial Proceeding A.18-03-009 Workpapers 2018 SCE Trust Fund Contributions and Financial Assumptions SCE-06 Chapter II: Burial Escalation Rate Calculation
More informationUnstable Laser Emission Vignette for the Data Set laser of the R package hyperspec
Unstable Laser Emission Vignette for the Data Set laser of the R package hyperspec Claudia Beleites DIA Raman Spectroscopy Group, University of Trieste/Italy (2005 2008) Spectroscopy
More informationAlgebra 1 Mathematics: to Hoover City Schools
Jump to Scope and Sequence Map Units of Study Correlation of Standards Special Notes Scope and Sequence Map Conceptual Categories, Domains, Content Clusters, & Standard Numbers NUMBER AND QUANTITY (N)
More informationSubject-specific observed profiles of log(fev1) vs age First 50 subjects in Six Cities Study
Subject-specific observed profiles of log(fev1) vs age First 50 subjects in Six Cities Study 1.4 0.0-6 7 8 9 10 11 12 13 14 15 16 17 18 19 age Model 1: A simple broken stick model with knot at 14 fit with
More informationHomework 04. , not a , not a 27 3 III III
Response Surface Methodology, Stat 579 Fall 2014 Homework 04 Name: Answer Key Prof. Erik B. Erhardt Part I. (130 points) I recommend reading through all the parts of the HW (with my adjustments) before
More informationThe coxvc_1-1-1 package
Appendix A The coxvc_1-1-1 package A.1 Introduction The coxvc_1-1-1 package is a set of functions for survival analysis that run under R2.1.1 [81]. This package contains a set of routines to fit Cox models
More informationPackage ICBayes. September 24, 2017
Package ICBayes September 24, 2017 Title Bayesian Semiparametric Models for Interval-Censored Data Version 1.1 Date 2017-9-24 Author Chun Pan, Bo Cai, Lianming Wang, and Xiaoyan Lin Maintainer Chun Pan
More informationModels for binary data
Faculty of Health Sciences Models for binary data Analysis of repeated measurements 2015 Julie Lyng Forman & Lene Theil Skovgaard Department of Biostatistics, University of Copenhagen 1 / 63 Program for
More informationPackage idmtpreg. February 27, 2018
Type Package Package idmtpreg February 27, 2018 Title Regression Model for Progressive Illness Death Data Version 1.1 Date 2018-02-23 Author Leyla Azarang and Manuel Oviedo de la Fuente Maintainer Leyla
More informationTesting Indirect Effects for Lower Level Mediation Models in SAS PROC MIXED
Testing Indirect Effects for Lower Level Mediation Models in SAS PROC MIXED Here we provide syntax for fitting the lower-level mediation model using the MIXED procedure in SAS as well as a sas macro, IndTest.sas
More informationMultivariable Fractional Polynomials
Multivariable Fractional Polynomials Axel Benner September 7, 2015 Contents 1 Introduction 1 2 Inventory of functions 1 3 Usage in R 2 3.1 Model selection........................................ 3 4 Example
More informationunadjusted model for baseline cholesterol 22:31 Monday, April 19,
unadjusted model for baseline cholesterol 22:31 Monday, April 19, 2004 1 Class Level Information Class Levels Values TRETGRP 3 3 4 5 SEX 2 0 1 Number of observations 916 unadjusted model for baseline cholesterol
More informationConfidence Intervals for the Odds Ratio in Logistic Regression with One Binary X
Chapter 864 Confidence Intervals for the Odds Ratio in Logistic Regression with One Binary X Introduction Logistic regression expresses the relationship between a binary response variable and one or more
More informationSAS/STAT 13.1 User s Guide. The MIANALYZE Procedure
SAS/STAT 13.1 User s Guide The MIANALYZE Procedure This document is an individual chapter from SAS/STAT 13.1 User s Guide. The correct bibliographic citation for the complete manual is as follows: SAS
More informationAedes egg laying behavior Erika Mudrak, CSCU November 7, 2018
Aedes egg laying behavior Erika Mudrak, CSCU November 7, 2018 Introduction The current study investivates whether the mosquito species Aedes albopictus preferentially lays it s eggs in water in containers
More informationSimple Linear Regression
Simple Linear Regression MATH 282A Introduction to Computational Statistics University of California, San Diego Instructor: Ery Arias-Castro http://math.ucsd.edu/ eariasca/math282a.html MATH 282A University
More informationLecture 11. Interval Censored and. Discrete-Time Data. Statistics Survival Analysis. Presented March 3, 2016
Statistics 255 - Survival Analysis Presented March 3, 2016 Motivating Dan Gillen Department of Statistics University of California, Irvine 11.1 First question: Are the data truly discrete? : Number of
More informationCO2 Handout. t(cbind(co2$type,co2$treatment,model.matrix(~type*treatment,data=co2)))
CO2 Handout CO2.R: library(nlme) CO2[1:5,] plot(co2,outer=~treatment*type,layout=c(4,1)) m1co2.lis
More informationR code and output of examples in text. Contents. De Jong and Heller GLMs for Insurance Data R code and output. 1 Poisson regression 2
R code and output of examples in text Contents 1 Poisson regression 2 2 Negative binomial regression 5 3 Quasi likelihood regression 6 4 Logistic regression 6 5 Ordinal regression 10 6 Nominal regression
More informationLecture 7 Time-dependent Covariates in Cox Regression
Lecture 7 Time-dependent Covariates in Cox Regression So far, we ve been considering the following Cox PH model: λ(t Z) = λ 0 (t) exp(β Z) = λ 0 (t) exp( β j Z j ) where β j is the parameter for the the
More information