<HTML>
<HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="OPENWEBMAIL" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
Hello,
<br />
<br /> I spent last weekend trying to run this piece of code (and a lot of variations too):
<br />
<br />suppressPackageStartupMessages(require(inline))
<br />suppressPackageStartupMessages(require(Rcpp))
<br />
<br />vero.empi.cpp <- '
<br /> Rcpp::NumericVector xa(vpf) ;
<br /> Rcpp::NumericVector xb(vpe) ;
<br /> Rcpp::NumericVector xc(tempo) ;
<br /> Rcpp::NumericVector xd(evento) ;
<br /> int n_xa = xa.size(), n_xb = xb.size(), n_xd = xd.size() ;
<br /> Rcpp::NumericMatrix vero(n_xa,n_xb)
<br /> Rcpp::Function d(fun1) ;
<br /> Rcpp::Function S(fun2) ;
<br /> float aux ;
<br /> for (int i = 0; i < n_xa; i++){
<br /> for (int j = 0; j < n_xb; j++){
<br /> aux = 0 ;
<br /> for(int k = 0; k < n_xd; k++){
<br /> aux = aux*(d(xc[k], xa[i], xb[j])^xd[k])*(S(xc[k], xa[i], xb[j])^(1- xd[k])) ;
<br /> }
<br /> vero[i , j] = aux ;
<br /> }
<br /> }
<br /> return vero;
<br />'
<br />
<br />vero.empi <- cxxfunction(
<br /> signature(vpf="numeric", vpe="numeric", tempo="numeric", evento="numeric", fun1 = "function", fun2 = "function"),
<br /> vero.empi.cpp, plugin="Rcpp", include = "using namespace Rcpp; ")
<br />
<br />The purpose here is to generate a matrix of empirical values of a likelihood. For a first trial, I would like to use the R functions dweibull() and pweibull() in fun1 and fun2, respectively. But it didn't work for some reason I cannot see. Is this possible?
<br />
<br />
<br />Thanks,
<br />Prof. Hermes
<br />PS.: Sorry for my bad English!
<br />
</BODY>
</HTML>