search for: firstdiff

Displaying 2 results from an estimated 2 matches for "firstdiff".

2009 Aug 04
2
Caculate first difference from a dataframe; write a simulation
...############################### ##Question1:I want to calculate the first difference of mydat4[,1:2] t<-diff(mydat4[,1:2],1) #The command fails, why? Because it fails I've written a code for calculating the first diff c<-dim(mydat4) e<-mydat4[-c[1],] dim(e) f<-mydat4[-1,] dim(f) #f firstDiff<-data.frame(f[,-c(3:4)]-e[,-c(3:4)]) # Draw a random sample for the first differences d<-dim(mydat3) z<-mydat3[d[1],1:2] z.t<-t(z) x<-data.frame(t(firstDiff[,1:2])) y<-sample(x[,1:2],1,replace=T) ad<-z.t+y ##Output of ad is given below ad X6 Level 5.04 spread 0.25 ##...
2009 Aug 05
1
writing a simulation
...t3[[1]],q,include.lowest=T) summary(z.level) q<-quantile(mydat3[[2]],c(0,0.25,0.75,1)) z.shape<-cut(mydat3[[2]],q,include.lowest=T) summary(z.shape) table(z.shape,z.level) mydat3$State<-as.numeric(interaction(z.shape,z.level,sep="")) #the clue on interaction was a great help firstDiff<-data.frame(apply(mydat3[,1:2],2,diff)) # the clue of using apply to use diff was very helpful ################################################################################# # Draw a random sample for the differences d<-dim(mydat3) z<-mydat3[d[1],1:2] z.t<-t(z) x<-data.frame(t(f...