Displaying 20 results from an estimated 20000 matches similar to: "what is set.fit in function predict.lm"
2004 Jul 15
2
formula and lm
Hi, don' t understand why the function fomula have this error, i enclose
the parameter "a" with the function I()
Thank Ruben
x<-1:5
y<-c( 2 ,4 , 6 , 8 ,11)
formu<-y~I(a*x)
form<-formula(formu)
dummy<-data.frame(x=x,y=y)
fm<-lm(form,data=dummy)
Error in unique(c("AsIs", oldClass(x))) : Object "a" not found
2003 Nov 26
5
multiple peaks in data frame
Hello, it wanted to know how I can extract of a dates frame the values
peaks according to an interval that I
establish. For example if dates are:
1 23
2 4
3 56
4 7
5 99
6 33
extract the date i wanted to divide into intervals of 2 an
d to take alone the numbers 23, 56 and 99 of those 3 intervals. Thanks
Ruben
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.
2012 Oct 03
3
predict.lm if regression vector is longer than predicton vector
Hi everybody,
recently a member of the community pointed me to the useful predict.lm()
comment. While I was toying with it, I stumbled across the following
problem.
I do the regression with data from five years. But I want to do a prediction
with predict.lm for only one year. Thus my dataframe for predict.lm(mod,
newdata=dataframe) is shorter than the orginial vector that I did the
regression
2004 Mar 29
2
how transform excell file to text file in R
Hello, it want to know if there is a library that transform a file in
excell (*. xls) to text file(*.txt, *,prn, *.csv). Thanks
2003 Sep 01
2
Axis color
Hello, my question is if I have two axes in a graphics as I can put him a
different color al axis and to the number of the scale. ? Thanks. Ruben
2004 Jul 15
5
formula
Hi, i 'dont understand how to take a general formula, view this:
x<-1:5
y<-c(0,1,1.7,2,2.1.4)
dummy<-data.frame(x=x,y=y)
formula<-"y~A*log(x)/log(2)"
formu<-as.formula(formula)
fm<-lm(formu,data=dummy)
Error in eval(expr, envir, enclos) : Object "A" not found
but A is the parameter of fitting, why is this?Thanks Ruben
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 =
2004 Jul 13
2
help with as.function
HI, sorry but i don't understand how to make a function with as.function()
formula<-"2+3*x"
formu<-as.symbol(formula)
> formu
2+3*x
formul<-as.function(alist(x=,formu))
curve(formul,1,5,col="blue")
Error in xy.coords(x, y, xlabel, ylabel, log) :
x and y lengths differ
> typeof(formul)
[1] "closure"
and not plot the curve function, Why?
2011 Dec 14
1
termplot & predict.lm. some details about calculating predicted values with "other variables set at the mean"
I'm making some functions to illustrate regressions and I have been
staring at termplot and predict.lm and residuals.lm to see how this is
done. I've wondered who wrote predict.lm originally, because I think
it is very clever.
I got interested because termplot doesn't work with interactive models:
> m1 <- lm(y ~ x1*x2)
> termplot(m1)
Error in `[.data.frame`(mf, , i) :
2011 Apr 20
1
How can I 'predict' from an nls model with a fit specified for separate groups?
Following an example on p 111 in 'Nonlinear Regression with R' by Ritz &
Streibig, I have been fitting nls models using square brackets with the
grouping variable inside. In their book is this example, in which
'state' is a factor indicating whether a treatment has been used or not:
> Puromycin.m1 <- nls(rate ~ Vm[state] *
+ conc/(K[state] + conc), data = Puromycin,
2010 Aug 17
3
predict.lm, matrix in formula and newdata
Dear all,
I am stumped at what should be a painfully easy task: predicting from an lm object. A toy example would be this:
XX <- matrix(runif(8),ncol=2)
yy <- runif(4)
model <- lm(yy~XX)
XX.pred <- data.frame(matrix(runif(6),ncol=2))
colnames(XX.pred) <- c("XX1","XX2")
predict(model,newdata=XX.pred)
I would have expected the last line to give me the
2006 Jan 18
1
se.fit in predict.nls
The option se.fit in predict.nls is currently ignored.
Is there any other function available to calculate the
error in the predictions?
Thanks,
Manuel
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y m??viles desde 1 c??ntimo por minuto.
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]
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
2008 Apr 07
2
predict.lm() question
Dear R-people ...
I'm a new user. I can't get predict.lm() to produce predictions for
new independent data. There are some messages in archived help about
this problem, but I still don't see my error after reviewing
those. I understand that the new independent data must have the same
name(s) as used when the model was made.
In the example below, predict.lm produces the
1997 Sep 15
2
R-alpha: predict.lm -- who ..?
Just a short reminder / question --
We've had one posting
>> Date: Sun, 17 Aug 1997 19:51:20 -0700
>> From: Kung-Sik Chan <kchan@stat.uiowa.edu>
>> To: r-help@stat.math.ethz.ch
>> Subject: R-beta: bug report
with a predict.default that would "work" with (some) lm objects,
and I think it was said that predict.lm "is being" written
(Peter
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 02
1
Use predict.lm
Hi All,
I created a two variable lm() model
slm<-lm(y[1:3000,8]~y[1:3000,12]+y[1:3000,15])
I made two predictions
predict(slm,newdata=y[201:3200,])
predict(slm,newdata=y[601:3600,])
there is no error message for either of these.
the results are identical, and identical to slm$fitted as well.
if this is not the right way to apply the model coefficients to a new
set of inputs, what is
2013 Jan 30
2
How does predict() calculate prediction intervals?
For a given linear regression, I wish to find the 2-tailed t-dist
probability that Y-hat <= newly observed values. I generate prediction
intervals in predict() for plotting, but when I calculate my t-dist
probabilities, they don't agree. I have researched the issues with variance
of individual predictions and been advised to use the variance formula
below (in the code).
I presume my