search for: lsum

Displaying 12 results from an estimated 12 matches for "lsum".

Did you mean: csum
2012 Dec 15
3
interfacing with .Call
Hi My code is as following: #include <R.h> #include <Rinternals.h> //* the Projector part *// void Projector(double *L, int *dimL, double *G, int *dimG, double *W, int *dimW, int *xymod, int *dimxy, double *modif, int *dimif, double *Lsum) { ...} //* the interface part *// #define getDim(A) INTEGER(coerceVector(getAttrib(A,R_DimSymbol), INTSXP)) SEXP Projector5(SEXP L, SEXP G, SEXP W, SEXP xymod, SEXP modif) { //* digest SEXPs from R *// int *dimL, *dimG, *dimW, *dimxy, *dimif; double *lptr, *gptr, *wptr, *ifptr; i...
2011 Aug 02
1
My R code is not efficient
...---- for (k in 1:n){ ymax <- max( y1[k], y2[k] ) i <- 0:ymax sums<- -lgamma(y1[k]-i+1)-lgamma(i+1)-lgamma(y2[k]-i+1) maxsums <- max(sums) sums <- sums - maxsums lsum <- log( sum(exp(sums)) ) + maxsums lbp[k] <- y1[k]*log(4) + y2[k]*log(5) + lsum } elbp <- exp(lbp) ------------------------------------------------------------------------------------ Any suggestion will be greatly appreciated. Regards,...
2009 Jan 28
3
initial value in 'vmmin' is not finite
...((wt%*%con4)/rho)+ ev = ey+ed+eh+ew+ den=(ey+ed+eh+ew)+ iv = rho*log(den)+ pp=exp(x[4]+iv)/(1+exp(x[4]+iv))+ pr1 =pp* ey/den+ pr2 =pp* ed/den+ pr3 =pp* eh/den+ pr4 =pp* ew/den+ pnp=1/(1+exp(x[4]+iv))+ likelihood = (pnp*yogurt[,1])+(pr1*yogurt[,2])+(pr2*yogurt[,3])+(pr3*yogurt[,4])+(pr4*yogurt[,4])+ lsum = log(likelihood)+ return(-colSums(lsum))+ }> p = optim(c(0,0,0,0,0.1,-2,-0.2),fr, hessian = TRUE, method = "BFGS")Error in optim(c(0, 0, 0, 0, 0.1, -2, -0.2), fr, hessian = TRUE, method = "BFGS") : initial value in 'vmmin' is not finite ___________________________...
2005 Jun 05
0
[PATCH] line endings fix
...outbuf [MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; -static Float_t* rout; -static unsigned int sampleWindow; /* number of samples required to reach number of milliseconds required for RMS window */ -static unsigned long totsamp; -static double lsum; -static double rsum; -static int freqindex; -static Uint32_t A [(size_t)(STEPS_per_dB * MAX_dB)]; -static Uint32_t B [(size_t)(STEPS_per_dB * MAX_dB)]; - -/* for each filter: - [0] 48 kHz, [1] 44.1 kHz, [2] 32 kHz, [3] 24 kHz, [4] 22050 Hz, [5] 16 kHz, [6] 12 kHz, [7] is...
2005 Jun 04
2
[PATCH] line endings fix
The replay gain code has dos line endings in CVS, which causes problems for the Sun compiler, among others. Attached is a patch for the lazy, but it's probably easier to fix locally and commit. -r
2009 Mar 02
1
initial gradient and vmmin not finite
...w = exp((wt%*%con4)/rho) ev = ey+ed+eh+ew den=(ey+ed+eh+ew) iv = rho*log(den) pp=exp(x[4]+iv)/(1+exp(x[4]+iv)) pr1 =pp*(ey/den) pr2 =pp*(ed/den) pr3 =pp*(eh/den) pr4 =pp*(ew/den) pnp=1/(1+exp(x[4]+iv)) likelihood = (pnp*yogurt[,1])+(pr1*yogurt[,2])+(pr2*yogurt[,3])+(pr3*yogurt[,4])+(pr4*yogurt[,4]) lsum = log(likelihood) return(colSums(lsum)) } p = summary(maxLik(fr,start=c(0,0,0,1,0,-25,-0.2))) p _________________________________________________________________ cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009 [[alternative HTML version deleted]]
2013 Nov 07
1
R interface to C API Rf_logspace_{add,sub}?
Is there an R-language interface to the R API C-language functions Rf_logspace_add() and Rf_logspace_sub()? I don't see one but I may not looking under the right name. Various packages have functions which do that same sort of thing (log(exp(x)+exp(y)) and log(exp(x)-exp(y)) without unnecessary floating point errors). They have names like matrixStats::logSumExp(lx, na.rm=FALSE, ...)
2019 Jun 24
1
Calculation of e^{z^2/2} for a normal deviate z
...putation for Archimedean copulas, and have efficient R level implementations, both for your case and the -- even more delicate -- case of e.g., alternating signs of exponential terms. "Unfortunately", we had never exported the functions from the package, so you'd need copula:::lsum() # log sum {of exponentials in log scale} or copula:::lssum() # log *s*igned sum {of exponentials in log scale} for the 2nd case. The advantage is it's simple R code implemented quite efficiently for the vector and matrices cases, Source code from source file copula/R/speci...
2001 Sep 03
8
mixture distributions
Dear List, I am looking for a possibility to fit a mixture model under R using maximum likelihood estimation. Venables and Ripley describe a solution working under S+ (in MASS, 3. ed., p. 263) which requires the D system function and deriv3. This solution does not seem to be portable to R or at least I do not realise how. Is there anyone who a) knows how one could make the MASS-method run under
2007 Aug 24
0
Fixes to make flac build on Solaris
...it32_t code below. */ >> +#endif >> #define PINK_REF 64.82 /* 298640883795 */ >> /* calibration value */ >> >> static Float_t linprebuf [MAX_ORDER * 2]; >> @@ -142,8 +149,13 @@ >> static double lsum; >> static double rsum; >> static int freqindex; >> +#ifndef __sun >> static Uint32_t A [(size_t)(STEPS_per_dB * MAX_dB)]; >> static Uint32_t B [(size_t)(STEPS_per_dB * MAX_dB)]; >> +#else >> +static Uint32_t A [(size_t)(UINT32...
2019 Jun 24
2
Calculation of e^{z^2/2} for a normal deviate z
>>>>> William Dunlap via R-devel >>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes: >>>>> William Dunlap via R-devel >>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes: > include/Rmath.h declares a set of 'logspace' functions for use at the C > level. I don't think there are core R functions that call
2009 Jan 28
2
t.test in a loop
Hi All, I've been having a little trouble with creating a loop that will run a a series of t.tests for inspection, Below is the code i've tried, and some checks i've looked at. I've used the get(paste()) idea as i was told previously that the use of the eval should try and be avoided. I've run a single syntax to check that my systax is correct and works without any problems