[Lme4-commits] r1699 - pkg/lme4/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 4 23:33:58 CEST 2012


Author: dmbates
Date: 2012-04-04 23:33:58 +0200 (Wed, 04 Apr 2012)
New Revision: 1699

Modified:
   pkg/lme4/src/glmFamily.cpp
Log:
Needed another PROTECT (should have committed this change long ago)


Modified: pkg/lme4/src/glmFamily.cpp
===================================================================
--- pkg/lme4/src/glmFamily.cpp	2012-04-02 20:20:58 UTC (rev 1698)
+++ pkg/lme4/src/glmFamily.cpp	2012-04-04 21:33:58 UTC (rev 1699)
@@ -314,7 +314,7 @@
 	if (d_linknam == "probit")   {delete d_link; d_link = new probitLink(ll);}
 
 	if (d_family  == "binomial")         {delete d_dist; d_dist = new binomialDist(ll);}
-	if (d_family  == "gamma")            {delete d_dist; d_dist = new gammaDist(ll);}
+	if (d_family  == "Gamma")            {delete d_dist; d_dist = new gammaDist(ll);}
 	if (d_family  == "gaussian")         {delete d_dist; d_dist = new GaussianDist(ll);}
 	if (d_family  == "inverse.gaussian") {delete d_dist; d_dist = new inverseGaussianDist(ll);}
 	if (d_family.substr(0, 18) ==
@@ -376,13 +376,15 @@
     double glmDist::aic(const ArrayXd& y, const ArrayXd& n, const ArrayXd& mu,
 			const ArrayXd& wt, double dev) const {
 	int nn = mu.size();
-	return ::Rf_asReal(::Rf_eval(::Rf_lang6(as<SEXP>(d_aic),
-						as<SEXP>(NumericVector(y.data(), y.data() + nn)),
-						as<SEXP>(NumericVector(n.data(), n.data() + nn)),
-						as<SEXP>(NumericVector(mu.data(), mu.data() + nn)),
-						as<SEXP>(NumericVector(wt.data(), wt.data() + nn)),
-						::Rf_ScalarReal(dev)
-					 ), d_rho));
+	double ans =
+	    ::Rf_asReal(::Rf_eval(::Rf_lang6(as<SEXP>(d_aic),
+					     as<SEXP>(NumericVector(y.data(), y.data() + nn)),
+					     as<SEXP>(NumericVector(n.data(), n.data() + nn)),
+					     as<SEXP>(NumericVector(mu.data(), mu.data() + nn)),
+					     as<SEXP>(NumericVector(wt.data(), wt.data() + nn)),
+					     PROTECT(::Rf_ScalarReal(dev))), d_rho));
+	UNPROTECT(1);
+	return ans;
     }
     
     negativeBinomialDist::negativeBinomialDist(Rcpp::List& ll)



More information about the Lme4-commits mailing list