SHARE
TWEET

Untitled

a guest Jun 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. my_data <- read.xlsx("phyla.xlsx")
  2. start_variables <- 6
  3. variables <- variable.names(my_data); variables <- variables[-c(1:(start_variables-1))]
  4.  
  5. #make a list of data frame for each variable
  6. DF.ls <- list(); for (i in start_variables:length(my_data)){DF.ls[[i]] <- data.frame(Sample_ID=my_data$Sample_ID, Genotype=my_data$Genotype, Substrate=my_data$Substrate, y=my_data[[i]])}; DF.ls <- DF.ls[-1]; DF.ls <- DF.ls[-1]; DF.ls <- DF.ls[-1]; DF.ls <- DF.ls[-1]; DF.ls <- DF.ls[-1]
  7.  
  8. #model1
  9. model1.ls <- list(); for (i in 1:length(DF.ls)){model1.ls[[i]] <- gls(y~Substrate+Genotype+Substrate:Genotype, data=DF.ls[[i]])}
  10. AIC_model1_ls <- list(); for (i in 1:length(model1.ls)){AIC_model1_ls[[i]] <- AIC(summary(model1.ls[[i]]))}; AIC_model1 = unlist(AIC_model1_ls); AIC_model1 = rbind(AIC_model1)
  11.  
  12. #model2
  13. model2.ls <- list(); for (i in 1:length(DF.ls)){model2.ls[[i]] <- gls(y~Substrate+Genotype+Substrate:Genotype, weights=varIdent(form=~1|Substrate), data=DF.ls[[i]])}
  14. AIC_model2_ls <- list(); for (i in 1:length(model2.ls)){AIC_model2_ls[[i]] <- AIC(summary(model2.ls[[i]]))}; AIC_model2 = unlist(AIC_model2_ls); AIC_model2 = rbind(AIC_model2)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top