Displaying 20 results from an estimated 50000 matches similar to: "predict.lm"
2013 Apr 09
0
predict.lm (Michael Haenlein)
Michael Haenlein wrote
Dear all,
I would like to use predict.lm to obtain a set of predicted values
based on
a regression model I estimated.
When I apply predict.lm to two vectors that have the same values, the
predicted values will be identical. I know that my regression model
is not
perfect and I would like to take account of the error inherent in
the model
2010 Apr 15
2
predict.lm with NAs
Hi,
I wanted to use the predict.lm() function to compare the empirical data with the predicted values.
The problem is that I have NAs in my data.
I wanted to cbind my data.frame with the empirical values with the vector I get from predict.lm.
But they don't have the same length because predict.lm just skip NA-predictions.
Is there a way to get a vector with predicted values of the same
2005 Jul 20
1
predict.lm - standard error of predicted means?
Simple question.
For a simple linear regression, I obtained the "standard error of
predicted means", for both a confidence and prediction interval:
x<-1:15
y<-x + rnorm(n=15)
model<-lm(y~x)
predict.lm(model,newdata=data.frame(x=c(10,20)),se.fit=T,interval="confidence")$se.fit
1 2
0.2708064 0.7254615
2012 Feb 17
1
Standard errors from predict.gam versus predict.lm
I've got a small problem.
I have some observational data (environmental samples: abiotic explanatory variable and biological response) to which I've fitted both a multiple linear regression model and also a gam (mgcv) using smooths for each term. The gam clearly fits far better than the lm model based on AIC (difference in AIC ~ 8), in addition the adjusted R squared for the gam is
2010 Jan 19
4
Remove term from formula for predict.lm
Hi,
probably just a quick question: can I somehow change the formula used with predict? E.g., the regression was run on "y ~ u + v + w" but for the prediction the term v should be removed from the formula contained in the regression object and only "y ~ u + w" be used.
I could use model.matrix etc. to do the predictions but it would be very helpful to know a simpler way.
2011 Jul 25
1
predict() and heteroskedasticity-robust standard errors
Hello there,
I have a linear regression model for which I estimated
heteroskedasticity-robust (Huber-White) standard errors using the
coeftest function
in the lmtest-package.
Now I would like to inspect the predicted values of the dependent
variable for particular groups and include a confidence interval for
this prediction.
My question: is it possible to estimate confidence intervals for the
2010 Nov 12
3
predict.coxph
Since I read the list in digest form (and was out ill yesterday) I'm
late to the discussion.
There are 3 steps for predicting survival, using a Cox model:
1. Fit the data
fit <- coxph(Surv(time, status) ~ age + ph.ecog, data=lung)
The biggest question to answer here is what covariates you wish to base
the prediction on. There is the usual tradeoff between too few (leave
out something
2007 Oct 05
2
question about predict.gam
I'm fitting a Poisson gam model, say
model<-gam(a65tm~as.factor(day.week
)+as.factor(week)+offset(log(pop65))+s(time,k=10,bs="cr",fx=FALSE,by=NA,m=1),sp=c(
0.001),data=dati1,family=poisson)
Currently I've difficulties in obtaining right predictions by using
gam.predict function with MGCV package in R version 2.2.1 (see below my
syntax).
2011 Jun 24
2
mgcv:gamm: predict to reflect random s() effects?
Dear useRs,
I am using the gamm function in the mgcv package to model a smooth relationship between a covariate and my dependent variable, while allowing for quantification of the subjectwise variability in the smooths. What I would like to do is to make subjectwise predictions for plotting purposes which account for the random smooth components of the fit.
An example. (sessionInfo() is at
2008 Jul 03
3
problem with lm and predict - no predictions made
Hi
I have a problem with lm and predict
I have
us
[1] 2789.53 3128.43 3255.03 3536.68 3933.18 4220.25 4462.83 4739.48
[9] 5103.75 5484.35 5803.08 5995.93 6337.75 6657.40 7072.23 7397.65
[17] 7816.83 8304.33 8746.98 9268.43 9816.98 10127.95 10469.60 10960.75
[25] 11685.93 12433.93 13194.70 13843.83
us.p
[1] 227.62 229.92 232.13 234.25 236.31 238.42 240.59 242.75 244.97
2011 May 22
1
using predict.lm function
Dear all,
I'm fitting a linear model with numerous lag terms of the response variable [i.e. y(t-1), y(t-2),y(t-3)...,] and other explanatory variables [x(1), x(2), x(3),....]- which go into my design matrix X.
I'm fitting the linear model: lm(Y ~ X, ...).
I would like to use the predict.lm function however the future predictions of Y are dependent upon previous predictions of Y [i.e.
2006 Jan 26
2
Prediction when using orthogonal polynomials in regression
Folks,
I'm doing fine with using orthogonal polynomials in a regression context:
# We will deal with noisy data from the d.g.p. y = sin(x) + e
x <- seq(0, 3.141592654, length.out=20)
y <- sin(x) + 0.1*rnorm(10)
d <- lm(y ~ poly(x, 4))
plot(x, y, type="l"); lines(x, d$fitted.values, col="blue") # Fits great!
all.equal(as.numeric(d$coefficients[1] + m
2009 Sep 13
2
How can I get "predict.lm" results with manual calculations ? (a floating point problem)
Hello dear r-help group
I am turning for you for help with FAQ number 7.31: "Why doesn't R think
these numbers are equal?"
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
*My story* is this:
I wish to run many lm predictions and need to have them run fast.
Using predict.lm is relatively slow, so I tried having it run faster by
2006 Nov 09
1
predict.lm "variables found" question
hello,
I'm trying to predict some values based on a linear regression model.
I've created the model using one dataframe, and have the prediction
values in a second data frame (call it newdata). There are 56 rows in
the dataframe used to create the model and 15 in newdata.
I ran predict(model1, newdata) and get the warning: 'newdata' had 15
rows but variable(s) found have 56 rows
2006 May 19
1
How to use lm.predict to obtain fitted values?
I am writing a function to assess the out of sample predictive capabilities
of a time series regression model. However lm.predict isn't behaving as I
expect it to. What I am trying to do is give it a set of explanatory
variables and have it give me a single predicted value using the lm fitted
model.
> model = lm(y~x)
> newdata=matrix(1,1,6)
> pred =
2008 May 28
1
confidence interval for the logit - predict.glm
Hello all,
I've come across an online posting
http://www.biostat.wustl.edu/archives/html/s-news/2001-10/msg00119.html
that described how to get confidence intervals for predicted values from predict.glm. These instructions were meant for S-Plus. Yet, it generally seems to work with R too, but I am encountering some problems. I am explaining my procedure in the following and would be most
2006 Jul 12
1
Prediction interval of Y using BMA
Hello everybody,
In order to predict income for different time points, I fitted a linear
model with polynomial effects using BMA (bicreg(...)). It works fine, the
results are consistent with what we are looking for.
Now, we would like to predict income for a future time point t_next and of
course draw the prediction interval around the estimated value for this
point t_next. I've found the
2012 Dec 03
2
Different results from random.Forest with test option and using predict function
Hello R Gurus,
I am perplexed by the different results I obtained when I ran code like
this:
set.seed(100)
test1<-randomForest(BinaryY~., data=Xvars, trees=51, mtry=5, seed=200)
predict(test1, newdata=cbind(NewBinaryY, NewXs), type="response")
and this code:
set.seed(100)
test2<-randomForest(BinaryY~., data=Xvars, trees=51, mtry=5, seed=200,
xtest=NewXs, ytest=NewBinarY)
The
2010 Sep 20
5
predict.lrm ( Design package)
Dear List,
I am familier with binary models, however i am now trying to get predictions from a ordinal model and have a question.
I have a data set made up of 12 categorical predictors, the response variable is classed as 1,2,3,4,5,6, this relates to threat level of the species ( on the IUCN rating).
Previously i have combined levels 1 and 2 to form = non threatened and then combined 3-6 to
2010 Nov 11
2
predict.coxph and predict.survreg
Dear all,
I'm struggling with predicting "expected time until death" for a coxph and
survreg model.
I have two datasets. Dataset 1 includes a certain number of people for which
I know a vector of covariates (age, gender, etc.) and their event times
(i.e., I know whether they have died and when if death occurred prior to the
end of the observation period). Dataset 2 includes another