Displaying 20 results from an estimated 40000 matches similar to: "Predict function"
2002 Oct 31
3
Loess with glm ?
Hello,
I am wondering if there is an easy way to combine loess() with glm()
to produce a locally fitted generalised regression.
I have a data set of about 5,000 observations and 5 explanatory variables,
with a binary outcome. One of the explanatory variables (lets call it X)
is much more predictive than the others. A single glm() regression over
the entire data set produces rather poor results,
2016 Apr 26
0
Predicting probabilities in ordinal probit analysis in R
Dear all,
I have two questions that are almost completely related to how to do things in R.
I am running an ordinal probit regression analysis in R. The dependent variable has three levels (0=no action; 1=warning; 2=sanction).
I use the lrm command in the rms package:
print( res1<- lrm(Y ~ x1+x2+x3+x4+x5+x6, y=TRUE, x=TRUE, data=mydata))
I simply couldn't make any sense of the
2009 Jun 18
3
predict.glm and predict.gam output
Hi all,
I am currently trying to compare different plant occurrence prediction
maps generated in R and exported into GRASS. One of these maps was
generated from a glm fitted to some data, and subsequently applying this
glm model to a wider region using predict.glm. The outcome here was a
probability of occurrence. The second map I generated using a gam
(mgcv), however, this map seems to have
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 =
2009 Apr 30
0
Using predict with glmmPQL
I am wondering if anyone knows how to use predict with a glmmPQL model,
where you want to predict the response for one factor in the model?
Originally I used predict on a GLM (gamma, log link) in the following
way:
p.1<-predict(model1,data.frame(year=as.factor(xv),nafdiv=as.factor(rep("
3N",length(xv))), duration=1000, cfv=as.factor(rep(106166,length(xv))),
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
>
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.
>
2008 Nov 25
4
glm or transformation of the response?
Dear all,
For an introductory course on glm?s I would like to create an example to show the difference between
glm and transformation of the response. For this, I tried to create a dataset where the variance
increases with the mean (as is the case in many ecological datasets):
poissondata=data.frame(
response=rpois(40,1:40),
explanatory=1:40)
attach(poissondata)
However, I have run into
2008 Apr 15
1
Predicting ordinal outcomes using lrm{Design}
Dear List,
I have two questions about how to do predictions using lrm, specifically
how to predict the ordinal response for each observation *individually*.
I'm very new to cumulative odds models, so my apologies if my questions are
too basic.
I have a dataset with 4000 observations. Each observation consists of
an ordinal outcome y (i.e., rating of a stimulus with four possible
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.
2011 Jan 12
0
flexmix: predictions on new data from flexmix object
Dear R Users, R Core Team,
I currently wonder how to predict the probability of an event with new data resulting from a finite mixture.
I read the documentation of the flexmix package and the examples of applications provided on CRAN but I could not find how to predict (except "manually" but I am looking for a simpler solution) the final probability of the mixture (for each individual)
2008 Dec 17
2
PREDICT NEW VALUES FROM REGRESSION MODEL, EST. ST.ERROR, AND CI
Greetings,
I'd be grateful if a good Samaritan helps me to approach this problem....
with my data, I've created the following model
lm(formula = OUTCOME ~ VAR1 + VAR2)
summary(model)
Call:
lm(formula = OUTCOME ~ VAR1 + VAR2)
Residuals:
Min 1Q Median 3Q Max
-1.4341 -0.3621 0.1879 0.4994 0.7696
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.89020
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.
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 Dec 13
1
predict.lm[e] with formula passed as a variable
Dear all,
In a function I paste a string and convert it to a formula which I pass
to lm[e]. The idea is to write a function which takes the name of the
response variable and the explanatory variable and the data frame as an
argument and calculates an lm[e]. (see example below)
This works fine, but if I want to make a prediction on this model, R
complains that the object holding the formula
2012 Jan 17
2
Prediciting sports team scores
I am working on predicitng the scores for a days worth of matches of team
sports. I have already collected data for the teams for the season we are
concentrating on.
I have been fitting poisson models for football games and have worked out
what model is best and which predictor variables are most important.
We would now like to predict the probability distribution for the scores for
each team.
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
2011 Nov 14
7
Very simple loop
I'm very new to R and am trying to create my first loop.
I have:
x <-c(0:200)
A <- dpois(x,exp(4.5355343))
B <- dpois(x,exp(4.5355343 + 0.0118638))
C <- dpois(x,exp(4.5355343 -0.0234615))
D <- dpois(x,exp(4.5355343 + 0.0316557))
E <- dpois(x,exp(4.5355343 + 0.0004716))
F <- dpois(x,exp(4.5355343 + 0.056437))
G <- dpois(x,exp(4.5355343 + 0.1225822))
and would like to
2010 Dec 14
1
rpart - how to estimate the “meaningful” predictors for an outcome (in classification trees)
Hi dear R-help memebers,
When building a CART model (specifically classification tree) using rpart,
it is sometimes obvious that there are variables (X's) that are meaningful
for predicting some of the outcome (y) variables - while other predictors
are relevant for other outcome variables (y's only).
*How can it be estimated, which explanatory variable is "used" for which of
2002 Jan 09
1
na.action in predict.lm
I would like to predict a matrix containing missing values according to a
fitted linear model.
The predicted values must have the same length as the number of
observations in newdata, where missing predicted values (due to missing
explanatory values) are replaced by NA. How can I achieve this? I tried
the following example:
> x <- matrix(rnorm(100), ncol=10)
> beta <- rep(1, 10)
>