diff glmmpql.R @ 0:5b126f770671 draft

Uploaded
author mnhn65mo
date Fri, 03 Aug 2018 08:28:22 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/glmmpql.R	Fri Aug 03 08:28:22 2018 -0400
@@ -0,0 +1,18 @@
+#!/usr/bin/env Rscript
+library(nlme)
+library(MASS)
+
+args = commandArgs(trailingOnly=TRUE)
+input = read.table(args[1], header=TRUE,sep="	") #input=data.index =ab_index-output
+
+glmm.mod_fullyear <- glmmPQL(regional_gam~ as.factor(YEAR)-1,data=input,family=quasipoisson,random=~1|SITE, correlation = corAR1(form = ~ YEAR | SITE),verbose = FALSE)
+
+col.index <- as.numeric(glmm.mod_fullyear$coefficients$fixed)
+year <- unique(input$YEAR)
+
+write.table(col.index, file="output-glmmpql", row.names=FALSE, sep=" ")
+#write.table(col.index, file="output-glmmpql", row.names=FALSE)
+
+png('output-plot.png')
+plot(year,col.index,type='o', xlab="year",ylab="collated index")
+invisible(dev.off())