Displaying 20 results from an estimated 169 matches for "x_i".
Did you mean:
_i
2004 Apr 18
2
lm with data=(means,sds,ns)
Hi Folks,
I am dealing with data which have been presented as
at each x_i, mean m_i of the y-values at x_i,
sd s_i of the y-values at x_i
number n_i of the y-values at x_i
and I want to linearly regress y on x.
There does not seem to be an option to 'lm' which can
deal with such data directly, though the regression
problem could be...
2007 Feb 01
3
Help with efficient double sum of max (X_i, Y_i) (X & Y vectors)
Greetings.
For R gurus this may be a no brainer, but I could not find pointers to
efficient computation of this beast in past help files.
Background - I wish to implement a Cramer-von Mises 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 ma...
2010 Feb 06
1
Canberra distance
Hi the list,
According to what I know, the Canberra distance between X et Y is : sum[
(|x_i - y_i|) / (|x_i|+|y_i|) ] (with | | denoting the function
'absolute value')
In the source code of the canberra distance in the file distance.c, we
find :
sum = fabs(x[i1] + x[i2]);
diff = fabs(x[i1] - x[i2]);
dev = diff/sum;
which correspond to the formula : sum[ (|x_i - y_i...
2013 Jun 23
1
2SLS / TSLS / SEM non-linear
Dear all, I try to conduct a SEM / two stage least squares regression with
the following equations:
First: X ~ IV1 + IV2 * Y
Second: Y ~ a + b X
therein, IV1 and IV2 are the two instruments I would like to use. the
structure I would like to maintain as the model is derived from economic
theory. My problem here is that I have trouble solving the equations to get
the reduced form so I can run
2010 Nov 28
1
faster base::sequence
...uld benefit from being written in C to avoid unnecessary memory
allocations.
I made this version using inline:
require( inline )
sequence_c <- local( {
fx <- cfunction( signature( x = "integer"), '
int n = length(x) ;
int* px = INTEGER(x) ;
int x_i, s = 0 ;
/* error checking */
for( int i=0; i<n; i++){
x_i = px[i] ;
/* this includes the check for NA */
if( x_i <= 0 ) error( "needs non negative integer" ) ;
s += x_i ;
}
SEXP res = PROTECT(...
2010 Sep 24
3
boundary check
...91080581 -0.34774436 0.9552182
[9,] 0.19131383 0.14980569 -0.37458224 -0.09371273 -1.7667203
[10,] -0.85159276 -0.66679528 1.63019340 0.56920196 -2.4049600
And I define a boundary of X: The smallest "ball" that nests all the
observations of X. I wish to check if a particular point x_i
> x_i <- matrix(rnorm(5), 1, 5)
> x_i
[,1] [,2] [,3] [,4] [,5]
[1,] -0.1525543 0.4606419 -0.1011011 -1.557225 -1.035694
is inside the boundary of X or not. I know it's easy to do it with 1-D or
2-D, but I don't knot how to manage it when the dimens...
2011 Sep 14
1
Hints for Data Mining
...questions
about clustering mixed numerical/categorical data. This time I am more
into data mining. I am given a set of known statistical indexes {s_i},
i=1,2...N for a N countries. These indexes in general are a both
numerical and categorical variables. For each country, I also have a
property x_i whose value is known, but that I also would like to be able
to predict correctly using a model. This is needed in order to assess
the importance of the various indexes in determining {x_i}.
There are two cases of interest
(1) all the {x_i} are numerical variables, e.g. the average life expectanc...
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 be...
2007 Mar 01
1
covariance question which has nothing to do with R
...omeone could help me anyway.
Suppose, I have two random variables X and Y whose means are both known
to be zero and I want to get an estimate of their covariance.
I have n sample pairs
(X1,Y1)
(X2,Y2)
.
.
.
.
.
(Xn,Yn)
, so that the covariance estimate is clearly 1/n *(sum from i = 1 to n
of ( X_i*Y_i) )
But, suppose that it is know that the X_i are positively correlated with
each other and that the Y_i are independent
of each other.
Then, does this change the formula for the covariance estimate at all ?
Intuitively, I would think that, if the X_i's are positively
correlated , then so...
2001 Mar 05
1
Canberra dist and double zeros
Canberra distance is defined in function `dist' (standard library `mva') as
sum(|x_i - y_i| / |x_i + y_i|)
Obviously this is undefined for cases where both x_i and y_i are zeros. Since
double zeros are common in many data sets, this is a nuisance. In our field
(from which the distance is coming), it is customary to remove double zeros:
contribution to distance is zero when bo...
2001 Mar 05
1
Canberra dist and double zeros
Canberra distance is defined in function `dist' (standard library `mva') as
sum(|x_i - y_i| / |x_i + y_i|)
Obviously this is undefined for cases where both x_i and y_i are zeros. Since
double zeros are common in many data sets, this is a nuisance. In our field
(from which the distance is coming), it is customary to remove double zeros:
contribution to distance is zero when bo...
2013 Jul 02
0
Optimización MINLP
Muy buenas,
Tengo la siguiente duda/problema,
He optimizado con éxito un problema de este tipo:
\sum f(x_i)
donde f es una curva exponencial (función no lineal)
sujeto a:
a_i < x_i < b_i
y
\sum f(x_i) < Presupuesto
Vamos, es repartir un presupuesto forzando a que inviertas como poco a_i y
como mucho b_i para cada i
Esto lo hecho correctamente usando el paquete:
http://cran.r-project.org/w...
2018 Jan 17
1
mgcv::gam is it possible to have a 'simple' product of 1-d smooths?
I am trying to test out several mgcv::gam models in a scalar-on-function regression analysis.
The following is the 'hierarchy' of models I would like to test:
(1) Y_i = a + integral[ X_i(t)*Beta(t) dt ]
(2) Y_i = a + integral[ F{X_i(t)}*Beta(t) dt ]
(3) Y_i = a + integral[ F{X_i(t),t} dt ]
equivalents for discrete data might be:
1) Y_i = a + sum_t[ L_t * X_it * Beta_t ]
(2) Y_i = a + sum_t[ L_t * F{X_it} * Beta_t ]
(3) Y_i = a + sum_t[ L_t * F{X_it,t} ]
where Y_i are sc...
2010 Dec 15
4
Generacion de binomiales correlacionadas
...iones de una distribucion binomial
bivariada en la que hay _cierto_ grado de correlacion (denotemoslo rho).
Podria por favor alguien indicarme como hacerlo en R?
Este es el contexto. Supongamos que se tienen dos experimentos en los que la
variable respuesta _sigue_ una distribucion binomial, i.e., X_i
~Binomial(n_i, p_i), i=1,2 y que, por ahora, n_i y p_i son conocidos. El
interes principal es calcular T = P(X_1=1, X_2=1). Si las X_i''s fueran
independientes (caso 1), seria suficiente generar binomiales con los
parametros correspondientes a cada tipo de experimento (via rbinom) y
calcul...
2009 Oct 01
1
Help for 3D Plotting Data on 'Irregular' Grid
Dear All,
Here is what I am trying to achieve: I would like to plot some data in 3D.
Usually, one has a matrix of the kind
y_1(x_1) , y_1(x_2).....y_1(x_i)
y_2(x_1) , y_2(x_2).....y_2(x_i)
...........................................
y_n(x_1) , y_n(x_2)......y_n(x_i)
where e.g. y_2(x_1) is the value of y at time 2 at point x_1 (see that
the grid in x is the same for the y values at all times).
Instead, in my case, the quantity y is observed at each...
2010 Nov 03
1
Orthogonalization with different inner products
Suppose one wanted to consider random variables X_1,...X_n and from each subtract off the piece which is correlated with the previous variables in the list. i.e. make new variables Z_i so that Z_1=X_1 and Z_i=X_i-cov(X_i,Z_1)Z_1/var(Z_1)-...- cov(X_i,Z__{i-1})Z__{i-1}/var(Z_{i-1}) I have code to do this but I keep getting a "non-conformable array" error in the line with the covariance. Does anyone have any suggestions? Here is my code:
gov=read.table(file.choose(), sep="\t",header=T)...
2009 Jan 15
1
logistic regression - exp(estimates)?
hello.
I have a question on the interpretation of a logistic model.
is it helpful to exponentiate the coefficients (estimates)? I think I
once read something about that, but I cannot remember where.
if so, how would be the interpretation of the exp(estimate) ?
would there be a change of the interpretation of the ANOVA table (or is
the ANOVA table not really helpful at all?).
thanks for your
2005 Dec 01
2
Minimizing a Function with three Parameters
Hi,
I'm trying to get maximum likelihood estimates of \alpha, \beta_0 and
\beta_1, this can be achieved by solving the following three equations:
n / \alpha + \sum\limits_{i=1}^{n} ln(\psihat(i)) -
\sum\limits_{i=1}^{n} ( ln(x_i + \psihat(i)) ) = 0
\alpha \sum\limits_{i=1}^{n} 1/(psihat(i)) - (\alpha+1)
\sum\limits_{i=1}^{n} ( 1 / (x_i + \psihat(i)) ) = 0
\alpha \sum\limits_{i=1}^{n} ( i / \psihat(i) ) - (\alpha + 1)
\sum\limits_{i=1}^{n} ( i / (x_i + \psihat(i)) ) = 0
where \psihat=\beta_0 + \beta_1 * i. Now i want t...
2004 Dec 15
2
how to fit a weighted logistic regression?
I tried lrm in library(Design) but there is always
some error message. Is this function really doing the
weighted logistic regression as maximizing the
following likelihood:
\sum w_i*(y_i*\beta*x_i-log(1+exp(\beta*x_i)))
Does anybody know a better way to fit this kind of
model in R?
FYI: one example of getting error message is like:
> x=runif(10,0,3)
> y=c(rep(0,5),rep(1,5))
> w=rep(1/10,10)
> fit=lrm(y~x,weights=w)
Warning message:
currently weights are ignored in model valida...
2005 Jun 10
1
Estimate of baseline hazard in survival
...e Hosmer and Lemeshow text on Applied Survival Analysis to that of the
help that comes with the survival package.
I am trying to back out the values for the baseline hazard, h_o(t_i), for
each event time or observation time.
Now survfit(fit)$surv gives me the value of the survival function,
S(t_i|X_i,B), using mean values of the covariates and the coxph() object
provides me with the estimate of the linear predictors, exp(X'B).
If S(t_i|X_i,B)=S_o(t_i)^exp(X_iB) is the expression for the survival
function
And
-ln(S_o(t_i) ) is the expression for the cumulative baseline hazard
function, H_o(...