search for: jhainm

Displaying 5 results from an estimated 5 matches for "jhainm".

2005 Jul 26
4
elegant solution to transform vector into percentages?
Hi, I am looking for an elegant way to transform a vector into percentages of values that meet certain criteria. store<-c(1,1.4,3,1.1,0.3,0.6,4,5) # now I want to get the precentages of values # that fall into the categories <=M , >M & <=N , >N # let M <-.8 N <- 1.2 # In my real example I have many more of these cutoff-points # What I did is: out <- matrix(NA,1,3)
2005 Jul 20
3
Prefix for colnames
Hi, I would like to add a prefix to colnames in a matrix but I can't get the prefix option in colnames to work. What am I doing wrong? > X<-matrix(NA,3,4) > colnames(X)<-c("test","test","test","test") > colnames(X)<-colnames(X,prefix="PREFIX.") > X test test test test [1,] NA NA NA NA [2,] NA NA NA NA
2005 Oct 13
3
Optim with two constraints
Hi R-list, I am new to optimization in R and would appreciate help on the following question. I would like to minimize the following function using two constraints: ###### fn <- function(par,H,F){ fval <- 0.5 * t(par) %*% H %*% par + F%*% par fval } # matrix H is (n by k) # matrix F is (n by 1) # par is a (n by 1) set of weights # I need two constraints: # 1.
2005 Nov 29
0
sensitivity tests fo causal inference
Hi all, Following up on Holger's email last week: Does anyone know if there exists a library that implements the sensitivity tests for hidden bias for matched pairs and unmatched groups as proposed in Rosenbaum's Observational Studies (2002: ch.4)? Thanks. Best, jens
2006 Aug 04
2
why does lm() not allow for negative weights?
Dear List, Why do commonly used estimator functions (such as lm(), glm(), etc.) not allow negative case weights? I suspect that there is a good reason for this. Yet, I can see reasonable cases when one wants to use negative case weights. Take lm() for example: ### n <- 20 Y <- rnorm(n) X <- cbind(rep(1,n),runif(n),rnorm(n)) Weights <- rnorm(n) # Includes Pos and Neg Weights Weights