search for: ind1

Displaying 20 results from an estimated 40 matches for "ind1".

Did you mean: ind
2010 Jan 17
3
enty-wise closest element
Dear R-users, i have a simple problem maybe, but i don't see the solution. i want to find the entry-wise closest element of an vector compared with another. ind1<-c(1,4,10) ind2<-c(3,5,11) for (i in length(ind2):1) { print(which.min(abs(ind1-ind2[i]))) } for ind2[3] it should be ind1[3] 10, for ind2[2] it should be ind1[2] 4 and for ind2[1] it should be ind1[1] 1. but with the for-loop above i get ind1[3], ind1[2] and ind1[2]. any suggestions a...
2011 Mar 09
2
Cleaning date columns
Hi Everyone, I have the following problem: data <- structure(list(prochi = c("IND1", "IND1", "IND1", "IND2", "IND2", "IND2", "IND2", "IND3", "IND4", "IND5"), date_admission = structure(c(6468, 6470, 7063, 9981, 9983, 14186, 14372, 5129, 9767, 11168), class = "Date")), .Name...
2006 Mar 09
1
HCLUST subroutine question -- FORTRAN DO loops
...J2=MAX0(IM,JM) IA(N-NCL)=I2 IB(N-NCL)=J2 CRIT(N-NCL)=DMIN FLAG(J2)=.FALSE. C C Update dissimilarities from new cluster. C DMIN=INF DO 50 K=1,N IF (.NOT.FLAG(K)) GOTO 50 IF (K.EQ.I2) GOTO 50 IF (I2.LT.K) THEN IND1=IOFFST(N,I2,K) ELSE IND1=IOFFST(N,K,I2) ENDIF IF (J2.LT.K) THEN IND2=IOFFST(N,J2,K) ELSE IND2=IOFFST(N,K,J2) ENDIF IND3=IOFFST(N,I2,J2)...
2009 Sep 11
2
Accumulating results from "for" loop in a list/array
...ot;n"), c = c(rep("n",7),rep("y",3)), d = c("y", rep("n",4), rep("y",2), rep("n",3))) for (i in 1:(dim(x)[2])) { assign(paste("ind", i, sep = ""), which(x[ , i] == "y")) accum <- c(ind1, ind2, ind3, ind4) } > ind1 [1] 4 5 9 10 > ind2 [1] 1 2 7 8 9 > ind3 [1] 8 9 10 > ind4 [1] 1 6 7 > accum [1] 4 5 9 10 1 2 7 8 9 8 9 10 1 6 7 Are there any alternative method where the highlighted statement above can be represented without typing individual object...
2011 Mar 10
2
within group sequential subtraction
Hi Everyone, I would like to do sequential subtractions within a group so that I know the time between separate observations for a group of individuals. My data: data <- structure(list(group = c("IND1", "IND1", "IND2", "IND2", "IND2", "IND3", "IND4", "IND5", "IND6", "IND6"), date_obs = structure(c(6468, 7063, 9981, 14186, 14372, 5129, 9767, 11168, 10243, 10647), class = "Date")), .Names =...
2010 May 03
3
how to rewrite this for loops in matrix form without loop
x0=rnorm(100) y0=rpois(100,3)+1 ind=as.data.frame(table(y0)) ind1=ind[,1] ind2=ind[,2] phi=NULL for (i in 1:length(ind2)){ phi[i]=sum(x0[y0==ind1[i]])/ind2[i] } [[alternative HTML version deleted]]
2011 Dec 04
2
frequency table?
...occur in as rows. And I wanted a table which tells me how many times each individual occurs with another. I don't really know how such a table is called...it is not a frequency table....My eventual goal is to make Venn-diagrams from the occurence of my individuals. So I've this: cluster ind1 ind2 ind3 etc. 1 0 1 2 2 3 0 1 3 1 1 1 And I want to go to this: ind1 ind2 ind3 ind1 0 4 2 ind2 4 0 4 ind3 2 4 1 is there a way to do this?...
2011 Dec 03
1
pivot table help
...each individual belongs to different clusters and can occurs multiple times within a cluster (that's the reason that there can be more than 8 members). I want a presence/ absence table for each individual within each cluster. So I want to go from: Cluster Member1 Member2 etc. 1 ind1 ind2 2 ind3 ind1 3 ind2 ind1 to cluster ind1 ind2 ind3 1 1 1 0 2 1 0 1 3 1 1 0 Has anybody any idea how I can do this? I alre...
2011 Dec 04
1
similarity matrix
...39;ve got a file with individuals as colums and the clusters where they occur in as rows. And I wanted a similarity matrix which tells me how many times each individual occurs with another. My eventual goal is to make Venn-diagrams from the occurence of my individuals. So I've this: cluster ind1 ind2 ind3 etc. 1 0 1 2 2 3 0 1 3 1 1 1 And I want to go to this: ind1 ind2 ind3 ind1 0 4 2 ind2 4 0 4 ind3 2 4 1 is there a way to do this?...
2006 Feb 10
1
precision of std. error in summary
Hi, I'm doing robust regression with the following command rlm(dip~ind1+ind2-1,method="M",psi=psi,maxit=1000,acc=1e-15) now when I ask for a summary summary(rlm(dip~ind1+ind2-1,method="M",psi=psi,maxit=1000,acc=1e-15)) I get Coefficients: Value Std. Error t value ind1 -0.0377 0.0000 -24203.1415 ind2 1.0370 0.00...
2005 Apr 25
6
Proba( Ut+2=1 / ((Ut+1==1) && (Ut==1))) ?
Dear all, First I apologize if my question is quite simple, but i'm very newbie with R. I have vectors of the form v = c(1,1,-1,-1,-1,1,1,1,1,-1,1) (longer than this one of course). The elements are only +1 or -1. I would like to calculate : - the frequencies of -1 occurences after 2 consecutives -1 - the frequencies of +1 occurences after 2 consecutives +1 It looks probably something like
2005 Jan 17
2
Omitting constant in ols() from Design
Hi! I need to run ols regressions with Huber-White sandwich estimators and the correponding standard errors, without an intercept. What I'm trying to do is create an ols object and then use the robcov() function, on the order of: f <- ols(depvar ~ ind1 + ind2, x=TRUE) robcov(f) However, when I go f <- ols(depvar ~ ind1 + ind2 -1, x=TRUE) I get the following error: Error in ols(nareit ~ SnP500 + d3yrtr - 1) : length of dimnames [2] not equal to array extent same with +0 instead of -1. Is there a different way to create an ols obj...
2015 Nov 20
1
Good practice for naming classes, builders, attributes, getters/setters for object composition
...to use upper case letters. My problem is that, when I build an object containing an other object (of an other class), at the end my getters can have the same name as my builders. Here is an example. Lets define a first class "bonds" to store atomic bonds information: bonds <- function(ind1, ind2, order){ obj <- data.frame(ind1 = ind1, ind2 = ind2, order = order) class(obj) <- c("bonds", class(obj)) return(obj) } Now I when to define an other class to store atomic properties. As atoms can be bonded to each other, I add a "bonds" attribute which is of c...
2011 Aug 10
2
choosing selective data with permutations
Hello, I am a R beginner and hoping to obtain some hints or suggestions about using permutations to sort a data set I have. Here is an example dataset: Ind1 11 00 12 15 28 Ind2 21 33 22 67 52 Ind3 22 45 21 22 56 Ind4 11 25 74 77 42 Ind5 41 32 67 45 22 This will be read into a variable using read.table. What I want to do is permute these individuals and every time pick 3 individuals and write them to a new variable. I...
2009 Aug 09
1
problem adding columns to matrix
...ometrics with R by Springer. at the end of each chapter there are exercises to train what you just read and (hope) learned... so i have this problem: Define a hypothetical data frame containing five measurments normally distributed(size,head,pectoral,area,weight) for four individuals (named ind1, ind2, etc). ADD A COLUMN corresponding to the factor sex with individual 1 & 2 being Males and 3 & $ being Females. HERE IS HOW I PROCEDED, getting 2 problems 1) what are those warning messages i got when i generate the m matrix (the italian text stand for "the numerical expres...
2003 Jun 05
1
Logical vectors
Hi everybody, just a quick question that drives me crazy: Is it possible to "join" 2 logical vectors ? i.e. x<-4 ind <- 1:19200 pin <- c(0, rep(400, 48) * (1:48)) ind1<-((pin[j] + 1) <= ind) & (ind <= pin[j + 2]) ind2<-((pin[j+x] + 1) <= ind) & (ind <= pin[j+x + 2]) ind2 and ind1 give the right TRUE index #but I would like something like that ind3<-((pin[j] + 1) <= ind) & (ind <= pin[j + 2]) & ((pin[j+x] + 1) <= in...
2009 Jul 09
1
Converting indices of a matrix subset
...1 1 1 1 > m2 <- matrix(0,3,3) > diag(m2) <- 1 > m2 [,1] [,2] [,3] [1,] 1 0 0 [2,] 0 1 0 [3,] 0 0 1 I want to get indicies from m2 such that they match indicies as though they came from the lower right of m1. Here's how things work: > ind1 <- which(m1 == 1) > ind1 [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 > ind2 <- which(m2 == 1) > ind2 [1] 1 5 9 I would like ind2 to be offset so they look like indicies from the lower right of m1: > ind2 [1] 6 11 16 I can be done with a simple offset when using arr.ind...
2008 Aug 21
1
summary.lme and anova question
...w is: Is the anova.lme() approach correct for that model? And why does the F-test for CO2 yield a non-significant P-value, while the t-test in the summary.lme() is significant? Many thanks for your help! Best wishes Christoph ###################################################### mod11=lme(log(ind1+1) ~ CO2*DROUGHT*TEMP, random=~1|B/C,na.action=na.exclude) summary(mod11) Linear mixed-effects model fit by REML Data: NULL AIC BIC logLik 97.3077 115.6069 -37.65385 Random effects: Formula: ~1 | B (Intercept) StdDev: 1.303146e-05 Formula: ~1 | C %in% B (Intercep...
2011 Feb 07
1
multiple imputation manually
...,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 random. Now I would like to apply s...
2011 Dec 05
1
Subsetting a data frame
Hi R users, I really need help with subsetting data frames: I have a large database of medical records and I want to be able to match patterns from a list of search terms . I've used this simplified data frame in a previous example: db <- structure(list(ind = c("ind1", "ind2", "ind3", "ind4"), test1 = c(1, 2, 1.3, 3), test2 = c(56L, 27L, 58L, 2L), test3 = c(1.1, 28, 9, 1.2)), .Names = c("ind", "test1", "test2", "test3"), class = "data.frame", row.names = c(NA, -4L)) terms_...