[Splm-commits] r171 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 24 22:37:20 CEST 2013


Author: gpiras
Date: 2013-07-24 22:37:19 +0200 (Wed, 24 Jul 2013)
New Revision: 171

Modified:
   pkg/R/ivsplm.R
   pkg/R/likelihoodsFE.R
   pkg/R/spgm.R
Log:
endog

Modified: pkg/R/ivsplm.R
===================================================================
--- pkg/R/ivsplm.R	2013-06-29 15:34:56 UTC (rev 170)
+++ pkg/R/ivsplm.R	2013-07-24 20:37:19 UTC (rev 171)
@@ -87,7 +87,7 @@
 if (!inherits(listw, c("listw", "matrix"))) 
         stop("listw should be either a matrix of an object of class listw")
 
-if(is.null(endog) && lag == FALSE) stop("No engogenous variables specified")
+if(is.null(endog) && lag == FALSE) stop("No endogenous variables specified")
 
 if(is.character(endog)){
 	xend<- match(endog,colnames(data))  
@@ -137,6 +137,7 @@
     result$listw_style <- FALSE
     result$call <- match.call()
 
+
 class(result) <- "stsls"
 result
 }

Modified: pkg/R/likelihoodsFE.R
===================================================================
--- pkg/R/likelihoodsFE.R	2013-06-29 15:34:56 UTC (rev 170)
+++ pkg/R/likelihoodsFE.R	2013-07-24 20:37:19 UTC (rev 171)
@@ -494,12 +494,13 @@
     s2 <- SSE/NT
     betas <- coefficients(lm.target)
     names(betas) <- colnames(xt)  
-	# coefs <- c(lambda, rho, betas)
-	coefs <- c(lambda, rho, betas)
+	 # coefs <- c(rho, lambda, betas)
+	 coefs <- c(lambda, rho, betas)
 
 ###Add the vc matrix exact
 if(Hess){        
         fd <- fdHess(coefs, f_sacpanel_hess, env, LeeYu = LeeYu)
+        #
         mat <- fd$Hessian
 		  fdHess<- solve(-(mat), tol.solve = tol.solve)
         rownames(fdHess) <- colnames(fdHess) <- c("lambda", "rho",colnames(xt))
@@ -645,8 +646,10 @@
     ldet1 <- do_ldet(lambda, env, which = 1)
     ldet2 <- do_ldet(rho, env, which = 2)
    
-ret <- (T * ldet1 + T * ldet2 - (((n*T)/2) * (log(2 * pi)+1)) - (n*T/2) * log(s2))
+#ret <- (T * ldet1 + T * ldet2 - (((n*T)/2) * (log(2 * pi))) - (n*T/2) * log(s2))
                         # - (1/(2 * (s2))) * SSE)
+ret <- (T * ldet1 + T * ldet2 - ((n*T/2) * log(2 * pi)) - (n*T/2) * log(s2) - 
+        (1/(2 * s2)) * SSE)
 
 
     if (get("verbose", envir = env)) cat("rho:", rho, "lambda:", lambda, " function:", ret, 
@@ -655,7 +658,7 @@
     ret
 }
 
-sar_sac_hess_sse_panel <- function (lambda, rho, beta, env) 
+sar_sac_hess_sse_panel <- function (lambda, rho,  beta, env) 
 {
     yl <- get("yt", envir = env) - lambda * get("wyt", envir = env) - 
         rho * get("w2yt", envir = env) + rho * lambda * get("w2wyt", 

Modified: pkg/R/spgm.R
===================================================================
--- pkg/R/spgm.R	2013-06-29 15:34:56 UTC (rev 170)
+++ pkg/R/spgm.R	2013-07-24 20:37:19 UTC (rev 171)
@@ -54,6 +54,7 @@
 results$call <- cl
 results$ef.sph<- effects
 results$legacy <- c(lag, spatial.error)
+results$endog <- endog
 results
 
 }



More information about the Splm-commits mailing list