search for: ind0

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

Did you mean: ind
2009 Apr 23
2
Two 3D cones in one graph
...-seq(-astar,astar,len=50) ystar<-seq(-bstar,bstar,len=50) g<-expand.grid(x=xstar,y=ystar) p1<-2*g$x*mu[1]/a**2+2*g$y*mu[2]/b**2 p2<-(g$x**2/a**2+g$y**2/b**2) p3<-mu[1]**2/a**2+mu[2]**2/b**2-1 q<-(p1+sqrt(p1**2-4*p2*p3))/(2*p2) z<-sqrt(1-(q*g$x)**2-(q*g$y)**2) zstar<-(z/q) ind0<-!(q<1) g$z<-zstar sc<-matrix(c(rep(c(-1,-1,-1),sum(ind0))),nrow=sum(ind0),byrow=TRUE) gstar<-rbind(g[ind0,],sc*g[ind0,]) group<-c(rep(1,nrow(gstar)/2),rep(2,nrow(gstar)/2)) gstar$group<-group wireframe(z~x*y|group,gstar,colorkey=TRUE,drape=TRUE, scales=list(arrows=FALSE))
2011 Feb 07
1
multiple imputation manually
...0,8) x2 <- 1+2*y2+ rnorm(20,0,8) x3 <- 1+2*y3+ rnorm(20,0,8) x4 <- 1+2*y4+ rnorm(20,0,8) x <- c(x1,x2,x3,x4) mcar.y <- rep(NA,80) y.mis <- rep(NA,80) df <- data.frame(y=y, y.mis=y.mis, mcar.y=mcar.y, x=x) df$y.mis <- df$y for (j in 1:80) { df$mcar.y <- rbinom(80,1,0.15) } ind0 <- which(df$mcar.y==0) ind1 <- which(df$mcar.y==1) if (length(ind0) > 68) { df$mcar.y[sample(ind0, length(ind0) - 68)] <- 1 } else { df$mcar.y[sample(ind1, 68 - length(ind0))] <- 0 } df$y.mis[df$mcar.y==1] <- NA This gives me data sets with missing values completely at ran...
2003 May 09
1
manipulating elements of a matrix
Dear R users: I have the following matrix. 0 1 1 0 1 0 2 1 0 3 0 0 I would like to spread the matrix such that whenever the row sum is greater than 1 the row is repeated the number of times given by the row sum. Furthermore I would like to split the following cases: 0 1 1 such that it map to the following matrix 0 1 0 0 0 1 such that each row adds up to 1. I have no problems with cases