search for: summands

Displaying 18 results from an estimated 18 matches for "summands".

2010 Apr 02
1
All sub-summands of a vector
Hello, I'd like to take all possible sub-summands of a vector in the quickest and most efficient way possible. By "sub-summands" I mean for each sub-vector, take its sum. Which is to say: if I had the vector x<-1:4 I'd want the "sum" of x[1], x[2], etc. And then the sum of x[1:2], x[2:3], etc. And then...so on. Th...
2009 Dec 15
1
Help in R
Hello, Can anyone give me some suggestion in term of calculating the sum below. Is there a function in R that can help doing it faster? x1, x2, ...xn where xi can be 0 or 1. I want to calculate the following: sum{ beta[a+sum(xi), b+n-sum(xi) ]* [ (1-x1)dnorm(0,1)+x1dnorm(2,1) ]* [ (1-x2)dnorm(0,1)+x2dnorm(2,1) ]* ...* [ (1-xn)dnorm(0,1)+xndnorm(2,1) ] } The sum in the beginning is over all
2013 Nov 04
1
ggplot2: Add '+' operator for aes (uneval) objects
...laws with the following proposition: `+.uneval` <- function(e1, e2) { dup <- names(e1) %in% names(e2) if (any(dup)) { duplist <- paste(sQuote(names(e1)[dup]), collapse = ", ") msg <- sprintf(ngettext(length(dup), "element %s occurs in both summands - second one gets precedence", "elements %s occur in both summands - second one gets precedence"), duplist) warning(msg, domain = NA) } res <- c(e1[!dup], e2) class(res) <- "uneval" res } Any thoughts on that? Kind R...
2011 Jan 07
4
how to calculate this natural logarithm
Hello I want to calculate natural logarithm of sum of combinations as follow: (R code) { com_sum=choose(2000000,482)*choose(1000000,118)+choose(2000000,483)*choose(1000000,117)+...+choose(2000000,i)*choose(1000000,600-i)+...+choose(2000000,600)*choose(1000000,0) #calculate the sum result=log(com_sum) #calculate the log of the sum } But
2011 Feb 11
3
How can we make a vector call a function element-wise efficiently?
Hello I have a time-comsuming program which need to simplify, I have tested the annotated program as follow: > #define function which will be call > calsta <- function(c, n=100000) + { + i <- seq(from=0, length=c) + logx <- lchoose(NT-n, CT-i) + lchoose(n, i) + logmax <- max(logx) + logmax + log(sum(exp(logx - logmax))) + } > CT=6000 #assignment to CT >
2011 Jul 13
1
Scaling in SVM
Dear Community! I'm using the svm method of package e1071 for classifying my data. This really works fine, but however I have to work after creating the support vectors and the parameters with unscaled data. So the problem is when I try to train the classifier with the option "scale=F" the result is quite poor, so training with scaled data is essential. The rescaling of the support
2000 Jan 12
1
Usage of p/d/qnorm
Hello, could You please help: I am looking for a way to formulate test accuracy measures such as test sensitivity, specificity, predictive values, and correct classification rate using p/d/qnorm. The tests' primary values follow a bimodal distribution, which is modelled by a mixture of two normal distributions: p * dnorm ((x - u1) / s1) / s1 + (1 - p) * dnorm ((x - u2) / s2) / s2)
2009 Aug 01
4
Likelihood Function for Multinomial Logistic Regression and its partial derivatives
Hi, I would like to apply the L-BFGS optimization algorithm to compute the MLE of a multilevel multinomial Logistic Regression. The likelihood formula for this model has as one of the summands the formula for computing the likelihood of an ordinary (single-level) multinomial logit regression. So I would basically need the R implementation for this formula. The L-BFGS algorithm also requires computing the partial derivatives of that formula in respect to all parameters. I would appreciate...
2024 Jan 15
2
cwilcox - new version
...___________________________________________________________ The function `cwilcox` has three inputs: k, m and n. To establish the test statistics `cwilcox` determines the number of possible sums of natural numbers with the following restrictions: - the sum of the elements must be k, - the elements (summands) must be in a decreasing (or increasing) order, - every element must be less then m and - there must be at most n summands. The problem with the evaluation of this function `cwilcox(k,m,n)` is that it requires a recursion where in fact a three-dimensional array has to be evaluated (see the code ar...
2005 May 05
2
Precision in R
Could anyone help me with the following issue. Using the GSL library in R I define the following code: ######### library(gsl); S<-function(n) { r<-0:n; ans<-sum(gsl_sf_choose(n,r)*(-1)^r*2^(2*r)*gamma_inc(6-2*r,2)) ans } ######### >SS(10) yields 34.91868 >SS(40) yields 5.340422 >SS(60) yields 180.3162 Doing the same computations in maple I get
2011 Feb 12
1
how to improve the precison of this calculation?
...) pair should most probably differ, so I can order them, but > calsta(918,100000)-calsta(718,100000) [1] 0 > calsta(718,90000)-calsta(718,90000) [1] 0 > calsta(718,90000)-calsta(918,100000) [1] 0 # As Eik pointed out in another post, "calsta constantly returns 57003.6 for c>38 (the summands in # sum(exp(logx - logmax)) will become 0 for c>38)" (when n= 10,000) I think there are two ways to solve this problem: 1.Reducing the calcuation formulae algebraically get a conciser kernel for comparing. I think this is the perfect method and I failed many times, though this is not th...
2009 Feb 16
2
solve.QP with box and equality constraints
Dear list, I am trying to follow an example that estimates a 2x2 markov transition matrix across several periods from aggregate data using restricted least squares. I seem to be making headway using solve.QP(quadprog) as the unrestricted solution matches the example I am following, and I can specify simple equality and inequality constraints. However, I cannot correctly specify a constraint
2024 Jan 16
1
cwilcox - new version
...______________ >> The function `cwilcox` has three inputs: k, m and n. To establish the test >> statistics `cwilcox` determines the number of possible sums of natural >> numbers with the following restrictions: >> - the sum of the elements must be k, >> - the elements (summands) must be in a decreasing (or increasing) order, >> - every element must be less then m and >> - there must be at most n summands. >> >> The problem with the evaluation of this function `cwilcox(k,m,n)` is that >> it requires a recursion where in fact a three-dimensiona...
2000 Sep 25
1
No subject
Dear friends. In Carlin and Louis "Bayes and emperical Bayes methods.." 1996 the classical example of 12 independent tosses of a fair coin producing 9 heads and 3 tails is given. If the situation is seen as a fixed sample of 12, a binomial lieklihood is used, and Carlin et al reports a probability of 0.075. Using sum(dbinom(9:12,12,.5)) I obtain 0.073 Likewise, if the experiment is
2003 Jun 17
0
plot.formula
...s separate code for the case of multiple response variables. The latter does provide a formula interface, but the interpretation of the formulae is inconvenient. For example - if y1 is an expression containing "+" then it would have to be protected by I() to prevent the summands in the expression being plotted separately. - you can't replace one of the response variables by a constant, as this will be evaluated as a vector of length 1. It's a lot easier with cbind() , for example plot(cbind(z1 -zhat + bias, 0) ~ x) gets you a plot of (z1-zhat+...
2004 Jul 22
2
Standard error of a sum
Folks, This is so simple is driving me crazy. It's not really an R question is more an Statistics question. I applied a chemical in 3 different events during a growing season. I took 3 samples in each event to estimate mean applied chemical. Thus, I can easily estimate means and st.err by event. I can then estimate the total chemical applied for the whole season by adding the 3 means
2009 Dec 07
4
Subset sum problem.
Hi, I'm quite new to the R-project. I was suggested to look into it because I am trying to solve the "Subset sum" problem", which basically is: Given a set of integers and an integer s, does any non-empty subset sum to s? (See http://en.wikipedia.org/wiki/Subset_sum_problem) I have been searching the web for quite some time now (which is how I eventually discovered that my
2009 Oct 30
28
[Bug 24820] New: [nv15] Vertical screen corruption in X when KMS is enabled
http://bugs.freedesktop.org/show_bug.cgi?id=24820 Summary: [nv15] Vertical screen corruption in X when KMS is enabled Product: xorg Version: git Platform: x86 (IA32) OS/Version: Linux (All) Status: NEW Severity: normal Priority: medium Component: Driver/nouveau AssignedTo: