[Splm-commits] r213 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 29 21:17:37 CEST 2017


Author: gpiras
Date: 2017-03-29 21:17:37 +0200 (Wed, 29 Mar 2017)
New Revision: 213

Modified:
   pkg/R/likelihoodsFE.R
   pkg/R/spfeml.R
Log:
ll sar model fe

Modified: pkg/R/likelihoodsFE.R
===================================================================
--- pkg/R/likelihoodsFE.R	2016-11-21 17:57:45 UTC (rev 212)
+++ pkg/R/likelihoodsFE.R	2017-03-29 19:17:37 UTC (rev 213)
@@ -22,7 +22,7 @@
 }
 
 
-splaglm<-function(env, zero.policy = zero.policy, interval = interval, con = con, llprof = llprof, tol.solve= tol.solve, Hess = Hess, method = method, LeeYu = LeeYu, effects = effects){
+splaglm <- function(env, zero.policy = zero.policy, interval = interval, con = con, llprof = llprof, tol.solve= tol.solve, Hess = Hess, method = method, LeeYu = LeeYu, effects = effects){
 
 xt <- get("xt", envir = env)
 yt <- get("yt", envir = env)
@@ -60,6 +60,7 @@
 
         names(lambda) <- "lambda"
         LL <- opt$objective
+        # print(LL)
         optres <- opt
 
 	lm.lag <- lm((yt - lambda * wyt) ~ xt - 1)
@@ -78,7 +79,17 @@
 	names(betas) <- colnames(xt)
 	coefs <- c(lambda, betas)
 
-
+###see Debarsy's mail in February 2017
+    SSE <- sar_hess_sse_panel(lambda, betas, env)
+    s2 <- SSE /n   
+    ldet <- do_ldet(lambda, env, which = 1)
+    ens <- (time * ldet  - ((n*time/2) * log(2 * pi)) - (n*time/2) * log(s2) - 
+        (1/(2 * s2)) * SSE)
+     # print(ens)
+     
+ # LL <- - (NT/2)*log(SSE)  + time * ldet  
+# print(LL)
+##########
 if(LeeYu && effects == "sptpfe"){
 	   
 	    tr <- function(A) sum(diag(A))
@@ -196,7 +207,7 @@
 
 
  
-    	return<-list(coeff = betas, lambda = lambda, s2 = s2, rest.se = rest.se, lambda.se = lambda.se, sig.se = sig.se, asyvar1 = asyvar1,  residuals = r, asyv = asyv)
+    	return<-list(coeff = betas, lambda = lambda, s2 = s2, rest.se = rest.se, lambda.se = lambda.se, sig.se = sig.se, asyvar1 = asyvar1,  residuals = r, asyv = asyv, ll =  ens)
 } 
 
 

Modified: pkg/R/spfeml.R
===================================================================
--- pkg/R/spfeml.R	2016-11-21 17:57:45 UTC (rev 212)
+++ pkg/R/spfeml.R	2017-03-29 19:17:37 UTC (rev 213)
@@ -192,7 +192,7 @@
 assign("n",n, envir=env)
 
 
-wy<-unlist(tapply(y,inde, function(u) lag.listw(listw,u, zero.policy = zero.policy), simplify=TRUE))
+wy <- unlist(tapply(y,inde, function(u) lag.listw(listw,u, zero.policy = zero.policy), simplify=TRUE))
 	
 
 #demeaning of the y and x variables depending both on model and effects



More information about the Splm-commits mailing list