similar to: summation coding

Displaying 20 results from an estimated 1000 matches similar to: "summation coding"

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
2005 Jun 15
2
need help on computing double summation
Dear helpers in this forum, This is a clarified version of my previous questions in this forum. I really need your generous help 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
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) #
2008 May 16
1
Making slope coefficients ``relative to 0''.
I am interested in whether the slopes in a linear model are different from 0. I.e. I would like to obtain the slope estimates, and their standard errors, ``relative to 0'' for each group, rather than relative to some baseline. Explicitly I would like to write/represent the model as y = a_i + b_i*x + E i = 1, ..., K, where x is a continuous variate and i indexes groups (levels of a
2008 Jul 31
1
clustering and data-mining...
Hi all, I am doing some experiment studies... It seems to me that with different combination of 5 parameters, the end results ultimately converged to two scalars. That's to say, some combinations of the 5 parameters lead to one end result and some other combinations of the 5 parameters lead to the other end result (scalar). I am thinking of this is sort of something like clustering or
2000 Mar 31
2
linear models
Dear R users, I have a couple of linear model related questions. 1) How do I produce a fixed effect linear model using lme? I saw somewhere (this may be Splus documentation since I use Splus and R interchangeably) that using lme(...,random= ~ -1 | groups,...) works, but it gives the same as lme(...,random= ~ 1 | groups,...), ie. fits a random effect intercept term. The reason why I want to do
2002 Dec 10
3
clogit and general conditional logistic regression
Can someone clarify what I cannot make out from the documentation? The function 'clogit' in the 'survival' package is described as performing a "conditional logistic regression". Its return value is stated to be "an object of class clogit which is a wrapper for a coxph object." This suggests that its usefulness is confined to the sort of data which arise in
2001 May 23
2
help: exponential fit?
Hi there, I'm quite new to R (and statistics), and I like it (both)! But I'm a bit lost in all these packages, so could someone please give me a hint whether there exists a package for fitting exponential curves (of the type t --> \sum_i a_i \exp( - b_i t)) on a noisy signal? In fact monoexponential decay + polynomial growth is what I'd like to try. Thanks in advance,
2005 Sep 21
2
Help on optim
Dear R-help, I am new to optim function and need some help with optimization. Problem description: I am trying to optimize a weights vector such that it produce maximum value for a function maxVal. The optimization is subjected to constraint. The constraints are a) Min weight should be greater than or equal to Zero. b) Max weight should be less than or equal to 1 c) Sum of the
2010 Feb 03
1
Package plm & heterogenous slopes
Dear r-helpers, I am working with plm package. I am trying to fit a fixed effects (or a 'within') model of the form y_it = a_i + b_i*t + e_it, i.e. a model with an individual-specific intercept and an individual- specific slope. Does plm support this directly? Thanks in advance! Otto Kassi
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?
2012 Aug 16
1
sum predictions by hand
Hi, If I do a standard svm regression with e1071 x <- seq(0.1, 5, by = 0.05) y <- log(x) + rnorm(x, sd = 0.2) m <- svm(x, y) we can do predict(m,x) to get the fitted values. But what if I wan tho get them by hand? Seem to me like it should be w = t(m$coefs)%*%m$SV x.scaled = scale(x, m$x.scale[[1]], m$x.scale[[2]]) t(w %*% t(as.matrix(x.scaled))) - m$rho but this is wrong If i
2008 Aug 29
1
more efficient double summation...
Dear R users... I made the R-code for this double summation computation http://www.nabble.com/file/p19213599/doublesum.jpg ------------------------------------------------- Here is my code.. sum(sapply(1:m, function(k){sum(sapply(1:m, function(j){x[k]*x[j]*dnorm((mu[j]+mu[k])/sqrt(sig[k]+sig[j]))/sqrt(sig[k]+sig[j])}))})) ------------------------------------------------- In fact, this is
2012 May 18
3
LM with summation function
Hi all, I'm trying to model some data where the y is defined by y = summation[1 to 50] B1 * x + B2 * x^2 + B3 * x^3 Hopefully that reads clearly for email. Anyway, if it wasn't for the summation, I know I would do it like this lm(y ~ x + x2 + x3) Where x2 and x3 are x^2 and x^3. However, since each value of x is related to the previous values of x, I don't know how to do this.
2012 Oct 26
3
summation sign
Hi all, I have a very quick question on how to use the summation sign in R for the function. Here?s a basic example: the function is sum(i=1 to 5)log(1-xi^2) Id be grateful if someone knows how to do this without writing it out 5 times - I am looking sth along the lines of the following: computeR <- function(x) { return (-sum(log(1-x^2)) }^ thank you vm in advance! -- View this
2008 Nov 15
1
make a triple summation more efficient
Dear R users... I made the R-code for this triple summation computation http://www.nabble.com/file/p20517134/a.jpg ------------------------------------------------- Here is my code.. x=seq(.1,1,.1); l=10 y=seq(1,10); m=10 z=seq(.1,1,.1); n=10 sum(sapply(1:l, function(i) {sum(sapply(1:m, function(j) {sum(sapply(1:n, function(k){exp(x[i]*y[j]*z[k] )/gamma(y[j]+1)}))^(1.5) }))}))
2004 Mar 16
3
multiple summation
Hello, I have to compute a multiple summation (not an integration because the independent variables a are discrete) for all the values of a function of several variables f (x_1,...,x_n), that is sum ... sum f(x_1,...,x_n) x_1 x_n have you some suggestion? Is it possible? I know that for multiple integration there is the function adapt, but it has at most n=20. In my case n depends on the
2009 Aug 20
1
how to compute this summation...
Dear R users, I try to compute this summation, http://www.nabble.com/file/p25054272/dd.jpg where f(y|x) = Negative Binomial(y, mu=exp(x' beta), size=1/alp) http://www.nabble.com/file/p25054272/aa.jpg http://www.nabble.com/file/p25054272/cc.jpg In fact, I tried to use "do.call" function to compute each u(y,x) before the summation, but I got an error, "Error in X[i, ]
2012 Mar 08
1
Panel models: Fixed effects & random coefficients in plm
Hello, I am using {plm} to estimate panel models. I want to estimate a model that includes fixed effects for time and individual, but has a random individual effect for the coefficient on the independent variable. That is, I would like to estimate the model: Y_it = a_i + a_t + B_i * X_it + e_it Where i denotes individuals, t denotes time, X is my independent variable, and B (beta) is the
2007 Oct 17
2
Need help with function that includes 2 summation
I am relatively new to R, so this may be a much simpler question than it seems to me. I am trying to create a function that includes two summations, and can't figure out how. I am attaching the equation as a pdf file. This function will then be optimized over a chosen range of values, but right now I just need help with the function. Thank you. Zack Darnell Duke University -- Zack