similar to: Bug or feature?

Displaying 20 results from an estimated 20000 matches similar to: "Bug or feature?"

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(
2023 May 03
1
Inquiry about the behaviour of subsetting and names in matrices
Thank you for such a quick reply, here are some points that I think might have been missed: > I would state the question the other way : why are NAs integer indices allowed? > In my experience, they are sometimes useful but they often delay the detection of bugs. However, due to backward compatibility, this feature cannot be removed. Adding this feature to character indices would worsen the
2018 Jan 18
1
Time-dependent coefficients in a Cox model with categorical variants
First, as others have said please obey the mailing list rules and turn of First, as others have said please obey the mailing list rules and turn off html, not everyone uses an html email client. Here is your code, formatted and with line numbers added. I also fixed one error: "y" should be "status". 1. fit0 <- coxph(Surv(futime, status) ~ x1 + x2 + x3, data = data0) 2. p
2018 Jan 17
1
Assessing calibration of Cox model with time-dependent coefficients
I am trying to find methods for testing and visualizing calibration to Cox models with time-depended coefficients. I have read this nice article <http://journals.sagepub.com/doi/10.1177/0962280213497434>. In this paper, we can fit three models: fit0 <- coxph(Surv(futime, status) ~ x1 + x2 + x3, data = data0) p <- log(predict(fit0, newdata = data1, type = "expected")) lp
2023 Feb 14
1
Documentation bug?
Dead R developers, In R-devel 2023-02-11 and older R versions, there is a note in the "lm {stats}" help page specifying that: > Offsets specified by offset will not be included in predictions by predict.lm<http://127.0.0.1:12534/library/stats/help/predict.lm>, whereas those specified by an offset term in the formula will be. However, the source code as well as basic tests
2012 Jan 05
1
delete.response leaves response in attribute dataClasses
I posted this one as an R bug (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14767), but Prof. Ripley says I'm premature, and I should raise the question here. Here's the behavior I assert is a bug: The output from delete.response on a terms object alters the formula by removing the dependent variable. It removes the response from the "variables" attribute and it changes
2010 Jan 16
2
predict.glm
Hi, See below I reply your message for <https://stat.ethz.ch/pipermail/r-help/2008-April/160966.html>[R] predict.glm & newdata posted on Fri Apr 4 21:02:24 CEST 2008 You say it ##works fine but it does not: if you look at the length of yhat2, you will find 100 and not 200 as expected. In fact predict(reg1, data=x2) gives the same results as predict(reg1). So I am still looking for
2018 Apr 27
0
predict.glm returns different results for the same model
On 27/04/2018 9:25 AM, Hadley Wickham wrote: > Hi all, > > Very surprising (to me!) and mystifying result from predict.glm(): the > predictions vary depending on whether or not I use ns() or > splines::ns(). Reprex follows: > > library(splines) > > set.seed(12345) > dat <- data.frame(claim = rbinom(1000, 1, 0.5)) > mns <- c(3.4, 3.6) > sds <- c(0.24,
2011 Jan 28
6
User error in calling predict/model.frame
I want to predict values from an existing lm (linear model, e.g. lm.obj) result in R using a new set of predictor variables (e.g. newdata). However, it seems that because my linear models was made by calling scale() on the target predictor that predict exits with an error, "Error in scale(xxA, center = 9.7846094491829, scale = 0.959413568556403) : object 'xxA' not found". By
2009 Jul 29
3
predict
I have found a regression model, and i would like to predict value in different points. I have tried to use predict function but it doesn't work. I have used predict function like this: newdata<-seq(from=0.1, to=0.32,by=0.02) data<-predict(fm,newdata) where fm is a regression model. The predict function return me that: Error in eval(predvars, data, env) : numeric argument
2002 Feb 14
0
two comments regarding predict.lm
Here is the first one. It concerns the handling of multiple offsets. The following lines creates a list with 3 explanatory variables and one response. > x<-seq(0,1,length=10);y<-sin(x);z<-cos(x); w<-x+y+z+rnorm(x) > data<-list(x=x,y=y,z=z,w=w) A lm is fitted with one explanatory variable and two offsets. So far, so good. >
2010 Jul 21
2
Variance of the prediction in the linear regression model (Theory and programming)
Hi, folks, Here are the codes: ############## y=1:10 x=c(1:9,1) lin=lm(log(y)~x) ### log(y) is following Normal distribution x=5:14 prediction=predict(lin,newdata=x) ##prediction=predict(lin) ############### 1. The codes do not work, and give the error message: Error in eval(predvars, data, env) : numeric 'envir' arg not of length one. But if I use the code after the pound sign, it
2023 May 03
1
Inquiry about the behaviour of subsetting and names in matrices
Karolis wrote: > Hello, > I have stumbled upon a few cases where the behaviour of naming and subsetting in matrices seems unintuitive. > All those look related so wanted to put everything in one message. > 1. Why row/col selection by names with NAs is not allowed? > x <- setNames(1:10, letters[1:10]) > X <- matrix(x, nrow=2, dimnames = list(letters[1:2],
2023 Dec 01
1
back tick names with predict function
Also, and possibly more constructively, when you get an error like > CI.c = predict(mod2, data.frame( `plant-density` = x), interval = 'c') # fail Error in eval(predvars, data, env) : object 'plant-density' not found you should check your assumptions. Does "newdata" actually contain a columnn called "plant-density": > head(data.frame( `plant-density`
2011 Aug 15
3
Help on how to use predict
Dear R-Users My problem is quite simple: I need to use a fitted model to predict the next point (that is, just one single point in a curve). The data was divided in two parts: identification (x and y - class matrix) and validation (xt and yt - class matrix). I don't use all values in x and y but only the 10 nearest points (x[b,] and y[b,]) for each regression (b is a vector with the
2001 Sep 25
0
Bug in model.matrix.default (was: [R] predict incosistency ?) (PR#1100)
On Tue, 25 Sep 2001 12:27:27 GMT, Jorge Luis Ojeda Cabrera <jojeda@posta.unizar.es> wrote in message <20010925.12272700@macdesp8.unizar.es>: >When fitting model 'y~1', the 'lm' response is ok, but it is not possible >to get predictions using 'predict'. May be this is a bug, at least i >think it is somehow >inconsistent. It still appears in 1.3.1,
2001 Sep 25
0
Bug in model.matrix.default (PR#1100)
There's more to it than that (which was already fixed in R-devel). The internal code expects there to be columns in the model frame. I have already fixed this in R-devel (by faking an unused column). On Tue, 25 Sep 2001 murdoch@stats.uwo.ca wrote: > On Tue, 25 Sep 2001 12:27:27 GMT, Jorge Luis Ojeda Cabrera > <jojeda@posta.unizar.es> wrote in message >
2007 Feb 22
0
confidence intervals
Hi, I'm having trouble with the confidence interval of the nls function. I did my home work, and searched acros the support list until I came up with following solution of Peter Dalgaard: example(predict.nls) se.fit <- sqrt(apply(attr(predict(fm,list(Time = tt)),"gradient"),1, function(x) sum(vcov(fm)*outer(x,x)))) matplot(tt,
2012 Mar 27
4
Help on predict.lm
Hello, I'm new here, but will try to be as specific and complete as possible. I'm trying to use “lm“ to first estimate parameter values from a set of calibration measurements, and then later to use those estimates to calculate another set of values with “predict.lm”. First I have a calibration dataset of absorbance values measured from standard solutions with known concentration of
2011 Jul 15
1
Plotting survival curves from a Cox model with time dependent covariates
Dear all, Let's assume I have a clinical trial with two treatments and a time to event outcome. I am trying to fit a Cox model with a time dependent treatment effect and then plot the predicted survival curve for one treatment (or both). library(survival) test <- list(time=runif(100,0,10),event=sample(0:1,100,replace=T),trmt=sample(0:1,100,replace=T)) model1 <- coxph(Surv(time,