similar to: Need expert help with model.matrix

Displaying 20 results from an estimated 4000 matches similar to: "Need expert help with model.matrix"

2005 Sep 13
1
possible bug in model.matrix
Is this a bug, or have I misunderstood the proper use of lm? Thanks, Whit code: x <- rnorm(50) y <- matrix(as.logical(round(runif(100),0)),ncol=2) NROW(x)==NROW(y) lm(x~y) > x <- rnorm(50) > y <- matrix(as.logical(round(runif(100),0)),ncol=2) > NROW(x)==NROW(y) [1] TRUE > lm(x~y) Error in "[[<-.data.frame"(`*tmp*`, nn, value = c(2, 1, 2, 1, 1, 1, 2, :
2013 Apr 12
2
model frame and formula mismatch in model.matrix()
Hello everyone, I am trying to fit the following model All X. variables are continuous, while the conditions are categoricals. model <- lm(X2
2004 Jan 30
0
Two apparent bugs in aov(y~ *** -1 + Error(***)), with suggested (PR#6510)
I think there are two bugs in aov() that shows up when the right hand side of `formula' contains both `-1' and an Error() term, e.g., aov(y ~ a + b - 1 + Error(c), ...). Without `-1' or `Error()' there is no problem. I've included and example, and the source of aov() with suggested fixes below. The first bug (labeled BUG 1 below) creates an extra, empty stratum inside
2004 Feb 02
0
Two apparent bugs in aov(y~ *** -1 + Error(***)), with (PR#6520)
I believe you are right, but can you please explain why anyone would want to fit this model? It differs only in the coding from aov(y ~ a + b + Error(c), data=test.df) and merely lumps together the top two strata. There is a much simpler fix: in the line if(intercept) nmstrata <- c("(Intercept)", nmstrata) remove the condition (and drop the empty stratum later if you
2012 Aug 14
1
Error; contrasts can be applied only to factors with 2 or more levels
Hi, I have been running the same code without problem for the last few days, changing data sets etc with no issue. Today I changed the covariates for the model and am now getting this error message: Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels Everything in the code looks the same to me, but I'm a
2009 Feb 26
1
using predict method with an offset
Hi, I have run into another problem using offsets, this time with the predict function, where there seems to be a contradiction again between the behavior and the help page. On the man page for predict.lm, it says Offsets specified by offset in the fit by lm will not be included in predictions, whereas those specified by an offset term in the formula will be. While it indicates nothings about
2012 Aug 02
1
Filter a matrix with a matrix HELP!
Hi, just during these vacation days, I'm trying to approach with multicore package and I have some troubles with foreach. What I'm trying to do is to extract a data in coordinate (ii,jj) from a matrix2, only if the data in the same coordinate in matrix1 is ==1. Make this with a nested "for" take a lot of time because I have thousand of values. ex. Binary_hex = NULL
2012 Sep 04
2
Read data from .csv file as a matrix and compare the different between two matrix
Hi, I have two table matrix, and I would like to compare the different between two matrix. For example: Matrix 1: A B C A 0 1 0 B 0 0 1 C 0 0 0 Matrix 2: A B C A 0 1 0 B 0 0 0 C 0 0 0 Each column which have value 1, should also return value 1. As in this case/example, the result should appear like this (as below). The result of this differentiation should also be in matrix
2007 Aug 18
2
Problem with lsa package (data.frame) on Windows XP
Dear R team, The following piece of code (to use the lsa package) works fine on my mac os x, but when I run the same code on Windows XP, it doesn't work any more. ### code: library("lsa") matrix1 = textmatrix("C:\\Documents and Settings\\tine stalmans.TINE. 000\\LSA\\cuentos\\", stemming=TRUE, language="spanish", minWordLength=2, minDocFreq=1,
2019 Aug 31
0
inconsistent handling of factor, character, and logical predictors in lm()
Dear Bill, Thanks for pointing this difference out -- I was unaware of it. I think that the difference occurs in model.matrix.default(), which coerces character variables but not logical variables to factors. Later it treats both factors and logical variables as "factors" in that it applies contrasts to both, but unused factor levels are dropped while an unused logical level is not. I
2004 Feb 24
2
matrix() Help
I have a question related to matrix(). The code below randomly generates 3 Poisson numbers into a 3 by 1 matrix: > matrix1 <- matrix(rpois(3,lambda=2),nrow=3,ncol=1) And I use list() to see what they are: [,1] [1,] 3 [2,] 1 [3,] 4 , which is what I had intended. I then I want to randomly generate y Normal numbers into a 3 by 8 matrix. y in this case would be 3, 1, and 4; so
2007 Nov 19
6
Reg : using two different matrix : how to do t.test
I have two matrix with same dimensions. I want to do t.test using each column from 2 different matrix. Row n Column names in both matrix are same. e.g. Matrix1 id VC1 VC2 VC3 R 1 2 3 R1 4 5 6 R3 7 8 9 Matrix2 id VC1 VC2 VC3 R 10 11 12 R1 13 14 15 R3 16 17 18 want to do t.test using each column (with same name ) using Matrix1 and Matrix2 for eg
2013 Mar 01
2
issue creating a subset
I'm performing item response theory with eRm packages I am excluding the persons that doesn't fit in the infit/outfit persons. for that I created a condition. then I have to create a new subset or matrix but with the condition. So: ORIGINAL matrix<-cbind(item1, item2, item3, item4) IF I PERFORM A head(matrix) item1 item2 item3 item4 3 2 3 1 3 1
2010 Feb 22
1
rownames cannot allocate vector of size
Hi, On R 2.10.1 for Windows, when I do the following to duplicate the structure of a large numeric matrix called matrix1: matrix2 <- matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1)) and then rownames(matrix2) <- rownames(matrix1) I get a "cannot allocate vector of size xxMb" error but if I instead do: rnames <- list() rnames <- rownames(matrix1) matrix2 <-
2010 Feb 10
2
system.time provides inaccurate sys.child (PR#14210)
Full_Name: Manuel L?pez-Ib??ez Version: R version 2.6.2 (2008-02-08) OS: linux-gnu Submission from: (NULL) (164.15.10.156) This is only relevant for CPU intensive child processes. Otherwise, the problem is not obvious. Therefore, we need a CPU intensive program like this one: /************************************/ /*** Compile with: gcc -o timer-test -O0 timer-test.c -lm */ #include
2010 Feb 26
2
dramatic speed difference in lapply
So I have a function that does lapply's for me based on dimension. Currently only works for length(pivotColumns)=2 because I haven't fixed the rbinds. I have two versions. One runs WAYYY faster than the other. And I'm not sure why. Fast Version: fedb.ddplyWrapper2Fast <- function(data, pivotColumns, listNameFunctions, ...){ lapplyFunctionRecurse <- function(cdata, level=1,
2013 Apr 27
1
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
i am getting the following error Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels can any on e suggest how to rectify [[alternative HTML version deleted]]
2008 May 06
1
Significance analysis of Microarrays (SAM)
Dear list, I am trying to perform a significance analysis of a microarray experiment with survival data using the {samr} package. I have a matrix containing my data which has 17816 rows corresponding to genes, and 286 columns corresponding to samples. The name of this matrix is data.matrix2. Some of the first values of this matrix are: data.matrix2[1:3,1:5] GSM36777 GSM36778 GSM36779
2012 Sep 19
4
correlating matrices
Hi, thank you for taking the time and reading my question. My question is twofold: 1. I have several matrices with variables and one matrix with water levels. I want to predict the water level with the data in the other matrices. Basically, * mod<-lm(matrix1 ~ matrix2+matrix3)* ( What looks like a minus is meant to be the wiggly minus.) Of course I could dissemble the matrices and paste
2007 May 04
2
Get the difference between two matrices with different length
Hello, I have got two matrices with different length. The matrices have 3 columuns. The first two are coordinates. The third is a measurement. Now I want to get a subtraction between every single value of the third column (between matrix1 and matrix2), but only if the two first coordinates in matrix1 and matrix2 are the same. I tried "FUN=?" in aggregate and ave, but I don't know