similar to: coding negative effects in categorical dummy variables

Displaying 20 results from an estimated 10000 matches similar to: "coding negative effects in categorical dummy variables"

2001 May 09
1
Coding categorical -> dummy
Dear R-Users, I have a data frame with several categorical variables. I want to create a new data frame with dummy variables (with all levels). I know the function model.matrix (see below) but it works only for one categorical variable : > tt <- c("a","a","b","a","c") > tt <- factor(tt) > model.matrix(~ tt - 1) is there anyone who
2013 Sep 22
2
Coding several dummy variables into a single categorical variable
Colleagues, I have generated several dummy variables: n$native0 <- 1 * (n$re=="white" & n$usborn=="yes") n$native1 <- 1 * (n$re=="afam" & n$usborn=="yes") n$native2 <- 1 * (n$re=="carib" & n$usborn=="yes") n$native3 <- 1 * (n$re=="carib" & n$usborn=="no") I would now like to combine these
2012 Jul 27
1
Turn categorical array into matrix with dummy variables
Hi All, I want to turn a categorical array (array with factors) into a matrix with dummy variables. like array=c(a,a,b,b,b) should be turned into: a b 1 0 1 0 0 1 0 1 0 1 Do you know any way of doing this? Thanks -- View this message in context: http://r.789695.n4.nabble.com/Turn-categorical-array-into-matrix-with-dummy-variables-tp4638134.html Sent from the R help mailing list archive at
2006 Mar 25
1
How do I report coefficients of categorical fixed effects in a publication?
To whom it may concern: I recently used lmer (for non-normally distributed data and mixed effects, using the Laplace method). All 3 of my fixed effects were categorical, including two ordered factors and one unordered factor. In my tables, I currently report the number of observations for the response variable, and both the degrees of freedom and Chi Square values from tests of reduced
2004 Jun 09
1
testing effects of quantitative predictors on a categorical response variable
Hello, I have a small statistics question, and as I'm quite new to statistics and R, I'm not sure if I'm doing things correctly. I am looking at two quantitative variables (x,y) that are correlated. When I divide the data set according to a categorical variable z, then x and y are more poorly correlated when z = A than when z = B (see attached figure). In fact x and y are two
2011 Jun 21
2
interaction between categorical variables
Dear R-users, I need some  assistance. I am running some interactive variables for categorical variables. I have dgen(2 levels converted to dummy variables)  and dtoe(4-levels also converted to  dummy variables). So I have worked with them in two ways: i created a variable X1 = dgen*dtoe  and I get an error "Error in dgen * dtoe : non-conformable arrays"then i run a glm, binomial
2008 Apr 03
2
coding for categorical variables with unequal observations
Hi, I am doing multiple regression, and have several X variables that are categorical. I read that I can use dummy or contrast codes for that, but are there any special rules when there're unequal #observations in each groups (4 females vs 7 males in a "gender" variable)? Also, can R generate these codes for me? THanks.
2003 Dec 17
2
negative numbers from object.size() on 64 bit systems
Has anyone running R 1.8.1 on a 64 bit system gotten negative numbers from object.size() on objects > 2GB or so? For example, on Solaris/Sparc I get > b <- numeric(131072 * 2800) > object.size(b) [1] -1358954440 I get similar behavior on the Opteron (SuSE Linux). I'm not sure if this is an R problem or something wrong with the way it was compiled on either system. I
2010 Mar 28
6
Coding of categorical variables for logistic regression?
Hello, I am trying to do a logistic regression and have one predictor variable (x) that is ratio and two predictor variables (y and z) that are categorical. These have three levels each which I have called "High", "Medium" and "Low". My question: do I need to use a numerical coding scheme for the categorical variables as required by some statistical software
2011 Aug 05
1
Main-effect of categorical variables in meta-analysis (metafor)
Dear R-experts! In a meta-analysis (metafor) I would like to assess the effect of two categorical covariates (A & B) whereas they both have 4 levels. Is my understanding correct that this would require to dummy-code (0,1) each level of each covariate (A & B)? However I am interested in the main-effects and the interaction of these two covariates and the dummy-coding would only allow to
2017 Mar 07
0
length(unclass(x)) without unclass(x)?
> Henrik Bengtsson: > > I'm looking for a way to get the length of an object 'x' as given by > base data type without dispatching on class. The performance improvement you're looking for is implemented in the latest version of pqR (pqR-2016-10-24, see pqR-project.org), along with corresponding improvements in several other circumstances where unclass(x) does not
2017 Mar 05
0
length(unclass(x)) without unclass(x)?
I'm looking for a way to get the length of an object 'x' as given by base data type without dispatching on class. Something analogous to how .subset()/.subset2(), e.g. a .length() function. I know that I can do length(unclass(x)), but that will trigger the creation of a new object unclass(x) which I want to avoid because 'x' might be very large. Here's a dummy example
2018 Sep 03
0
True length - length(unclass(x)) - without having to call unclass()?
Regarding the discussion of getting length(unclass(x)) without an unclassed version of x being created... There are already no copies done for length(unclass(x)) in pqR (current version of 2017-06-09 at pqR-project.org, as well as the soon-to-be-release new version). This is part of a more general facility for avoiding copies from unclass in other circumstances as well - eg,
2008 Feb 16
3
Arithmetic bug? (found when use POSIXct) (PR#10776)
Full_Name: Bo Zhou Version: 2.6.1 (2007-11-26) OS: Windows XP Submission from: (NULL) (207.237.54.242) Hi, I found an arithmetic problem when I'm doing something with POSIXct The code to reproduce it is as follows (This is the recommended way of finding out time zone difference on R News 2004-1 Page 32 URL http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf) a=Sys.time()
2018 Sep 05
0
True length - length(unclass(x)) - without having to call unclass()?
On 08/24/2018 07:55 PM, Henrik Bengtsson wrote: > Is there a low-level function that returns the length of an object 'x' > - the length that for instance .subset(x) and .subset2(x) see? An > obvious candidate would be to use: > > .length <- function(x) length(unclass(x)) > > However, I'm concerned that calling unclass(x) may trigger an > expensive copy
2012 Dec 21
2
Why can't I "unclass" an array?
In a real example I was trying to remove the class from the result of table, just because it was to be used as a building block for other things and a simple integer vector seemed likely to be most efficient. I'm puzzled as to why unclass doesn't work. > zed <- table(1:5) > class(zed) [1] "table" > class(unclass(zed)) [1] "array" >
2012 Dec 21
2
Why can't I "unclass" an array?
In a real example I was trying to remove the class from the result of table, just because it was to be used as a building block for other things and a simple integer vector seemed likely to be most efficient. I'm puzzled as to why unclass doesn't work. > zed <- table(1:5) > class(zed) [1] "table" > class(unclass(zed)) [1] "array" >
2018 Sep 10
0
True length - length(unclass(x)) - without having to call unclass()?
On 09/05/2018 11:18 AM, I?aki Ucar wrote: > The bottomline here is that one can always call a base method, > inexpensively and without modifying the object, in, let's say, > *formal* OOP languages. In R, this is not possible in general. It > would be possible if there was always a foo.default, but primitives > use internal dispatch. > > I was wondering whether it would be
2005 Apr 02
4
factor to numeric in data.frame
Dear All, Assume I have a data.frame that contains also factors and I would like to get another data.frame containing the factors as numeric vectors, to apply functions like sapply(..., median) on them. I read the warning concerning as.numeric or unclass, but in my case this makes sense, because the factor levels are properly ordered. I can do it, if I write for each single column
2002 Sep 03
2
[patch] for rsync
To Whom It May Concern: Below is a patch, that I have used to eliminate the unexplained errors in the rsync program. I was able to trace the problem to the order in which the sigchld_handler and wait_process routines were executed. If sigchld_handler executes first it retrieves the status that wait_process needs to indicate proper rsync termination. The code below allows the sigchld_handler to