annotate glmmpql.R @ 1:b8fa05dbcff4 draft

Uploaded
author mnhn65mo
date Fri, 03 Aug 2018 10:07:25 -0400
parents 5b126f770671
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
1 #!/usr/bin/env Rscript
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
2 library(nlme)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
3 library(MASS)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
4
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
5 args = commandArgs(trailingOnly=TRUE)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
6 input = read.table(args[1], header=TRUE,sep=" ") #input=data.index =ab_index-output
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
7
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
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)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
9
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
10 col.index <- as.numeric(glmm.mod_fullyear$coefficients$fixed)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
11 year <- unique(input$YEAR)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
12
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
13 write.table(col.index, file="output-glmmpql", row.names=FALSE, sep=" ")
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
14 #write.table(col.index, file="output-glmmpql", row.names=FALSE)
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
15
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
16 png('output-plot.png')
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
17 plot(year,col.index,type='o', xlab="year",ylab="collated index")
5b126f770671 Uploaded
mnhn65mo
parents:
diff changeset
18 invisible(dev.off())