Hi All, I am currently working on a project examining the health effects of physical activity using a compositional data (CoDa) approach. I am using a linear regression to measure the effect of physical activity. What I want to do is predict an outcome, e.g. body mass index, based on the mean physical activity composition. I then want to alter this composition by reallocating time from one behavior (such as sedentary) to light intensity physical activity, and see what effect this has on BMI. I have included the code below. My problem is that I cannot seem to generate this new composition correctly. library(compositions) attach(Data_Analysis) #Replace zeros in raw data with 0.00001 bedtimemins[bedtimemins==0] <- 0.00001 sedwakingmins[sedwakingmins==0] <- 0.00001 standingtimemins[standingtimemins==0] <- 0.00001 LIPAmins[LIPAmins==0] <- 0.00001 MVPAmins[MVPAmins==0] <- 0.00001 # make the composition by binding the components together comp <- cbind(bedtimemins, sedwakingmins, standingtimemins, LIPAmins, MVPAmins) # tell R that comp is a compositional variable comp <- acomp(comp) #Generate variation matrix PAvar_matrix <- var.acomp(comp) # make the ilr multiple linear regression model. BMI = body mass index. . lm <- lm(bmi ~ ilr(comp) + age) #determine the mean composition, geometric mean of behaviors which sum to 1 comp.mean <- mean(comp) # predict BMI for the mean composition from above, keeping age constant at its mean. mean.pred <- predict(lm, newdata=list(comp=comp.mean, age = mean(age))) #generate new compostion of PA with 30 minutes of sleep reallocated to 30 mins of LIPA new.comp <- acomp(comp.mean +c(-30/1440, 0/1440, 0/1440, 30/1440, 0/1440)) #predict BMI based on new composition pred <- predict(lm, newdata=list(comp=new.comp, age=mean(age))) #Estimated difference in BMI for the above reallocation pred - mean.pred When I run the command to generate the new composition, I receive the message below new.comp <- acomp(comp.mean +c(-30/1440, 0/1440, 0/1440, 30/1440, 0/1440)) Warning messages: 1: In acomp(gsi.mul(x, y)) : Negative values in composition are used as detection limits 2: In acomp(comp.mean + c(-30/1440, 0/1440, 0/1440, 30/1440, 0/1440)) : Negative values in composition are used as detection limits When I print comp.mean I get a result that seems to make sense: comp.mean bedtimemins sedwakingmins standingtimemins LIPAmins MVPAmins 0.36410089 0.32460230 0.22278324 0.06948202 0.01903155 I can't say the same for the new composition: new.comp bedtimemins sedwakingmins standingtimemins LIPAmins MVPAmins <5.240217 BDL BDL 1.000000 BDL Any help or advice would be greatly appreciated! [[alternative HTML version deleted]]