0
|
1 #!/usr/bin/env Rscript
|
|
2 library(nlme)
|
|
3 library(MASS)
|
|
4
|
|
5 args = commandArgs(trailingOnly=TRUE)
|
|
6 input = read.table(args[1], header=TRUE,sep=" ") #input=data.index =ab_index-output
|
|
7
|
|
8 glmm.mod_fullyear <- glmmPQL(regional_gam~ as.factor(YEAR)-1,data=input,family=quasipoisson,random=~1|SITE, correlation = corAR1(form = ~ YEAR | SITE),verbose = FALSE)
|
|
9
|
|
10 col.index <- as.numeric(glmm.mod_fullyear$coefficients$fixed)
|
|
11 year <- unique(input$YEAR)
|
|
12
|
|
13 write.table(col.index, file="output-glmmpql", row.names=FALSE, sep=" ")
|
|
14 #write.table(col.index, file="output-glmmpql", row.names=FALSE)
|
|
15
|
|
16 png('output-plot.png')
|
|
17 plot(year,col.index,type='o', xlab="year",ylab="collated index")
|
|
18 invisible(dev.off())
|