search for: sum_

Displaying 20 results from an estimated 73 matches for "sum_".

Did you mean: sum
2011 Mar 14
1
Math characters in column heading using latex() in Hmisc
Hi Everybody I want to print a latex table containing math characters in the column heading These are the formulae I want to use as column headings. It prints OK from TeX $\sum_{i}\sum_{j}C_{P,i,j,y}\times\mathit{FC}_{i}$, $XU_{alt,y}$, $n$, $\bar{C}_{P,y}$ My plan was to create a character vector with these and later rbind the values to them. When I create the vector like: Season=c("$\sum_{i}\sum_{j}C_{P,i,j,y}\times\mathit{FC}_{i}$","$XU_{alt,y}$" ,...
2001 Jan 02
0
mdct explanation
...m to lazy to do it (and besides, I don't have access to TeX, X, or anything else from a text terminal with gcc and vi right now). Hope you like it, Segher -- Suppose we want to calculate a MDCT (encode side): (x_ is input (time) samples, w_ is window, b_ is output (freq) samples): b_k = \sum_{j=0}^{4N-1} x_j w_j \cos{(2k+1)(2j+1-2N) \over 8N} \pi After setting a_j := w_{-j-1+N} x{-j-1+N} + w_{j+N} x{j+N}, j < N a_j := w_{j-1-N} x{j-1-N} - w_{j+3N} x{j+3N}, otherwise (or something similar; the cos'es should agree) we get b_k = \sum_{j=0}^{2N-1} a_j \cos{(2k+1)(2j+1) \over...
2012 Oct 18
7
summation coding
I would like to code the following in R: a1(b1+b2+b3) + a2(b1+b3+b4) + a3(b1+b2+b4) + a4(b1+b2+b3) or in summation notation: sum_{i=1, j\neq i}^{4} a_i * b_i I realise this is the same as: sum_{i=1, j=1}^{4} a_i * b_i - sum_{i=j} a_i * b_i would appreciate some help. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/summation-coding-tp4646678.html Sent from the R help mailing list archive at Nabb...
2009 Sep 17
0
lpSolve constraints don't seem to have an effect
...>= 0 I would split the [0,2] interval into 8 equal parts by defining k=9 points (0 included) -lambdas in the following code- and observe the value of the objective function and the constraint on these points and approximate it by the following program: (Sorry for the Latex type equations) max Sum_{j=1}^{2}Sum_{k=0}^{8}f_{kj}lambda_{kj} subject to: Sum_{j=1}^{2}Sum_{k=0}^{8}g_{kj}lambda_{kj}+x2 = 6 Sum_{k=0}^{8}lambda_{k1} = 1 Sum_{k=0}^{8}lambda_{k2} = 1 lambda_{k1} >= 0 lambda_{k2} >= 0 x2 >= 0 library(lpSolve) # Objective function and constraint f1 <- function(x) 2*x-x^2 f...
2009 May 01
2
Double summation limits
Dear R experts I need to write a function that incorporates double summation, the problem being that the upper limit of the second summation is the index of the first summation, i.e: sum_{j=0}^{x} sum_{i=0}^{j} choose(i+j, i) where x variable or constant, doesn't matter. The following code obviously doesn't work: f=function(x) {j=0:x; i=0:j; sum( choose(i+j,i) ) } Can you help? Thanks in advance, Orestis Chrysafis School of Mathematics University of Sheffield [[altern...
2009 May 18
8
Simple plotting errors
Dear R Users, I have 12 data frames, each of 12 rows and 2 columns. e.g. FeketeJAN MEAN SUM_ AMAZON 144.4997874 68348.4 NILE 5.4701955 1394.9 CONGO 71.3670036 21196.0 MISSISSIPPI 18.9273250 6511.0 AMUR 1.8426874 466.2 PARANA 58.3835497 13486.6 YENISEI 1.4668313 592.6 OB 1.4239179 559.6 LENA 0.9342164 387.7 NIGER...
2009 Oct 17
2
Recommendation on a probability textbook (conditional probability)
...known. Now, I want to compute E(X | Z = z). 2.Suppose that I have $I \times J$ random number in I by J cells. For the random number in the cell on the i'th row and the j's column, it follows Poisson distribution with the parameter $\mu_{ij}$. I want to compute P(n_{i1},n_{i2},...,n_{iJ} | \sum_{j=1}^J n_{ij}), which the probability distribution in a row conditioned on the row sum. Some book directly states that the conditional distribution is a multinomial distribution with parameters (p_{i1},p_{i2},...,p_{iJ}), where p_{ij} = \mu_{ij}/\sum_{j=1}^J \mu_{ij}. But I'm not sure how to de...
2006 Oct 21
2
problem with mode of marginal distriubtion of rdirichlet{gtools}
Hi all, I have a problem using rdirichlet{gtools}. For Dir( a1, a2, ..., a_n), its mode can be found at $( a_i -1)/ ( \sum_{i}a_i - n)$; The means are $a_i / (\sum_{i} a_i ) $; I tried to study the above properties using rdirichlet from gtools. The code are: ############## library(gtools) alpha = c(1,3,9) #totoal=13 mean.expect = c(1/13, 3/13, 9/13) mode.expect = c(0, 2/10, 8/10) # this is for the overall mode...
2005 Jun 14
1
within and between subject calculation
Dear helpers in this forum, I have the following question: Suppose I have the following data set: id x y 023 1 2 023 2 5 023 4 6 023 5 7 412 2 5 412 3 4 412 4 6 412 7 9 220 5 7 220 4 8 220 9 8 ...... and i want to calculate sum_{i=1}^k sum_{j=1}^{n_i}x_{ij}*y_{ij} is there a simple way to do this within and between subject summation in R?
2009 Mar 25
1
Confusion about ecdf
Hi, I'm bit confused about ecdf (read the help files but still not sure about this). I have an analytical expression for the pdf, but want to get the empirical cdf. How do I use this analytical expression with ecdf? If this helps make it concrete, the pdf is: f(u) = \sum_{t = 1}^T 1/n_t \sum_{i = 1}^{n_t} 1/w K((u - u_{it})/w) where K = kernel density estimator, w = weights, and u_{it} = data. Thank you! ML [[alternative HTML version deleted]]
2005 Jun 15
2
need help on computing double summation
...elp on this issue. > Suppose I have the following data set: > > id x y > 023 1 2 > 023 2 5 > 023 4 6 > 023 5 7 > 412 2 5 > 412 3 4 > 412 4 6 > 412 7 9 > 220 5 7 > 220 4 8 > 220 9 8 > ...... > Now I want to compute the following double summation: sum_{i=1}^k sum_{j=1}^{n_i}(x_{ij}-mean(x_i))*(y_{ij}-mean(y_i)) i is from 1 to k, indexing the ith subject id; and j is from 1 to n_i, indexing the jth observation for the ith subject. in the above expression, mean(x_i) is the mean of x values for the ith subject, mean(y_i) is the mean of y values fo...
2006 Dec 08
1
MAXIMIZATION WITH CONSTRAINTS
Dear R users, I?m a graduate students and in my master thesis I must obtain the values of the parameters x_i which maximize this Multinomial log?likelihood function log(n!)-sum_{i=1]^4 log(n_i!)+sum_ {i=1}^4 n_i log(x_i) under the following constraints: a) sum_i x_i=1, x_i>=0, b) x_1<=x_2+x_3+x_4 c)x_2<=x_3+x_4 I have been using the ?ConstrOptim? R-function with the instructions I report below, and I have tried to implement them with different values of ?n?....
2011 Nov 27
1
generating a vector of y_t = \sum_{i = 1}^t (alpha^i * x_{t - i + 1})
Dear R-help, I have been trying really hard to generate the following vector given the data (x) and parameter (alpha) efficiently. Let y be the output list, the aim is to produce the the following vector(y) with at least half the time used by the loop example below. y[1] = alpha * x[1] y[2] = alpha^2 * x[1] + alpha * x[2] y[3] = alpha^3 * x[1] + alpha^2 * x[2] + alpha * x[3] ..... below are
2007 Jul 10
0
Article score calculations for Boolean and MultiTerm Queries, and customization options
...anation at ( http://lucene.zones.apache.org:8080/hudson/job/Lucene-Nightly/javadoc/org/apache/lucene/search/Similarity.html#formula_coord) and through using the explain function in Ferret it seems that the score calculation for a boolean query is (in latex) score = ( querynorm \times fieldnorm ) \sum_{term \in query}{ idf_{term}^{2} tf_{term} boost_{term}} and the calculation for the score of a document matching a MultiTerm Query is score = ( querynorm \times fieldnorm ) idf_{terms \in query}^{2} \sum_{term \in query}{tf_{term} boost_{term}} I would like to implement something much simpler li...
2008 Mar 27
1
functions
I wrote some functions for multiway CANDECOMP, i.e. for least squares fitting of a_{i_1\cdots i_m}\approx\sum_{s=1}^p x^1_{i_1s}x^1_{i_1s}\cdots x^m_{i_ms} with arrays of arbitrary dimension. Reminded me of the good old APL days. I could not find this in the archives, but if it's already there, I would appreciate if someone let me know. ========================================================== Jan...
2009 May 16
1
maxLik pakage
...function with using  "maxLik" function #####the function in latex commands is as following:  \begin{eqnarray*} &&\ell(\xi,\omega,\nu,\lambda_1,\lambda_2)=n\log2-n\log\omega+n\log\Gamma(\frac{\nu+1}{2})-\frac{n}{2}\log(\nu\pi)\\ &-&n\log\Gamma(\frac{\nu}{2})-\frac{\nu+1}{2}\sum_{i=1}^{n}\log(1+\frac{(x_i-\xi)^2}{\omega^2\nu})+\sum_{i=1}^{n}\log\Phi(\lambda_1\frac{(x_i-\xi)}{\sqrt{\omega^2+\lambda_2(x_i-\xi)^2}}) \end{eqnarray*} ############## G2StNV178<-function(a){ require(maxLik) II=0 nu<-(a[1]) lambda1<-a[2] lambda2<-a[3] ksi<-a[4] omega<-a[5] II<-l...
2008 Dec 26
2
Computational Probability
...with the following query: I am trying to reproduce some explicit probability calculations performed in APPL (a Maple extension for computational probability). For instance, in APPL, to compute the probability that the sum of 10 iid uniform variables [0,1] will be between 4 and 6, (i..e Pr( 4 < \sum_{i=1}^{10}X_i < 6)), I can type: X := UniformRV(0, 1); Y := ConvolutionIID(X, 10); CDF(Y,6) - CDF(Y,4); which gives the required probability .7222. Is there any way to perform these type of calcuations in R in a general way? I realise that a lot of the machinery behind these computations comes...
2008 Aug 15
2
Design-consistent variance estimate
...be used to derive the design-consistent variance estimator as: \begin{equation} var(f(Y)) = \left[\frac{\partial f(Y)}{Y}\right]^2 var(Y) \end{equation} \noindent where \begin{equation} \left[\frac{\partial f(Y)}{Y}\right] = \frac{1}{N} \end{equation} \begin{equation} var(Y) = \frac{k}{k-1} \sum_{j=1}^k(\hat{Y}_j-\hat{Y}_{..})^2 \end{equation} \begin{equation} \hat{Y}_j = \sum_{i=1}^{n_j}\hat{Y}_{j(i)} \end{equation} \begin{equation} \hat{Y}_{..} = k^{-1} \sum_{j=1}^k \hat{Y}_j \end{equation} \noindent where $j$ indexes cluster $(1, 2, \ldots, k)$, $j(i)$ indexes the $i$th member of clus...
2008 Jan 07
2
chi-squared with zero df (PR#10551)
Full_Name: Jerry W. Lewis Version: 2.6.1 OS: Windows XP Professional Submission from: (NULL) (24.147.191.250) pchisq(0,0,ncp=lambda) returns 0 instead of exp(-lambda/2) pchisq(x,0,ncp=lambda) returns NaN instead of exp(-lambda/2)*(1 + SUM_{r=0}^infty ((lambda/2)^r / r!) pchisq(x, df + 2r)) qchisq(.7,0,ncp=1) returns 1.712252 instead of 0.701297103 qchisq(exp(-1/2),0,ncp=1) returns 1.238938 instead of 0
2010 Nov 23
2
[LLVMdev] Unrolling power sum calculations into constant time expressions
...or(int i = 0; i < x; i++) ret += i*i; return ret; } ... int sum20(int x) { int ret = 0; for(int i = 0; i < x; i++) ret += i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i; return ret; } etc. Makes LLVM unroll all those loops into constant time expressions! A sum \sum_{i=0}^{n} i^k can be derived into a formula which is a polynomial of degree k+1, but it is not a trivial derivation (I wouldn't do it by hand for k > 2) and I thought that someone hardcoded such a case into llvm loop optimizer, and I've been looking through the loop analysis and loop...