is
satisfied, but the data rows do not overlap at all.
rcoder wrote:
Hi everyone,
I'm trying to calculate correlation coefficients between corresponding
columns in two matrices with identical dimensions but different data. The
problem is that the matrices contain NAs in different locations
Is there something I'm not including in the 'cor' parentheses? I apologise
for not including the true original data frames.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/cor%28%29-btwn-columns-in-two-matrices---no-complete-element-pairs-tp18998875p18998875.html
Sent from the R help
, but the operation
did not fill the results matrix. Coulc anyone offer any advice to assist
with this operation?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/merging-data-sets-to-match-data-to-date-tp18962197p18962197.html
Sent from the R help mailing list archive
of the
syntax for incorporating an AND in a conditional IF statement.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/conditional-IF-with-AND-tp18966890p18966890.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r
Dear Henrique,
This is exactly what I need. Thank you very much for your help!
rcoder
Henrique Dallazuanna wrote:
Try this:
x - data.frame(Dates = seq(as.Date('2008-01-01'),
as.Date('2008-01-31'), by =
'days'),
Values
Thank you all for your replies. This is all very useful information for me!
Ted, thank you very much for the extra explanation and example.
Many thanks,
rcoder
Ted.Harding-2 wrote:
On 13-Aug-08 16:45:27, rcoder wrote:
Hi everyone,
I'm trying to create an if conditional statement
is generated:
Error in if mat[j,k] !=0 { :missing value where TRUE/FALSE needed
I'm not sure how to resolve this.
Thanks,
rcoder
Henrik Bengtsson (max 7Mb) wrote:
FYI,
there is an isZero() in the R.utils package that allows you to specify
the precision. It looks like this:
isZero
)
{
for (k in 1:2000)
{
if(mat[j,k]!=0 !is.NaN(mat[j,k])) {mat_zeroless[j,k]-mat[j,k]}
}
}
##Code End
Error in if (mat[j,k] !=0 !is.NaN(mat[j,k])) { :missing value where
TRUE/FALSE needed
I'm not sure how to resolve this.
rcoder
--
View this message in context:
http
to
an !all(is.na() construct)?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/ignoring-zeros-or-converting-to-NA-tp18948979p18948979.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing
Hi everyone,
Is there a way to vary the increment size in a for loop? For e.g. when
incrementing in steps greater than unity.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/increment-size-in-for-loop-tp18893893p18893893.html
Sent from the R help mailing list archive
Don't worry, I got it:
for(x in seq(1,100,5)) {
print(x)
}
where the step size is 5.
rcoder
rcoder wrote:
Hi everyone,
Is there a way to vary the increment size in a for loop? For e.g. when
incrementing in steps greater than unity.
Thanks,
rcoder
--
View
Hi Gary,
Thanks for your reply. This works fine. Is there any way to send the ACF
data to a matrix, so I could analyse the data in excel for e.g.?
Thanks,
rcoder
Ling, Gary (Electronic Trading) wrote:
Hi, here is one possible solution ...
-gary
### example ###
# create
there is nothing wrong
with the code. I was just wondering if this is normal program execution
speed for such an operation on a P4 with 2GB RAM?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/long-run-time-for-loop-operation---matrix-fill-tp18876372p18876372.html
Sent from
the acf was
calculated between adjacent columns in the matrix, which is something I was
puzzled about.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/using-acf%28%29-for-multiple-columns-tp18858672p18858672.html
Sent from the R help mailing list archive at Nabble.com
),k) in the regression statement - forcing successive slope
data to overwrite cell locations containing intercept data.
Also, the full code takes an awfully long time to run. Would anyone be able
to suggest a way for mee to speed it up - perhaps in the regression
algorithm?
Thanks,
rcoder
Hi,
I guess my question is really more about the nested for loop construct and
whether it is doing what I intend it to do in my code in the previous post.
I would be grateful if anyone who has used nested loops could let me know if
I am doing something wrong.
Thanks,
rcoder
rcoder wrote
,]-Pmult[j,]*mult_col[j,]
}
#rolling regression analysis...
for (k in 1:maxcol) #2nd nested loop
{
sel_col-PmatWt[,k]
if(!all(is.na(sel_col))) {Preg[,k]-coef(lm(tt~sel_col))}
}
}
#Code End
Thanks,
rcoder
--
View this message
Thanks for your reply Gabor.
As I already have a dates column in my dataframe (in column row.names), is
it possible to preserve this whilst still making a data set suitable for
rollapply()?
Thanks,
rcoder
Gabor Grothendieck wrote:
If its regular you can convert it to ts or zoo.
If its
matrix, I lose the dates in the row.names column. I just want to know if
anyone could suggest a way to get around this problem, i.e. keep the
row.names column in place, and use the rollapply() statement as above.
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/losing
and examples. Any suggestions would be grately appreciated.
Many thanks,
rcoder
Gabor Grothendieck wrote:
That's good. Try this:
1. put set.seed(1) at the top of the code to make it reproducible.
2. replace body of loop with:
sel_col-SourceMat[, i]
out - try(coef(lm(tt~sel_col
in the parentheses? One way
would be to introduce an if statement, but is this the only way?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/rollapply%28%29-to-portions-of-a-matrix-tp18761906p18761906.html
Sent from the R help mailing list archive at Nabble.com
in the
matrix in
turn
SourceMat[,i]-coef(lm(tt~sel_col), na.action=NULL)
}
Thanks,
rcoder
rcoder wrote:
Hi everyone,
I'm having trouble applying the Cor() function to two matrices, both of
which contain NAs. I am doing the following:
a-cor(m1, m2, use
in the
matrix in turn
SourceMat[,i]-coef(lm(tt~sel_col), na.action=NULL)
}
Thanks,
rcoder
Gabor Grothendieck wrote:
Read the last line of every message to r-help.
On Tue, Jul 29, 2008 at 6:15 PM, rcoder [EMAIL PROTECTED] wrote:
Hi everyone,
I am trying to apply linear
)
{
sel_col-SourceMat[col(SourceMat)==i] #selecting the correct column
in the matrix in turn
ResultMat[,i]-coef(lm(tt~sel_col, na.action=NULL))
}
##Code end
I would be grateful for any suggestions to avoid this problem.
Thanks,
rcoder
rcoder wrote
know how I can apply a correlation, ignoring any NAs?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/correlation-between-matrices---both-with-some-NAs-tp18721853p18721853.html
Sent from the R help mailing list archive at Nabble.com
Hi Gabor,
Thanks for your reply. Assuming I have a time series that is ready made
(i.e. not constructed it using a zoo function) will the procedure below
still retain the dates in the matrix?
Thanks,
rcoder
quote author=Gabor Grothendieck
rollapply along an index:
library(zoo)
z - zoo(matrix
rollapply(), the
columns are not recognised and the regression breaks down. Is there a more
robust way to reference the columns I need, so that I can apply the
regression across the matrix; 'by.column', but every other column?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com
Hi everyone,
Is there a way to perform a rollapply operation on a time series data matrix
and preserve the time frame? Currently, when I apply rollapply in its
standart form, the date column is no longer present in the o/p matrix.
Thanks,
rcoder
--
View this message in context:
http
rcoder wrote:
Hi everyone,
Is there a way to perform a rollapply operation on a time series data
matrix and preserve the time frame? Currently, when I apply rollapply in
its standart form, the date column is no longer present in the o/p matrix.
Thanks,
rcoder
--
View
Hi everyone,
I want to perform an operation on a matrx that outputs the product of
successive pairs of rows. For example: calculating the product between rows
1 2; 3 4; 5 6...etc.
Does anyone know of any readily available functions that can do this?
Thanks,
rcoder
--
View this message
Hi everyone,
Using the rolling regression function - rollingRegression(formula, data,
width, ...) - is there a way to output only selected coefficients to a
results matrix. For e.g. if I only wanted the slope coefficients to be
recorded, how would I go about doing this?
Thanks,
Michael
--
of sequential rows in a preceeding
matrix: i.e. rows 1*2 - row 1 in o/p matrix; rows2*3- row 2; rows
4*5-row3 etc.
Thanks,
rcoder
stephen sefick wrote:
how about rollapply in the zoo package?
On Fri, Jul 25, 2008 at 8:37 AM, rcoder [EMAIL PROTECTED] wrote:
Hi Achim,
Thanks for your
to a separate
matrix.
On a separate matter, I have a matrix containing data on which perform a
regresssion over a rolling time period. Is there a convenient way I can do
this for each column, and then save the gradient to an o/p matrix?
Thanks,
rcoder
--
View this message in context:
http
be grateful for any suggestions on this slight modification.
Otherwise, I can make do with my version.
Thanks,
rcoder
rcoder wrote:
Thank you Ben! This is very clear.
rcoder
Ben Tupper wrote:
On Jul 15, 2008, at 5:16 PM, rcoder wrote:
Hi Ben,
Yes, this is more or less what I
ranges for
data matrix
mm[,n]-range(mat[,n],na.rm=T) #inserts min/max values into sc
matrix
for (m in 1:nr) {
sc[m,n]-100*(mat[m,n]-mm[1,n])/(mm[2,n]-mm[1,n]) #re-scaling onto
percentile ranking
}
}
rcoder
rcoder
Hi everyone,
I want to score a set of data (-ve to +ve) using a 0-10 scale. I have the
data in an R matrix, so I need to add another column, containing the scores
and resave.
I would be grateful for suggestions on how best to do this.
Thanks,
rcoder
--
View this message in context:
http
Hi everyone,
I want to score a set of data (-ve to +ve) using a 0-10 scale. I have the
data in an R matrix, so I need to add another column, containing the scores
and resave.
I would be grateful for suggestions on how best to do this.
Thanks,
rcoder
--
View this message in context:
http
,
rcoder
Ben Tupper wrote:
On Jul 15, 2008, at 8:16 AM, rcoder wrote:
Hi everyone,
I want to score a set of data (-ve to +ve) using a 0-10 scale. I
have the
data in an R matrix, so I need to add another column, containing
the scores
and resave.
Hi,
I am a little fuzzy on what
Thank you Ben! This is very clear.
rcoder
Ben Tupper wrote:
On Jul 15, 2008, at 5:16 PM, rcoder wrote:
Hi Ben,
Yes, this is more or less what I want to do. I want to apply this
data in
columns in a matrix, and insert the results to additional columns.
I am not
entirely aware
This is great! Thank you very much Gabor.
rcoder
Gabor Grothendieck wrote:
See ?lag and in zoo ?lag.zoo. Both pages have
examples. Using lag.zoo here it is with your data:
Lines - Date Apples Oranges Pears
1/7 2 35
2/7 1 47
3/7
,
rcoder
Gabor Grothendieck wrote:
If its a zoo or ts time series you can use the lag function.
On Wed, Jul 9, 2008 at 2:57 PM, rcoder [EMAIL PROTECTED] wrote:
Hi everyone,
I have some data in a matrix, and I want to shift it down by one row. The
matrix in question has a date column
location?
Thanks,
rcoder
--
View this message in context:
http://www.nabble.com/shifting-data-in-matrix-by-n-rows-tp18368420p18368420.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch
code, at least provide a before/after version of
the matrix that you would like. It is easy to use indexing to move
stuff around, we just have to know what is it that you want to move.
On Wed, Jul 9, 2008 at 2:57 PM, rcoder [EMAIL PROTECTED] wrote:
Hi everyone,
I have some data in a matrix
43 matches
Mail list logo