Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
  2. Copyright (C) 2016 The R Foundation for Statistical Computing
  3. Platform: x86_64-pc-linux-gnu (64-bit)
  4.  
  5. R is free software and comes with ABSOLUTELY NO WARRANTY.
  6. You are welcome to redistribute it under certain conditions.
  7. Type 'license()' or 'licence()' for distribution details.
  8.  
  9. Natural language support but running in an English locale
  10.  
  11. R is a collaborative project with many contributors.
  12. Type 'contributors()' for more information and
  13. 'citation()' on how to cite R or R packages in publications.
  14.  
  15. Type 'demo()' for some demos, 'help()' for on-line help, or
  16. 'help.start()' for an HTML browser interface to help.
  17. Type 'q()' to quit R.
  18.  
  19. During startup - Warning messages:
  20. 1: Setting LC_TIME failed, using "C"
  21. 2: Setting LC_MONETARY failed, using "C"
  22. 3: Setting LC_PAPER failed, using "C"
  23. 4: Setting LC_MEASUREMENT failed, using "C"
  24. > # Clear objects -------
  25. > rm(list = ls())
  26. > graphics.off()
  27. >
  28. > #Load packages---------
  29. > library (pomp)
  30. > library (plyr)
  31. >
  32. > #setwd("E:/Dropbox/���THESIS!!!/POMP/VS2EI2") #blackhawck
  33. > #setwd("X:/Dropbox/���THESIS!!!/POMP/VS2EI2") #betty
  34. >
  35. > #Load POMP object
  36. > source("pomp_object_VS2EI2_Nov14_Cluster.R")
  37. During startup - Warning messages:
  38. 1: Setting LC_TIME failed, using "C"
  39. 2: Setting LC_MONETARY failed, using "C"
  40. 3: Setting LC_PAPER failed, using "C"
  41. 4: Setting LC_MEASUREMENT failed, using "C"
  42. Warning message:
  43. in �^�^�pomp�^�^�: the supplied covariate covariate times �^�^�tcovar�^�^� do not embrace the data times: covariates may be extrapolated
  44. >
  45. > # Cluster input --------------------------------------
  46. > indexCluster <- as.numeric(Sys.getenv("SLURM_ARRAY_TASK_ID"))
  47. > seqP <- seq(from = 1, to = 10000, by = 100)
  48. > now.num <- seqP[indexCluster]
  49. >
  50. > #Define params for POMP ---------------------
  51. > y <- read.csv("mifInput_S1_VS2EI2_Nov13.csv")
  52. > params <- as.numeric(y[now.num,]) #1 se cambia por now.num cuando se manda al cluster.
  53. > param.names <- colnames(y)
  54. > names(params) <- param.names
  55. >
  56. > #MIF -------------------------------------------------------------------------------------------------------
  57. > #Read grid. cont es el contador de la linea.
  58. > #5 cambiar por le tamano de filas que tengo generado por el LatinHC
  59. > for(cont in now.num:(now.num+99)){ #for(cont in now.num:(now.num+99)) cuando se manda al cluster.
  60. + for(i in 1:3){ #for(i in 1:3) cuando se manda al cluster.
  61. + param <- as.numeric(y[cont,])
  62. + names(param) <- param.names
  63. + cat(cont, i, "\n") ## print look id
  64. +
  65. + #iterated filtering
  66. + mif2(
  67. + po,
  68. + Nmif = 50, #Change between 50 to 150
  69. + start = param,
  70. + rw.sd = rw.sd(sigOBS=0.03, sigPRO=0.03,
  71. + muEI1=0.03, muI1I2=0.03, muI1S1=0.03, muS2S1=0.03,
  72. + rho=0.03, bT=0.03, q=0.03, c=0.03,
  73. + S1_0=0.03, S2_0=0.03, E_0=0.03, I1_0=0.03, I2_0=0.03, K_0=0.03, F_0=0.03),
  74. + Np = 5000, #change between 1000 to 15000,
  75. + cooling.type = "hyperbolic",
  76. + cooling.fraction.50 = 0.6,
  77. + transform=TRUE
  78. + ) -> mifout
  79. +
  80. + #IF para seguir los loops si MIF no cae en el error. Si es cero hay error.
  81. + if(length(coef(mifout)) > 0){
  82. + loglik.mif <- replicate(n=5,logLik(pfilter(po,
  83. + params=coef(mifout),Np=1000,max.fail=500)))
  84. + bl <- logmeanexp(loglik.mif,se=TRUE)
  85. + loglik.mif.est <- bl[1]
  86. + loglik.mif.se <- bl[2]
  87. + cat(cont, loglik.mif.est, loglik.mif.se, "\n") #print
  88. + }
  89. +
  90. + #Save Output -------
  91. + if(is.finite(loglik.mif.est)){ #if cuando hay valores que son numeros imprimir MIF
  92. + par.out <- coef(mifout) #funcion que me da la informacion de los parametros
  93. + names(par.out) <- param.names
  94. + if(file.exists("mifOutput_S1_VS2EI2_Nov14_Cluster.csv")){
  95. + write.table(t(as.matrix(c(cont,par.out,loglik.mif.est,loglik.mif.se))),
  96. + "mifOutput_S1_VS2EI2_Nov14_Cluster.csv", append = T,
  97. + col.names=F, row.names=F, sep = ",")
  98. + } else{
  99. + write.table(t(as.matrix(c(cont,par.out,loglik.mif.est,loglik.mif.se))),
  100. + "mifOutput_S1_VS2EI2_Nov14_Cluster.csv", append = T,
  101. + col.names=c("run", param.names, "loglik", "loglik.se"), row.names=F, sep = ",")
  102. + }
  103. + }
  104. + }
  105. Error in now.num:(now.num + 99) : NA/NaN argument
  106. Execution halted
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement