search for: x_k

Displaying 16 results from an estimated 16 matches for "x_k".

Did you mean: x_ok
2011 Feb 16
1
speed up the code
Hi All, The following is a snippet of my code. It works fine but it is very slow. Is it possible to speed it up by using different data structure or better solution? For 40000 runs, it takes 8 minutes now. Thanks a lot fun_activation = function(s_k, s_hat, x_k, s_hat_len) { common = intersect(s_k, s_hat); if(length(common) != 0) { index = match(common, s_k); round(sum(x_k[index]) * length(common) / (s_hat_len * length(s_k)), 3); } else { 0; } } fun_x = function(a) { round(runif(length(a), 0, 1),...
2010 Feb 09
0
Kernel density / weights matrix?
...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 this weighting matrix. I do need the weighting matrix itself for the test statistic...
2009 May 20
1
Comparing spatial distributions - permutation test implementation
...es correct results but my estimation of the p-value does not match the one predicted with the orignal software from Syrjala. I don't know what I am doing wrong. The permutation test is described by Syrjala as: (...) Under the null hypothesis, at a given sampling location (x_k, y_k), either density ob- servation y_i(x_k, y_k), i = 1, 2, is equally likely for each population. Thus, for a given data set, the distribution of the test statistic can be constructed by calculating the value of the test statistic for all 2^k pairwise per-...
2007 Jul 06
1
algebra/moving average question - NOTHING TO DO WITH R
This has ABSOLUTELY nothing to do with R but I was hoping that someone might know because there are obviously a lot of very bright people on this list. Suppose I had a time series of data and at each point in time t, I was calculating x bar + plus minus sigma where x bar was based on a moving window of size n and so was sigma. So, if I was at time t , then x bar t plus minus sigma_t would be
2006 Oct 16
2
Re : Re : Generate a random bistochastic matrix
Yes, you're right. In fact, it's just an adaptation of a matlab command and the author advises using N^4 replications that's why it's the default in the function. The bistochastic matrix is not my subject of interest, but I need it to perform some random tranformation of a vector of incomes. Florent Bresson ----- Message d'origine ---- De : Richard M. Heiberger <rmh at
2002 May 06
2
A logit question?
...transformation of the dependent. Below some details. I'm not very familiar with the concept. As far as I have understood it's all about transformation of the dependent variable if one have frequency data (grouped data, instead of raw binaries): ln(^p(i)/(1-^p(i)) = c + b_1(X_1) +...+ b_k(X_k) + e(i). where ^p(i) is (estimated) frequency of incident (happened/all = n(i)/N), i is index of observation, c and b_. are coefficients (objects of the estimation), X_. are the explanatory variables and e is residual. So a linear regression. And some testing: > y <- runif(100) > X &l...
2005 Jul 08
1
help with ARIMA and predict
I'm trying to do the following out of sample regression with autoregressive terms and additional x variables: y(t+1)=const+B(L)*y(t)+C(1)*x_1(t)...+C(K)*x_K(t) where: B(L) = lag polynom. for AR terms C(1..K) = are the coeffs. on K exogenous variables that have only 1 lag Question 1: ----------- Suppose I use arima to fit the model: df.y<-arima(yvec,order=c(L,0,0),xreg=xmat[,(1:K)],n.cond=maximum.lag) Now suppose I want to do a 1-period ahead...
2006 Oct 16
5
Re : Generate a random bistochastic matrix
Thanks, I tried someting like this, but computation takes times for large matrices btransf <- function(y,X=length(y)^4) { N <- length(y) bm <- matrix(rep(1/N,N^2),N,N) for(j in 1:X){ coord <- sample(1:N,4,replace=T) d <- runif(1,0,min(bm[coord[1],coord[2]],bm[coord[3],coord[4]]))
2011 Jun 02
4
generating random covariance matrices (with a uniform distribution of correlations)
List members, Via searches I've seen similar discussion of this topic but have not seen resolution of the particular issue I am experiencing. If my search on this topic failed, I apologize for the redundancy. I am attempting to generate random covariance matrices but would like the corresponding correlations to be uniformly distributed between -1 and 1. The approach I have been using is:
2002 Oct 28
1
Nonlinear time series
Dear R People: Is there code for nonlinear time series available, please? I'm looking for something that could also provide a model for forecasts. This is for R V1.5.1 on a PC. Thank you very much in advance! sincerely Erin Hodgess mailto: hodgess at uhddx01.dt.uh.edu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2024 Jan 23
0
Quantiles of sums of independent discrete random variables
Greetings, I have the following? Problem: Given k (=10) discrete independent 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...
2002 Feb 06
4
Weighted median
Is there a weighted median function out there similar to weighted.mean() but for medians? If not, I'll try implement or port it myself. The need for a weighted median came from the following optimization problem: x* = arg_x min (a|x| + sum_{k=1}^n |x - b_k|) where a : is a *positive* real scalar x : is a real scalar n : is an integer b_k: are negative and positive scalars
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
2012 Nov 07
6
how to generate a set of random numbers that sum to 1 with uniform distribution of elements
Hi, I am looking for a way to generate a matrix of random numbers in a way that each row of the matrix would sum to 1 and that the numbers in the columns of the matrix would have a uniform distribution. So far I have found several ways to create random numbers that would sum to 1, but then the distribution of the individual elements is more or less skewed - there are much more small numbers than
2009 Jul 23
1
[PATCH server] changes required for fedora rawhide inclusion.
...h2x9SAiGluK~~1Uk6^Tp95Z_ z9|z|Y{SCx7>Td$C)ZYT0k9y$8>2D)GLw^T&gZ?h?Lj679Ir{s^ovF8kWNuS7>uDcQ z;U<5GtOxavWTPJ=zD55;3glCXKLcf({yFe{`WL_t>t6zI*S`XONdKBjkNO)bu5`bp z(s}p}Ia~GbX=kIi@~E!<faK%)2iWu<)7!T;`YOA1U2J%J^dIFi_(@cO2^07{75n&J zxD5T2eR}#YD7s(20DMqy&_!>=7XPF^O2;u#A1x_kbTNjppgg6Ila%p at Kci2O@rj5Z z(kB5Q&?oEWiB at Jz1?jLpO(#Zw<vE>B2XTh3#OuRMUFgFs08v1$za7FVRgUV~Y?L^z z&jCK6&jmiF&l7ofkoo#4y~P4uRZi;*bWJ&<Po{;+2fC2D5a}XaTKB~uoYf~F>wR5J zJ5gTMmr90Zh`+5b2Yypu0enth3H*gV6}<21LXF_d>8pW1)7R*Q%14N;1$?frL+Vpq z7{@~8Lxk(4EH)tamc9}A9eoq<...