Displaying 20 results from an estimated 2000 matches similar to: "complex matrix manipulation question"
2006 Jan 09
6
R newbie example code question
Sometimes I print out a package
and read about it and there
are sometimes nice examples
that I would like to run myself.
 
Is there a way to bring them
into R from the package or
are they only meant to be typed
in manually ? If manual is the
only way, that's fine. I was
just checking whether there was
a quicker way. Thanks.
 
                           Mark
2006 Jan 04
1
R newbie configuration
I think I did enough reading on my
Own about startup ( part of the morning
And most of this afternoon )
to not feel uncomfortable asking
for confirmation of my understanding of this startup stuff.
 
Obviously, the startup process is more complicated
Than below but, for my R newbie purposes,
It seems like I can think of the startup process as follows :
 
Suppose my  home directory =
2006 Jan 11
2
a series of 1's and -1's
Does anyone know of a simple test
in any R package that given
a series of negative ones and positive
ones ( no other values are possible in the series )
returns a test of whether the series is random or not.
( a test at each point would be good but
I can use the apply function to implement
that ) ?
 
                                       thanks.
                                 
2006 Jan 03
5
newbie R question
I'm sorry to bother everyone with a stupid
question but, when I am at an R prompt in Windows,
is there a way to see what packages
you already have installed from the R site so
that you can just do library(name_of_package)
and it will work.
 
I've looked at help etc but I can't find
a command like this. Maybe there
isn't one which is fine.
 
                                         
2005 Dec 29
1
R and read.irts
I thought r-help let you
attach asci files but
I don't think it does now
so below is a sample of my data set.
 
Thanks again.
 
09:40:08.5238,67.00,33
09:40:09.1968,67.00,2
09:40:09.7945,67.00,2
09:40:09.7975,67.00,2
09:40:09.8318,66.99,-3
09:40:17.6335,66.95,3
09:41:09.3393,66.95,6
09:41:11.1482,66.95,-1
09:42:07.4552,66.90,-5
09:42:12.5823,66.85,-5
09:42:14.4329,66.80,-2
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 algebraically
2006 Jan 05
0
.Rprofile files (was R newbie configuration)
Thanks a lot. setHook is
Currently not in my knowledge set
But it's great to save these
Thing so I can look them up
When I  feel more comfortable.
Just to add to that Stata versus R discussion :
I believe, anyone who uses
any other package than R, is probably missing
out in the long run. It's truly unbelievable
what has been done here. I feel like I
fell asleep for 5 years ( by not using
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|) /
2010 Nov 28
1
faster base::sequence
Hello,
Based on yesterday's R-help thread (help: program efficiency), and 
following Bill's suggestions, it appeared that sequence:
 > sequence
function (nvec)
unlist(lapply(nvec, seq_len))
<environment: namespace:base>
could benefit from being written in C to avoid unnecessary memory 
allocations.
I made this version using inline:
require( inline )
sequence_c <- local( {
2011 Sep 14
1
Hints for Data Mining
Dear All,
I am recycling a previous email of mine where I asked some 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
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
2010 Sep 24
3
boundary check
Dear R,
I have a covariates matrix with 10 observations,  e.g.
> X <- matrix(rnorm(50), 10, 5)
> X
             [,1]        [,2]        [,3]        [,4]       [,5]
 [1,]  0.24857135  0.30880745 -1.44118657  1.10229027  1.0526010
 [2,]  1.24316806  0.36275370 -0.40096866 -0.24387888 -1.5324384
 [3,] -0.33504014  0.42996246  0.03902479 -0.84778875 -2.4754644
 [4,]  0.06710229  1.01950917
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
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 both x_i
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 both x_i
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
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).
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. 
2005 Jun 10
1
Estimate of baseline hazard in survival
Dear All,
I'm having just a little terminology problem, relating the language used in
the 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),
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} (