Displaying 20 results from an estimated 60000 matches similar to: "Ooops, apologies, it was my error re predict with subset"
2003 Oct 24
2
predict for a model with a subset
Hello
running R 1.7.1 on Windows 2000
I have a model
notmar1 <- glm(yprisx~age+harddrug+sex, subset = marcom == 0,
family = quasipoisson)
and summary(notmar1) gives (as it should) 433 df for the null model
but when I run
predict(notmar1 <- glm(yprisx~age+harddrug+sex, subset = marcom == 0,
family = quasipoisson))
I get preditions for 528 people (the full data set, not the subset)
2008 Jun 10
1
Question on lda and predict
Hello
Using R 2.7.0 on Windows.
I am running a linear discriminant analysis as follows
<<<<
discrim1 <- lda(normvar~ mafmahal+ mrfmahal+ mffmahal+ bafmahal+ brfmahal+
cofmahal+ bmfmahal+ cfmahal+ fractmahal+ antmahal+ absmifmahal+ absifmahal, subset = train)
prediction <- predict(discrim1, traintest1[-train,])$class
>>>
When I do this, I get a warning
2003 May 02
0
predict (PR#2686)
Hmmm-- still looks like a bug to me! But as I don't want to hog the
airwaves, here's my last summary on this point, with a question:
[Bravington]
#> Prediction from the original data was just an example, of course; my
general
#> proposal is that inactive factor levels in the prediction set should be
#> dropped. I don't see how this could ever cause inconsistent behaviour
2009 Dec 02
4
Finding cases in one subset that are closet to another subset
Good afternoon
Running R2.10.0 on Windows
I have a data frame that includes (among much else) a factor (In_2006) and a continuous variable (math_3_4). I would like to find the 2 cases for In_2006 = 0 that are closest to each case where In_2006 = 1.
My data looks like
In_2006 math_3_4
0 55.1
1 51.6
1 18.1
1 26.6
1 14.1
2006 Dec 27
1
Question about predict function
I am working with a non-parametic smoothing operation using a
Generalized Additive Model. It is a bivariate data set. I know how to
do the smooth, and out comes a nice smooth curve.
Now I want to find the value of the smoothed curve for several values
of x (the abscissa). This can be done (please correct me if I am
wrong) by using the predict.gam function. You feed the predict.gam
function a
2009 Jun 30
0
bug in nlme package function predict.lmList (PR#13788)
Full_Name: Vaidotas Zemlys
Version: 2.9.0
OS: Ubuntu 8.10
Submission from: (NULL) (213.197.173.50)
Steps to reproduce the bug:
library(nlme)
data(Oxboys)
qm=lmList(height~age|Subject,data=Oxboys)
grid=with(Oxboys,expand.grid(age=seq(min(age),max(age),length=50),Subject=levels(Subject)))
res <- predict(qm,grid,se=TRUE)
Erreur dans if (pool) { : l'argument est de longueur nulle
res <-
2009 May 06
1
Add trend line to XYPlot using a subset of the original data
I've created an xyplot that I want to add a trend line to using a subset of
the data.
The xyplot is
xyplot(X9444500~WY,data=mynewdata,xlim=c(1900,2020),ylab="TEST",
xlab="",ylim=c(100,100000),scales=list(x=list(at=c(1900,1920,1940,1960,1980,2000,2020),axs="r",tck=-1),y=list(log=TRUE,tck=-100,at=c(100,1000,10000,100000))),
panel=function(x,y,...) {
2007 Feb 07
1
Problem with subsets and xyplot
Hello
I have a dataframe that looks like this
MSA CITY HIVEST YEAR YR CAT
1 0200 Albuquerque 0.50 1996 1996 5
2 0520 Atlanta 13.00 1997 1997 5
3 0720 Baltimore 29.10 1994 1994 1
4 0720 Baltimore 13.00 1995 1995 5
5 0720 Baltimore 3.68
2012 Apr 14
1
basic question predict GLM offset
Hi,
I know this is probably a basic question... But I don't seem to find the
answer.
I'm fitting a GLM with a Poisson family, and then tried to get a look at the
predictions, however the offset does seem to be taken into consideration:
model_glm=glm(cases~rhs(data$year,2003)+lhs(data$year,2003),
offset=(log(population)), data=data, subset=28:36, family=poisson())
predict
2005 Aug 24
0
Model forecasts with new factor levels - predict.warn
predict.warn() -- a function to display factor levels in new data
for linear model prediction that do not exist in the
estimating data.
Date: 2005-8-24
From: John C. Nash (with thanks to Uwe Ligges for suggestions)
nashjc at uottawa.ca
Motivation: In computing predictions from a linear model using factors,
it is possible to introduce new factor levels. This was encountered on
a practical
2013 Nov 14
1
issues with calling predict.coxph.penal (survival) inside a function
Thanks for the reproducable example. I can confirm that it fails on my machine using
survival 2-37.5, the next soon-to-be-released version,
The issue is with NextMethod, and my assumption that the called routine inherited
everything from the parent, including the environment chain. A simple test this AM showed
me that the assumption is false. It might have been true for Splus. Working this
2007 May 31
1
predict.nls - gives error but only on some nls objects
Dear list,
I have encountered a problem with predict.nls (Windows XP, R.2.5.0), but I am not sure if it is a bug...
On the nls man page, an example is:
DNase1 <- subset(DNase, Run == 1)
fm2DNase1 <- nls(density ~ 1/(1 + exp((xmid - log(conc))/scal)),
data = DNase1,
start = list(xmid = 0, scal = 1))
alg = "plinear", trace =
2005 Aug 16
1
predict nbinomial glm
Dear R-helpers,
let us assume, that I have the following dataset:
a <- rnbinom(200, 1, 0.5)
b <- (1:200)
c <- (30:229)
d <- rep(c("q", "r", "s", "t"), rep(50,4))
data_frame <- data.frame(a,b,c,d)
In a first step I run a glm.nb (full code is given at the end of this mail) and
want to predict my response variable a.
In a second step, I would
2010 Jul 27
1
problem with zero-weighted observations in predict.lm?
In modelling functions some people like to use
a weight of 0 to drop an observation instead of
using a subset value of FALSE. E.g.,
weights=c(0,1,1,...)
instead of
subset=c(FALSE, TRUE, TRUE, ...)
to drop the first observation.
lm() and summary.lm() appear to treat these in the
same way, decrementing the number of degrees of
freedom for each dropped observation. However,
predict.lm() does
2012 Jan 17
1
Error predict with lda and cross validation
Hi, I use the lda function from the MASS package to classify some
samples according to some chemical properties. If I run lda without
cross validation all is ok but, if I run lda with cross validation,
the R consol say:
resLDA <- ldaRedOx <- lda(Activity ~ TRedOx[,1:6], CV=TRUE,
data=dfDataRedOx, subset=train)
predLDA <- predict(resLDA, newdata=dfDataRedOx[-train,])$class
>
2004 Dec 10
1
predict.randomForest
I have a data.frame with a series of variables tagged to a binary
response ('present'/'absent'). I am trying to use randomForest to
predict present/absent in a second dataset. After a lot a fiddling
(using two data frames, making sure data types are the same, lots of
testing with data that works such as data(iris)) I've settled on
combining all my data into one data.frame
2008 Oct 13
0
Re : using predict() or fitted() from a model with offset; unsolved, included reproducible code
Thanks for your reply Mark,
but no, using predict on the new data.frame does not help here.
?
I had first thought that the probelm was due?the?explanatory variable (age)?and?the offset one (date) being?very similar (highly?correlated, I am trying to tease their effect apart, and hoped offset would help in this since I know the relationship with age already). But this appears not to be the case.
2009 Nov 02
1
modifying predict.nnet() to function with errorest()
Greetings,
I am having trouble calculating artificial neural network
misclassification errors using errorest() from the ipred package.
I have had no problems estimating the values with randomForest()
or svm(), but can't seem to get it to work with nnet(). I believe
this is due to the output of the predict.nnet() function within
cv.factor(). Below is a quick example of the problem I'm
2005 Apr 14
1
predict.glm(..., type="response") loses names (was RE: [R] A sugg estion for predict function(s))
> From: Ross Darnell
>
> Liaw, Andy wrote:
> >>From: Liaw, Andy
> >>
> >>
> >>>From: Ross Darnell
> >>>
> >>>A good point but what is the value of storing a large set of
> >>>predicted
> >>>values when the values of the explanatory variables are lost
> >>>(predicted
>
2013 Jul 08
1
error in "predict.gam" used with "bam"
Hello everyone.
I am doing a logistic gam (package mgcv) on a pretty large dataframe
(130.000 cases with 100 variables).
Because of that, the gam is fitted on a random subset of 10000. Now when I
want to predict the values for the rest of the data, I get the following
error:
> gam.basis_alleakti.1.pr=predict(gam.basis_alleakti.1,
+