[Lme4-commits] r1596 - pkg/lme4Eigen/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Feb 10 23:13:05 CET 2012
Author: dmbates
Date: 2012-02-10 23:13:05 +0100 (Fri, 10 Feb 2012)
New Revision: 1596
Modified:
pkg/lme4Eigen/src/glmFamily.cpp
pkg/lme4Eigen/src/glmFamily.h
pkg/lme4Eigen/src/respModule.cpp
Log:
Changed the Laplace member function of glmResp to return the deviance evaluated according to the aic member function in the glmFamily. Still need to decide how to do this for glmerAGQ.
Modified: pkg/lme4Eigen/src/glmFamily.cpp
===================================================================
--- pkg/lme4Eigen/src/glmFamily.cpp 2012-02-10 22:10:12 UTC (rev 1595)
+++ pkg/lme4Eigen/src/glmFamily.cpp 2012-02-10 22:13:05 UTC (rev 1596)
@@ -185,31 +185,18 @@
varFuncs["poisson"] = &identf; // x
}
- glmFamily::glmFamily(List ll) // throw (std::runtime_error)
- : lst(ll),
- //d_family(as<std::string>(CharacterVector(ll["family"]))),
- //d_link( as<std::string>(CharacterVector(ll["link"]))),
-// I haven't been able to work out an expression to initialize the
-// Functions from list components. This is a placeholder until I can
-// do so.
- d_devRes("c"), d_linkfun("c"), d_linkinv("c"),
- d_muEta("c"), d_variance("c"), d_aic("c") {
- // d_devRes(wrap(ll["dev.resids"])),
- // d_linkfun(wrap(ll["linkfun"])),
- // d_linkinv(wrap(ll["linkinv"])),
- // d_muEta(wrap(ll["mu.eta"])),
- // d_variance(wrap(ll["variance"])) {
- if (!lst.inherits("family"))
+ glmFamily::glmFamily(List ll)
+ : d_family( as<std::string>(as<SEXP>(ll["family"]))),
+ d_link( as<std::string>(as<SEXP>(ll["link"]))),
+ d_devRes( as<SEXP>(ll["dev.resids"])),
+ d_linkfun( as<SEXP>(ll["linkfun"])),
+ d_linkinv( as<SEXP>(ll["linkinv"])),
+ d_muEta( as<SEXP>(ll["mu.eta"])),
+ d_variance(as<SEXP>(ll["variance"])),
+ d_aic( as<SEXP>(ll["aic"])),
+ d_rho( d_devRes.environment()) {
+ if (!ll.inherits("family"))
throw std::runtime_error("glmFamily requires a list of (S3) class \"family\"");
- CharacterVector ff = lst["family"], lnk = lst["link"];
- d_family = as<std::string>(ff);
- d_link = as<std::string>(lnk);
- d_linkinv = ll["linkinv"];
- d_linkfun = ll["linkfun"];
- d_muEta = ll["mu.eta"];
- d_variance = ll["variance"];
- d_devRes = ll["dev.resids"];
- d_aic = ll["aic"];
if (!lnks.count("identity")) initMaps();
}
Modified: pkg/lme4Eigen/src/glmFamily.h
===================================================================
--- pkg/lme4Eigen/src/glmFamily.h 2012-02-10 22:10:12 UTC (rev 1595)
+++ pkg/lme4Eigen/src/glmFamily.h 2012-02-10 22:13:05 UTC (rev 1596)
@@ -21,11 +21,11 @@
typedef std::map<std::string, double(*)(const VectorXd&,const VectorXd&,const VectorXd&,
const VectorXd&,double)> aicmap;
protected:
- Rcpp::List lst; /**< original list from R */
std::string d_family, d_link; /**< as in the R glm family */
//@{ R functions from the family, as a fall-back
Rcpp::Function d_devRes, d_linkfun, d_linkinv, d_muEta, d_variance, d_aic;
//@}
+ Rcpp::Environment d_rho;
public:
glmFamily(Rcpp::List);
Modified: pkg/lme4Eigen/src/respModule.cpp
===================================================================
--- pkg/lme4Eigen/src/respModule.cpp 2012-02-10 22:10:12 UTC (rev 1595)
+++ pkg/lme4Eigen/src/respModule.cpp 2012-02-10 22:13:05 UTC (rev 1596)
@@ -137,7 +137,7 @@
}
double glmResp::Laplace(double ldL2, double ldRX2, double sqrL) const {
- return ldL2 + sqrL + resDev();
+ return ldL2 + sqrL + aic();
}
double glmResp::resDev() const {
More information about the Lme4-commits
mailing list