search for: xlevs

Displaying 20 results from an estimated 64 matches for "xlevs".

Did you mean: levs
2018 Mar 24
1
Function 'factor' issues
I am trying once again. By just changing f <- match(xlevs[f], nlevs) to f <- match(xlevs, nlevs)[f] , function 'factor' in R devel could be made more consistent and back-compatible. Why not picking it? -------------------------------------------- On Sat, 25/11/17, Suharto Anggono Suharto Anggono <suharto_anggono at yahoo.com> wrote: Su...
2013 Apr 05
2
model.frame: object is not a matrix
Over a decade ago there was a problem with model.frame when the variable names were long: https://stat.ethz.ch/pipermail/r-help/2002-August/024492.html I have similar symptoms with R 2.15.3 on Windows 7: Browse[2]> x <- model.matrix(formula(myform), p$data) Error in model.frame.default(object, data, xlev = xlev) (from mice.R#601) : object is not a matrix My attempt at a work-around
2017 Nov 25
0
Function 'factor' issues
...devel, I saw attempts to speed up subsetting and 'match', and to cache results of conversion of small nonnegative integers to character string. That's good. I am sorry for pushing, still. Is the partial new behavior of function 'factor' with respect to NA really worthy? match(xlevs, nlevs)[f] looks nice, too. - Using f <- match(xlevs, nlevs)[f] instead of f <- match(xlevs[f], nlevs) for remapping - Remapping only if length(nlevs) differs from length(xlevs) Applying changes similar to above to function 'levels<-.factor' will not change 'levels<-.facto...
2003 Mar 26
5
predict (PR#2686)
# r-bugs@r-project.org `predict' complains about new factor levels, even if the "new" levels are merely levels in the original that didn't occur in the original fit and were sensibly dropped, and that don't occur in the prediction data either. (At least if `drop.unused.levels' was set to TRUE, which the default.) test> scrunge.data.2_ data.frame( y=runif( 3),
2009 Sep 28
1
model.matrix troubles with AlgDesign
Dear DevelopeRs, in continuing with my suite of packages on experimental design, I am stuck with an issue that appears to be related to package AlgDesign - I have tried to get it solved by Bob Wheeler, but he seems to be stuck as well. Whenever AlgDesign is loaded, some of my code does not work any more. For example, in a fresh R session: require(DoE.base) fac.design(nlevels=c(2,6,2))
2010 Aug 15
0
unexpected behaviour with sparse.model.matrix
Hi, I'm trying to get sparse.model.matrix to retain unused levels. I can't seem to get this working through the most obvious routes such as specifying drop.unused.levels = FALSE in the model.frame or trying to pass all levels in xlev,which is an argument to sparse.model.matrix (see code below). Any help would be gratefully received. Cheers, Jarrod fac<-factor(rep(1:10,10),
2011 Mar 30
1
Using xlevels
I'm working on predict.survreg and am confused about xlevels. The model.frame method has the argument, but none of the standard methods (model.frame.lm, model.frame.glm) appear to make use of it. The documentation for model.matrix states: xlev: to be used as argument of model.frame if data has no "terms" attribute. But the terms attribute has no xlevels information in it, so I
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
2002 Oct 24
3
model.matrix (via predict) (PR#2206)
Full_Name: Glenn Stone Version: 1.5.1 and 1.6.0 OS: win2000 Submission from: (NULL) (168.140.227.9) The following code produces incorrect fitted values in version 1.5.1 and an error in 1.6.0 Error in "contrasts<-"(*tmp*, value = "contr.treatment") : contrasts apply only to factors In addition: Warning message: variable ihalf is not a factor in:
2017 Oct 21
0
Function 'factor' issues
My idea (like in https://bugs.r-project.org/bugzilla/attachment.cgi?id=1540 ): - For remapping, use f <- match(xlevs, nlevs)[f] instead of f <- match(xlevs[f], nlevs) (I have mentioned it). - Remap only if length(nlevs) differs from length(xlevs) . On use of 'order' in function 'factor' in R devel, factor.Rd still says 'sort.list' in "Details" section. My comments on the pa...
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
2002 Dec 19
0
Ongoing unhappiness with NA and factor behavior of distributed lm/predict.lm
Hi all, I''m still not quite happy with the NA and factor handling of lm and predict.lm in R1.6.1 (forcing me to use my not very skillfully crafted patches). Here is the problem 1: >
2000 Dec 05
1
Inconsistency, possibly a bug? (PR#758)
Seems to be a day for finding peculiar little things. There is an inconsistency in the behavior of lm vis a vis glm: > x <- rnorm(15) > y <- 1 + 10*x + rnorm(15) > z <- as.factor(rep(c("A","B","C"),rep(5,3))) > xyz <- data.frame(x,y,z) > fit.lm <- lm(y ~ x + z, data=xyz, subset=(z != "C")) > fit.glm <- glm(y ~ x +
2003 Dec 17
6
Factor names & levels
When I alter the levels of a factor, why does it alter the names too? f <- factor(c(A="one",B="two",C="one",D="one",E="three"), levels=c("one","two","three")) names(f) -- gives [1] "A" "B" "C" "D" "E" levels(f) <-
2011 Dec 26
2
glm predict issue
Hello, I have tried reading the documentation and googling for the answer but reviewing the online matches I end up more confused than before. My problem is apparently simple. I fit a glm model (2^k experiment), and then I would like to predict the response variable (Throughput) for unseen factor levels. When I try to predict I get the following error: > throughput.pred <-
2001 Jun 21
0
factors in model.frame.default
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --1133331701-635408861-993124011=:10449 Content-Type: TEXT/PLAIN; charset=US-ASCII I'm not sure if the warning messages Warning messages: 1: variable 67 is not a factor in:
2003 Mar 26
2
predict (PR#2685)
There is a bug in `predict' whereby the order of variables sometimes gets re-arranged compared to the original fit, and then disaster results. Specifically, the 'variables' and 'predvars' attributes of a 'terms' object get out of synch. This only happens when the terms in the original formula get re-ordered during fitting: test> scrunge.data_ data.frame(
2018 Feb 24
3
Regression Tree Questions
Hi All, I'm a newbie and have two questions. Please pardon me if they are very basic. 1. I'm using a regression tree to predict the selling prices of 10 new records (homes). The following code is resulting in an error message: pred <- predict(model, newdata = outOfSample[, -6]) The error message is: Error in model.frame.default(Terms, newdata, na.action = na.action, xlev =
2005 Aug 15
2
stepAIC invalid scope argument
I am trying to replicate the first example from stepAIC from the MASS package with my own dataset but am running into error. If someone can point where I have gone wrong, I would appreciate it very much. Here is an example : set.seed(1) df <- data.frame( x1=rnorm(1000), x2=rnorm(1000), x3=rnorm(1000) ) df$y <- 0.5*df$x1 + rnorm(1000, mean=8, sd=0.5) # pairs(df); head(df) lo <-
2003 Sep 16
2
can predict ignore rows with insufficient info
I need predict to ignore rows that contain levels not in the model. Consider a data frame, "const", that has columns for the number of days required to construct a site and the city and state the site was constructed in. g<-lm(days~city,data=const) Some of the sites in const have not yet been completed, and therefore they have days==NA. I want to predict how many days these sites