search for: x_j

Displaying 20 results from an estimated 23 matches for "x_j".

Did you mean: x_
2024 Jan 23
0
Quantiles of sums of independent discrete random variables
...ndent random variables X_i with n_i (= 5 to 20) values each,compute quantiles of the distribution of the sum X = X_1+...+X_k. Here X has n=n_1 x n_2 ... n_k distinct values which is too large to list them all together with their probabilities. I tried several approaches: (A) Convolution: each X_j is approximated with Y_j=X_j+Z, where Z is an N(0,sigma) variable with small sigma. Then Y_j is a probability mixture of the normal variables N(x_j,sigma), where the x_j runs over all values of X_j, and has a highly oscillatory density. The density of Y=\sum Y_j is the convolution of the densities...
2012 Oct 27
0
[gam] [mgcv] Question in integrating a eiker-white "sandwich" VCV estimator into GAM
...ert et al textbook on semiparametric regression uses GLS to account for correlated errors. I haven't really used GLS much and I don't think it solves the autocorrelation problem. I'm more accustomed to using a cluster-robust "sandwich" estimator: (X'X)^{-1} (sum_j(X_j' e_j e_j' X_j)) (X'X)^{-1} In a penalized spline context, this would be something like the following: (X'X+\lambda K)^{-1} (sum_j(X_j' e_j e_j' X_j)) (X'X+\lambda K)^{-1} (where J are clusters -- units on whom observations are repeated). As far as I can tell,...
2010 Feb 09
0
Kernel density / weights matrix?
...y grateful or some advice regarding the Kernel density (apologies beforehand if my terminology is not fully correct). I have looked into ksmooth and npreg, but with no success. Given a (n x p) matrix of covariates X, I need to construct the following matrix of Kernel densities or weights: w(x_i, x_j) = K(x_i - x_j) ----------------------------- sum_{k=1}^n K(x_i - x_k) where x_i, x_j, x_k are (1 x p) vectors, and K is a multivariate normal kernel. The resulting weighting matrix W has dimension (n x n). I have looked into npreg, but if I get this correctly, it does not output t...
2007 Feb 01
3
Help with efficient double sum of max (X_i, Y_i) (X & Y vectors)
...type test statistic which involves double sums of max(X_i,Y_j) where X and Y are vectors of differing length. I am currently using ifelse pointwise in a vector, but have a nagging suspicion that there is a more efficient way to do this. Basically, I require three sums: sum1: \sum_i\sum_j max(X_i,X_j) sum2: \sum_i\sum_j max(Y_i,Y_j) sum3: \sum_i\sum_j max(X_i,Y_j) Here is my current implementation - any pointers to more efficient computation greatly appreciated. nx <- length(x) ny <- length(y) sum1 <- 0 sum3 <- 0 for(i in 1:nx) { sum1 <- sum1 + sum(ifelse(x[...
2003 Aug 15
2
Oja median
...], x[j, ]) y <- xx[, 1] * xx[, 4] - xx[, 2] * xx[, 3] z1 <- (xx[, 4] - xx[, 2]) z2 <- - (xx[, 3] - xx[, 1]) return(rq(y~cbind(z1, z2)-1)$coef) } To understand the strategy, note that the area of the triangle formed by the points x_i = (x_i1,x_i2), x_j = (x_j1,x_j2), and theta = (theta_1,theta_2) is given by the determinant, | 1 1 1 | Delta(x_i, x_j, theta) = .5 |y_i1 yj1 theta_1|. |y_i2 yj2 theta_2| Expanding the determinant in the unknown parameters theta gives the l1...
2009 Apr 02
1
matrix vectorization or something else??
...ay have been answered elsewhere, and I have looked on the web, but nothing helps. I am trying to do the following: X<-matrix(c(1:15),nrow=3,byrow=T) Y<-matrix(c(2,4,6,8,10),ncol=1) I need to sum the product of each row of X by the remaining j rows multiplied by j y values (i.e sum( t(x_i) x_j y_j) ) Hope this makes sense. Thanks in advance. Ps: how do I reference all the help that I have had from the R: team? [[alternative HTML version deleted]]
2007 May 21
1
Sample correlation coefficient question NOT R question
...calculating the sample correlation coefficient cor(x_t,y_t) between say two variables, x_t and y_t t=1,.....n ( one can assume that the variables are in time but I don't think this really matters for the question ), does someone know where I can find any piece of literature that says that each (x_j,y_j) pair has To be independent from the other (x_i,y_i) pairs (j doesn't equal i ) in order for the calculation to have any reasonable meaning. This makes perfect sense to me but I need it official writing so I can show it to someone else because I don't know how to explain it. Obviously...
2001 Jan 02
0
mdct explanation
...t (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 8N} \pi This i...
2011 Apr 21
0
C source code question (Robustbase edition)
...----------------------*/ void Qn0(double *x, Sint *n, Sint *p0, double *res) { *res = qn0(x, (int)*n, (int)*p0); } double qn0(double *x, int n, int p0) { /*-------------------------------------------------------------------- Efficient algorithm for the scale estimator: Q*_n = { |x_i - x_j|; i&lt;j }_(k) [= Qn without scaling ] i.e. the k-th order statistic of the |x_i - x_j| Parameters of the function Qn : x : double array containing the observations n : number of observations (n &gt;=2) */ double *y = (double *)R_alloc(n, sizeof(double));...
2006 May 20
1
(PR#8877) predict.lm does not have a weights argument for newdata
Dear R developers, I am a little disappointed that my bug report only made it to the wishlist, with the argument: Well, it does not say it has. Only relevant to prediction intervals. predict.lm does calculate prediction intervals for linear models from weighted regression, so they should be correct, right? As far as I can see they are bound to be wrong in almost all cases, if no weights
2000 Jan 01
0
Re: Tests in linear regression
...tmas. FrSa> Best wishes, Francisco Sabido. Dear Francisco, I think everything you need is already part of R: summary(lm.sml <- lm(y ~ x1)) summary(lm.big <- lm(y ~ x1 + x2 + x3 + x4)) anova(lm.sml, lm.big) now will do a test of b2 = b3 = b4 = 0 if b_j is the coefficient of x_j. Look at the online help ?lm and ?anova and at demo(lm.glm) where models "l1" and "l0" are compared that way. ---------- ---------- ---------- Happy new year to everyone! ---------- ---------- ---------- Martin Maechler <maechler at stat.math.ethz.ch> http://s...
2005 Dec 12
0
marginal effects in glm's
Hi, I wonder if there is a function in (some package of) R which computes marginal effects of the variables in a glm, say, for concretness, a probit model. By marginal effects of the covariate x_j I mean d P(y=1 | x), which is approx g(xB)B_j dx_j where g is the pdf of the normal distribution, x is the vector of covariates (at some points, say, the mean values) and B is the estimated vector of coefficients. Of course, it isn't difficult to write such a function, but that's exa...
2011 May 18
1
Convolution confusion:
Hi, I'm new to R, and I'm a bit confused with the "convolve()" function. If I do: x<-c(1, 2, 3) convolve(x, rev(x), TRUE, "open") = 9 12 10 4 1 But I expected: 3 8 14 8 3 (like in Octave/MATLAB - conv(x, reverse(x)) ) 3 2 1 x 1 2 3 = 3 2 1 0 6 4 2 0 0 9 6 3 = 3 8 14 8 3 The thing is, that "convolve(x, x, TRUE, "open")" works. For me
2004 Mar 31
0
energy 1.0.1
...the absolute value of the force is constant, and then the potential energy is proportional to the Euclidean distances between pairs of objects. In statistics, the objects are the observed random vectors, and thus our energy terms are Euclidean distances between the pairs of sample elements: ||x_i - x_j||. Tests are based on the Theorem that a suitable linear combination of these distances (the potential energy of the 'statistical situation') is always nonnegative, and equals 0 if and only if the null hypothesis holds. Comments and suggestions are welcome. The description file is below....
2004 Mar 31
0
energy 1.0.1
...the absolute value of the force is constant, and then the potential energy is proportional to the Euclidean distances between pairs of objects. In statistics, the objects are the observed random vectors, and thus our energy terms are Euclidean distances between the pairs of sample elements: ||x_i - x_j||. Tests are based on the Theorem that a suitable linear combination of these distances (the potential energy of the 'statistical situation') is always nonnegative, and equals 0 if and only if the null hypothesis holds. Comments and suggestions are welcome. The description file is below....
2009 Aug 24
2
Formulas in gam function of mgcv package
Dear R-experts, I have a question on the formulas used in the gam function of the mgcv package. I am trying to understand the relationships between: y~s(x1)+s(x2)+s(x3)+s(x4) and y~s(x1,x2,x3,x4) Does the latter contain the former? what about the smoothers of all interaction terms? I have (tried to) read the manual pages of gam, formula.gam, smooth.terms, linear.functional.terms but
2009 Aug 24
2
Formulas in gam function of mgcv package
Dear R-experts, I have a question on the formulas used in the gam function of the mgcv package. I am trying to understand the relationships between: y~s(x1)+s(x2)+s(x3)+s(x4) and y~s(x1,x2,x3,x4) Does the latter contain the former? what about the smoothers of all interaction terms? I have (tried to) read the manual pages of gam, formula.gam, smooth.terms, linear.functional.terms but
2005 Sep 13
4
plot(<lm>): new behavior in R-2.2.0 alpha
As some of you R-devel readers may know, the plot() method for "lm" objects is based in large parts on contributions by John Maindonald, subsequently "massaged" by me and other R-core members. In the statistics litterature on applied regression, people have had diverse oppinions on what (and how many!) plots should be used for goodness-of-fit / residual diagnostics, and to my
2008 Jun 08
2
optim, constrOptim: setting some parameters equal to each other
Hello, and apologies for the upcoming naive questions. I am a biologist who is trying to teach himself the appropriate areas of math and stats. I welcome pointers to suggested background reading just as much as I do direct answers to my question. Let's say I have a function F() that takes variables (a,b,c,a1,b1,c1) and returns x, and I want to find the values of these variables that result in
2011 Jan 14
4
test
Hi, i have that table Thesis Day A B C 1 0 83.43 90.15 22.97 1 0 85.50 94.97 16.62 1 0 83.36 95.38 20.70 1 0 84.47 92.16 23.58 1 0 83.98 95.33 19.39 1 0 82.86 93.78 24.55 1 0 83.39 92.67 19.56 1 0 85.17 95.24 17.95 1 0 81.62 93.32 28.49 1 0 82.99 92.85 19.73 1 0 81.11 95.67 27.20 1 0 83.39 94.69 16.51 1 0 79.56 89.87 30.39 1 0 80.54 93.32 21.76 1 0 82.11 92.58 22.17 1 14 85.65 94.00 19.19 1 14