Displaying 4 results from an estimated 4 matches for "groupvec".
2006 May 12
3
optimal way to compute matrix subtotals?
Hi!
I have large matrices, one column per variable and I have a vector of factors / grouping symbols. Then I am computing subtotals for the groups but it takes pretty long and thus I wanted to ask if there is a better way to do it or if this is already the best way:
subTotals <- function(x, groupvec) do.call("rbind",lapply(split(x,groupvec),colSums,na.rm=T))
Thanks reading my question and any hints!
Werner
---------------------------------
[[alternative HTML version deleted]]
2006 Jun 29
2
Biobass, SAGx, and Jonckheere-Terpstra test
Hi list,
I tried to load the package SAGx and failed because it complains it's
looking for the Biobass which is not there. Then I looked up the package
list and Biobass is not found.
I'm trying to run the Jonckheere-Terpstra test and from what I see in
the R archive, SAGx is the only place it's been implemented.
> library(SAGx)
Loading required package: multtest
Loading required
1999 Jan 18
0
Selecting a subgroup
I use the following function to select a subgroup from a data vector
(usually to calculate descriptive stats).
select.range<-function (groupvec, min, max, data)
{
if (nargs() > 3) {
min.cond <- groupvec >= min
max.cond <- groupvec < max
cond <- min.cond & max.cond
selected <- na.remove(ifelse(cond, data, NA))
invisible(selected)
}
else cat("Usage: select.rang...
2016 Apr 15
0
Difficulty with LRSM Rasch analysis with eRm package in R.
...work.
The primary problems I am having are:
1. Without a matrix, I get an error:
Error in `rownames<-`(`*tmp*`, value = betanames) : length of 'dimnames'
[1] not equal to array extent
This is from these commands:
rGrps = c(rep.int(1, nrow(X)))
results.LRSM <- LRSM(X, mpoints = 1, groupvec = rGrps, se = TRUE)
2. I don't know how to make a design matrix myself. I tried making one
with 1's along the diagonal, but it doesn't seem to work. I get an error:
Error in likLR(X, W, mpoints, groupvec, model, st.err = se, sum0,
etaStart) : Mismatch between number of rows (beta...