search for: comb3

Displaying 3 results from an estimated 3 matches for "comb3".

Did you mean: combo
2012 Apr 05
1
integrate function - error -integration not occurring with last few rows
...mb2$TIME[p] comb2$frac[p]<-ifelse ( comb2$DOSE[p]==3, comb2$beta31[p]*comb2$TIME[p]^comb2$beta32[p], exp(-comb2$beta21[p]*comb2$DOSE[p])*comb2$TIME[p]^comb2$beta22[p] ) } hz.func1<-function(t,bshz,beta1, change,other) { ifelse(t==0,bshz, bshz*exp(beta1*change+other)) } comb3<-comb2 comb3$integral=0 q<-0 for (m in i:length(comb3$ID)) { q<-q+1 comb3$integral[q]<-integrate(hz.func1, lower=0, upper=comb3$TIME[q], bshz=comb3$bshz[q],beta1=comb3$beta1[q], change=comb3$disprog[q], other=comb3$frac[q])$value } #comb3[comb3$TIME==3, ] # #tail(co...
2012 Apr 08
1
Avoid loop with the integrate function
...2*exp(rnorm(1,0,0.01)) ed$frac[k]<-0.5*exp(rnorm(1,0,0.1)) } comb1<-merge(data1[, c("ID","TIME")], ed) comb2<-comb1 comb2$score<-comb2$base*exp(-comb2$drop*comb2$TIME) func1<-function(t,cov1,beta1, change,other) { ifelse(t==0,cov1, cov1*exp(beta1*change+other)) } comb3<-comb2 comb3$cmhz=0 comb3<-comb3[order(comb3$ID, comb3$TIME), ] for (q in 1:length(comb3$ID)) { comb3$cmhz[q]<-integrate(func1, lower=0, upper=comb3$TIME[q], cov1=0.001,beta1=0.02, change=comb3$score[q], other=comb3$frac[q])$value } head(comb3) [[alternative HTML versi...
2012 Mar 25
2
avoiding for loops
I have data that looks like this: > df1 group id 1 red A 2 red B 3 red C 4 blue D 5 blue E 6 blue F I want a list of the groups containing vectors with the ids. I am avoiding subset(), as it is only recommended for interactive use. Here's what I have so far: df1 <- data.frame(group=c("red", "red", "red", "blue",