Displaying 20 results from an estimated 10000 matches similar to: "specifying model terms when using predict"
2006 May 27
1
Recommended package nlme: bug in predict.lme when an independent variable is a polynomial (PR#8905)
Full_Name: Renaud Lancelot
Version: Version 2.3.0 (2006-04-24)
OS: MS Windows XP Pro SP2
Submission from: (NULL) (82.239.219.108)
I think there is a bug in predict.lme, when a polynomial generated by poly() is
used as an explanatory variable, and a new data.frame is used for predictions. I
guess this is related to * not * using, for predictions, the coefs used in
constructing the orthogonal
2012 Mar 19
1
glm: getting the confidence interval for an Odds Ratio, when using predict()
Say I fit a logistic model and want to calculate an odds ratio between 2
sets of predictors. It is easy to obtain the difference in the predicted
logodds using the predict() function, and thus get a point-estimate OR. But
I can't see how to obtain the confidence interval for such an OR.
For example:
model <- glm(chd ~age.cat + male + lowed, family=binomial(logit))
pred1 <-
2006 Aug 23
1
covariance matrix of predictions
Hi !
I am trying to get at the covariance of the predictions of a linear model. Suppose the we have:
> x<-runif(1000)
> y<-2 + 25x*x +rnorm(1000)
> lm1 <-lm(y~x, data = data.frame(y = y, x=x))
> x.pred <-runif(10)
> y.hat <- predict(lm1, newdata = data.frame(x=x.pred))
I was wondering how to get an estimate of the covariance of y.hat which would be a 10 x 10
2023 Dec 09
1
Linear model and approx function
Dear all;
I have a dataframe with several columns. The columns are the elevation,
volume and the area of the cells (which were placed inside a polygon). I
have extracted them from DEM raster to calculate the volume under polygon
and the elevation for a specific volume of the reservoir.
> head(x6,2)
Elevation Vol Area V_sum A_sum
1 2145 13990.38 85.83053 13990.38
2012 Aug 28
4
predict.lm(...,type="terms") question
Hello all,
How do I actually use the output of predict.lm(..., type="terms") to
predict new term values from new response values?
I'm a chromatographer trying to use R (2.15.1) for one of the most
common calculations in that business:
- Given several chromatographic peak areas measured for control
samples containing a molecule at known (increasing) concentrations,
first
2012 Nov 01
0
oblique.tree : the predict function asserts the dependent variable to be included in "newdata"
Dear R community,
I have recently discovered the package oblique.tree and I must admit that
it was a nice surprise for me,
since I have actually made my own version of a kind of a classifier which
uses the idea of oblique splits (splits by means of hyperplanes).
So I am now interested in comparing these two classifiers.
But what I do not seem to understand is why the function
2005 Mar 24
1
RE: [R] Mapping actual to expected columns for princomp object
[Re-directing to R-devel, as I think this needs changes to the code.]
Can I suggest a modification to stats:predict.princomp so that it will check
for column (variable) names?
In src/library/stats/R/princomp-add.R, insert the following after line 4:
if (!is.null(cn <- names(object$center))) newdata <- newdata[, cn]
Now Dana's example looks like:
> predict(pca1, frz)
Error in
2006 May 30
0
(PR#8905) Recommended package nlme: bug in predict.lme when an independent variable is a polynomial
Many thanks for your very useful comments and suggestions.
Renaud
2006/5/30, Prof Brian Ripley <ripley at stats.ox.ac.uk>:
> On Tue, 30 May 2006, Prof Brian Ripley wrote:
>
> > This is not really a bug. See
> >
> > http://developer.r-project.org/model-fitting-functions.txt
> >
> > for how this is handled in other packages. All model-fitting in R used =
2008 Sep 11
1
how to calcaulate matrices for two subsets
I am an R beginner and trying to run a market model using event study in
R framework.
First, I run a market model, that is lm(stock security~SP500 index,
subset=Obs[197, 396]) ->result1
Then I get predict results for a new dataset using predict (result1,
newdata=Obs[397,399]) ->pred1
Pred1 should have three numbers.
Now I need to calculate abnormal return by the formula stock
2017 Sep 24
2
predict y tree
Estimados compañeros hace unos días instale la versión última de R
(3.4.1) en windows 10 y hoy me tiene loco el siguiente error cuando
ejecuto predict para un árbol de clasificación-regresión. El problema da
incluso con el ejemplo del comando predict
library(tree)
data(shuttle, package="MASS")
shuttle.tr <- tree(use ~ ., shuttle, subset=1:253,
mindev=1e-6,
2004 Sep 29
1
glm.fit and predict.glm: error ' no terms component'
Hi
when I fit a glm by
glm.fit(x,y,family = binomial())
and then try to use the object for prediction of newdata by:
predict.glm(object, newdata)
I get the error:
Error in terms.default(object) : no terms component
I know I can use glm() and a formula, but for my case I prefer
glm.fit(x,y)...
thanks for a hint
christoph
$platform
[1] "i686-pc-linux-gnu"
$arch
[1]
2005 May 31
2
simple predict question
Excuse the simple question...
I'm not sure what I'm doing wrong with predict, but let me use this example:
Suppose I do:
dat<-matrix(c(0,0,10,20),2,byrow=T)
lm1<-lm(dat[,2]~dat[,1])
Suppose I want to generate the linearly-interpolated y-values between the
point (0,0) and (0,20) at every unit interval.
I thought I just do:
predict(lm1, data.frame(seq(0,10,1))) to get
2010 Jul 26
1
Marginal effects from interaction regression model
Dear all,
I'd like to plot the marginal effect of a variable in a multiplicative
interaction regression, that is, the effect of a variable conditional on the
values of another variable. As an illustration, given model lm1
lm1 <- lm(y ~ x*z)
I'd like to get the effects of x on y conditional on the values of z, with
the corresponding confidence intervals if possible. Does anyone know
2012 May 03
1
overlapping confidence bands for predicted probabilities from a logistic model
Dear list,
I'm a bit perplexed why the 95% confidence bands for the predicted probabilities for units where x=0 and x=1 overlap in the following instance.
I've simulated binary data to which I've then fitted a simple logistic regression model, with one covariate, and the coefficient on x is statistically significant at the 0.05 level. I've then used two different methods to
2011 Mar 23
1
Corrupt trees
Hi Everyone,
I have been using the "tree" package for a while with no problems until now.
When I run predict(tree, newdata), I get an error with the message "Corrupt tree" for about 50% of the trees that I generate with tree. For other trees, the predict function completes with no errors.
I haven't identified a correlation between the corrupt trees and the working tree.
2009 Jan 16
2
Predictions with GAM
Dear,
I am trying to get a prediction of my GAM on a response type. So that I
eventually get plots with the correct values on my ylab.
I have been able to get some of my GAM's working with the example shown
below:
*
model1<-gam(nsdall ~ s(jdaylitr2), data=datansd)
newd1 <- data.frame(jdaylitr2=(244:304))
pred1 <- predict.gam(model1,newd1,type="response")*
The problem I am
2017 Sep 24
2
predict y tree
Gracias Carlos miraré el fix y en su defecto intentaré mandar un mensaje
al autor. De todas las maneras espero que alguien lo pruebe en windows 10
Saludos,
Juan
El 24/09/2017 a las 20:32, Carlos Ortega escribió:
> Hola Juan Antonio,
>
> Acabo de instalar "tree" en Mac OSX y no aparece este error...
>
> > shuttle1 <- shuttle[254:256, ] # 3 missing cases
>
2005 Aug 04
2
prediction from glm
Hello r-help,
I try to fit birds counts over years using glm. I have done (with Estate
and year as factors):
Model1 <- glm(Females~Estate+Year+offset = log(area)), family =
quasipoisson(link = log), na.action = "na.exclude")
After I have calculated the prediction using:
Pred1 <- predict(Model1, type = "response", na.action = "na.exclude")
My question
2008 May 13
0
Un-reproductibility of SVM classification with 'e1071' libSVM package
Hello,
When calling several times the svm() function, I get different results.
Do I miss something, or is there some random generation in the C library?
In this second hypothesis, is it possible to fix an eventual seed?
Thank you
Pierre
### Example
library('e1071')
x = rnorm(100) # train set
y = rnorm(100)
c = runif(100)>0.5
x2 = rnorm(100)# test set
y2 = rnorm(100)
# learning a
2005 Aug 07
1
prediction from glm...
Hello r-help,
I'm trying to fit birds counts over years using glm. In fact I'm trying to reproduce an analysis already perform with genstat (attach document). I have done (with Estate
and year as factors):
Model1 <- glm(Females~Estate+Year+offset = log(area)), family =
quasipoisson(link = log), na.action = "na.exclude")
After I have calculated the prediction using:
Pred1