similar to: Running cumulative sums in matrices

Displaying 20 results from an estimated 20000 matches similar to: "Running cumulative sums in matrices"

2009 Mar 25
2
Competing risks Kalbfleisch & Prentice method
Dear R users I would like to calculate the Cumulative incidence for an event adjusting for competing risks and adjusting for covariates. One way to do this in R is to use the cmprsk package, function crr. This uses the Fine & Gray regression model. However, a simpler and more classical approach would be to implement the Kalbfleisch & Prentice method (1980, p 169), where one fits cause
2009 Oct 29
2
fast cumulative matrix multiplication
Hi all, I am looking for a function like cumprod() that works for matrix multiplication. In other words, I have matrices [M1, M2, ..., Mn], and I want to calculate [M1, M1%*%M2, M1%*%M2%*%M3, ..., M1%*%...%*%Mn] as quickly as possible. Right now I'm using a for() loop but it seems like there should be a faster way. Any help is appreciated! Thanks, Todd Schneider todd.w.schneider@gmail.com
2009 Oct 13
2
update.formula drop interaction terms
Dear R users, How do I drop multiplication terms from a formula using update? e.g. forml=as.formula("Surv(time, status) ~ x1+x2+A*x3+A*x4+B*x5+strata(sex)") #I would like to drop all instances of variable A (the main effect and its interactions). The following: updated.forml=update(forml, ~ . -A) #gives me this: #Surv(time, status) ~ x1 + x2 + x3 + x4 + B + x5 + strata(sex) + A:x3 +
2009 Nov 23
1
Calibration score for survival probability
Good afternoon! I need to evaluate the goodness-of-fit (aka calibration) for survival probability estimates from a Cox model. I tried to use 'calibrate' in the Design package but I'm not sure if it should/would produce what I need (ie a chi-sq type statistic with a table of expected vs observed probabilities). Any other functions I should be aware of? Also, has anybody come across
2010 Dec 10
1
survreg vs. aftreg (eha) - the relationship between fitted coefficients?
Dear R-users, I need to use the aftreg function in package 'eha' to estimate failure times for left truncated survival data. Apparently, survreg still cannot fit such models. Both functions should be fitting the accelerated failure time (Weibull) model. However, as G?ran Brostr?m points out in the help file for aftreg, the parameterisation is different giving rise to different
2009 May 20
1
turning off specific types of warnings
Dear R users, I have a long function that among other things uses the "survest" function from the Design package. This function generates the warning: In survest.cph (...) S.E. and confidence intervals are approximate except at predictor means. Use cph(...,x=T,y=T) (and don't use linear.predictors=) for better estimates. I would like to turn this specific warning off, as it
2011 Jun 24
1
UnoC function in survAUC for censoring-adjusted C-index
Hello, I am having some trouble with the 'censoring-adjusted C-index' by Uno et al, in the package survAUC. The relevant function is UnoC. The question has to do with what happens when I specify a time point t for the upper limit of the time range under consideration (we want to avoid using the right-end tail of the KM curve). Copying from the example in the help file: TR <-
2013 Sep 05
2
binary symmetric matrix combination
Hi, May be this helps: m1<- as.matrix(read.table(text=" y1 g24 y1 0 1 g24 1 0 ",sep="",header=TRUE)) m2<-as.matrix(read.table(text="y1 c1 c2 l17 ?y1 0 1 1 1 ?c1 1 0 1 1 ?c2 1 1 0 1 ?l17 1 1 1 0",sep="",header=TRUE)) m3<- as.matrix(read.table(text="y1 h4??? s2???? s30 ?y1 0 1 1 1 ?h4 1 0 1 1 ?s2 1 1 0 1 ?s30 1 1 1
2012 Mar 08
4
Correlation between 2 matrices but with subset of variables
Dear All, I have two matrices A (40 x 732) and B (40 x 1230) and would like to calculate correlation between them.  I can use: cor(A,B, method="pearson") to calculate correlation between all possible pairs. But the issue is that there is one-many specific mappings between A and B and I just need to calculate correlations for those pairs (not all). Some variables in A (proteins, say p1)
2009 Feb 16
1
How do i compute predicted failure time from a cox model?
Given a cox model: library(Hmisc); library(survival); (library(Design); cox.model=cph(Surv(futime, fustat) ~ age, data=ovarian, surv=T) str(cox.model) What I need is the total estimated time until failure (death), not the probability of failing at a given time (survival probability), or hazard etc, which is what I get from survest and predict for example. I suspect the answer is
2012 Oct 23
1
Testing proportional odds assumption in R
I want to test whether the proportional odds assumption for an ordered regression is met. The UCLA website points out that there is no mathematical way to test the proportional odds assumption (http://www.ats.ucla.edu/stat//R/dae/ologit.htm), and use graphical inspection ("We were unable to locate a facility in R to perform any of the tests commonly used to test the parallel slopes
2008 Nov 06
2
comparing matrices using max or min
Dear all, I have 3 matrices with the same dimension, A,B,C and I would like to produce a matrix D where in each position would retrieve the max(or min) value along A,B,C taken from the same position. I guess that apply functions should fit, but for matrices objects I am not getting it. thanks in advance, Diogo André Alagador [[alternative HTML version deleted]]
2011 Jan 03
3
matrices call a function element-wise
Hello I have 4 1000*1000 matrix A,B,C,D. I want to use the corresponding element of the 4 matrices. Using the "for loop" as follow: E<-o for (i in 1:1000) {for (j in 1:1000) { E<-fisher.test(matrix(c(A[i][j],B[i][j],C[i][j],D[i][j]),2))#call fisher.test for every element } } It is so time-consuming Need vectorization Yours sincerely ZhaoXing Department of
2010 Nov 17
2
slicing list with matrices
A list contains several matrices. Over all matrices (list elements) I'd like to access one matrix cell: m <- matrix(1:9, nrow=3, dimnames=list(LETTERS[1:3], letters[1:3])) l <- list(m1=m, m2=m*2, m3=m*3) l[[3]] # works l[[3]][1:2, ] # works l[[1:3]][1, 1] # does not work How can I slice all C-c combinations in the list? S?ren -- S?ren Vogel, Dipl.-Psych. (Univ.), PhD-Student, Eawag,
2005 Feb 10
5
Annual cumulative sums from time series
Hello world, I am actually transferring a course in data management for students in biology, geography and agriculture from statistica to R - it works surprisingly well. If anyone is interested in my scratch/notepad (in German language), please see www.hydrology.uni-kiel.de/~schorsch/statistik/statistik_datenauswertung.pdf (pages 40-52) The dataset is:
2012 Nov 09
6
(sin asunto)
Saludos, tengo un problema que no puedo resolver dentro del R Estoy creando una funcion que a partir de un objeto compuesto por diferentes matrices como el que esta a continuacion: [[1]] M1 M2 M3 M4 sp1 2 0 1 8 sp2 4 5 2 4 sp3 0 0 4 0 sp4 5 7 5 0 sp5 0 4 0 0 [[2]] M3 M2 M4 M1 sp1 1 0 8 2 sp2 2 5 4 4 sp3 4 0 0 0 sp4 5 7 0 5 sp5 0 4 0 0 [[3]]
2013 Mar 26
2
Plot cumulative sums of rainfall per year
Hi @all, I am biting my nails with the following problem: I have a data set of daily rainfall measurements for the last 20 years. What I want to do is calculate the daily cumulative sum of rainfall but only for every year which means that the cumulative sum has to be reset each year. After the calculations I want to plot each year of cumulative rainfall as a separate line in one graph preferably
2017 Jun 06
4
integrating 2 lists and a data frame in R
Dear Bert, thank you for your response. here it is the piece of R code : given 3 data frames below --- N <- data.frame(N=c("n1","n2","n3","n4")) M <- data.frame(M=c("m1","m2","m3","m4","m5")) C <- data.frame(n=c("n1","n2","n3"),
2017 Jun 06
0
integrating 2 lists and a data frame in R
Hi Bogdan, Kinda messy, but: N <- data.frame(N=c("n1","n2","n3","n4")) M <- data.frame(M=c("m1","m2","m3","m4","m5")) C <- data.frame(n=c("n1","n2","n3"), m=c("m1","m1","m3"), I=c(100,300,400))
2011 Dec 03
1
partial mantel tests in ecodist with intential NA values.
I would like to perform partial mantel tests on only within group values, with "between group" values assigned to NA. This is possible in package ncf partial.mantel.test, however this sues a different permutation to that used in ecodist.ecodist will not accept data with NA values, returning a "matrix is not square error. is it possible to perform this test in ecodist? many thanks