similar to: predicting glm on a new dataset

Displaying 20 results from an estimated 20000 matches similar to: "predicting glm on a new dataset"

2014 Jan 13
1
predict.glm line 28. Please explain
I imitated predict.glm, my thing worked, now I need to revise. It would help me very much if someone would explain predict.glm line 28, which says object$na.action <- NULL # kill this for predict.lm calls I want to know 1) why does it set the object$na.action to NULL 2) what does the comment after mean? Maybe I need a pass by value lesson too, because I can't see how changing that
2016 Apr 18
1
project test data into principal components of training dataset
Hi there, I've a training dataset and a test dataset. My aim is to visually allocate the test data within the calibrated space reassembled by the PC's of the training data set, furthermore to keep the training data set coordinates fixed, so they can serve as ruler for measurement for additional test datasets coming up. Please find a minimum working example using the wine dataset below.
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
2009 Mar 12
3
help with predict and plotting confidence intervals
Dear R help, This seems to be a commonly asked question and I am able to run examples that have been proposed, but I can't seems to get this to work with my own data. Reproducible code is below. Thank you in advance for any help you can provide. The main problem is that I can not get the confidence lines to plot correctly. The secondary problem is that predict is not able to find my object
2009 Sep 04
1
predicting from segmented regression
Hello I'm having trouble figuring out how to use the output of "segmented()" with a new set of predictor values. Using the example of the help file: ??set.seed(12) xx<-1:100 zz<-runif(100) yy<-2+1.5*pmax(xx-35,0)-1.5*pmax(xx-70,0)+15*pmax(zz-.5,0)+rnorm(100,0,2) dati<-data.frame(x=xx,y=yy,z=zz) out.lm<-lm(y~x,data=dati) o<-## S3
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
2010 Sep 06
1
Prediction and confidence intervals from predict.drc
R-helpers, I am using the package "drc" to fit a 4 parameter logistic model. When I use the predict function to get prediction on a new dataset, I am not getting the requested confidence or prediction intervals. Any idea what is going on? Here is code to reproduce the problem: --- library(drc) # Fit model to existing dataset in package spinach.model <- drm(SLOPE~DOSE, data =
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 =
2011 Apr 06
2
glm predict on new data
I am aware this has been asked before but I could not find a resolution. I am doing a logit lg <- glm(y[1:200] ~ x[1:200,1],family=binomial) Then I want to predict a new set pred <- predict(lg,x[201:250,1],type="response") But I get varying error messages or warnings about the different number of rows. I have tried data/newdata and also to wrap in data.frame() but cannot get
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
2008 May 09
1
predicting from coxph with pspline
Hello. I get a bit confused by the output from the predict function when used on an object from coxph in combination with p-spline, e.g. fit <- coxph(Surv(time1, time2, status)~pspline(x), Data) predict(fit, newdata=data.frame(x=1:2)) It seems like the output is somewhat independent of the x-values to predict at. For example x=1:2 gives the same result as x=21:22. Does the result span the
2010 Aug 30
1
'mgcv' package, problem with predicting binomial (logit) data
Dear R-help list, I?m using the mgcv package to plot predictions based on the gam function. I predict the chance of being a (frequent) participant at theater plays vs. not being a participant by age. Because my outcome variable is dichotomous, I use the binomial family with logit link function. Dataset in attachment, code to read it in R: data <- read.spss("pas_r.sav") attach(data)
2003 Apr 02
4
randomForests predict problem
Hello everybody, I'm testing the randomForest package in order to do some simulations and I get some trouble with the prediction of new values. The random forest computation is fine but each time I try to predict values with the newly created object, I get an error message. I thought I was because NA values in the dataframe, but I cleaned them and still got the same error. What am I
2006 Feb 05
1
how to extract predicted values from a quantreg fit?
Hi, I have used package quantreg to estimate a non-linear fit to the lowest part of my data points. It works great, by the way. But I'd like to extract the predicted values. The help for predict.qss1 indicates this: predict.qss1(object, newdata, ...) and states that newdata is a data frame describing the observations at which prediction is to be made. I used the same technique I used
2012 Aug 07
1
Interpreting predictions of svm
Hi, I have some difficulties in interpreting the prediction of a svm model using the package e1071. y1 is the variable I want to predict. It is of type factor and has got two levels: "< 50%" and "> 50%". z is the dataset. > model <- svm(y1 ~ ., data = z,type="C-classification", cross=10) > model Call: svm(formula = y1 ~ ., data = z, type =
2006 May 20
1
(PR#8877) predict.lm does not have a weights argument for newdata
Dear R developers, I am a little disappointed that my bug report only made it to the wishlist, with the argument: Well, it does not say it has. Only relevant to prediction intervals. predict.lm does calculate prediction intervals for linear models from weighted regression, so they should be correct, right? As far as I can see they are bound to be wrong in almost all cases, if no weights
2011 Apr 19
1
Prediction interval with GAM?
Hello, Is it possible to estimate prediction interval using GAM? I looked through ?gam, ?predict.gam etc and the mgcv.pdf Simon Wood. I found it can calculate confidence interval but not clear if I can get it to calculate prediction interval. I read "Inference for GAMs is difficult and somewhat contentious." in Kuhnert and Venable An Introduction to R, and wondering why and if that
2000 Feb 17
3
se from predict.glm
I am not sure whether it is a design decision or just an oversight. When I ask for the standard errors of the predictions with predict(budwm.lgt,se=TRUE) where budwm.lgt is a logistic fit of the budworm data in MASS, I got Error in match.arg(type) : ARG should be one of response, terms If one is to construct a CI for the fitted binomial probability, wouldn't it be more natural to do
2002 Jun 02
1
predicting non-numeric values
Hi all, I had asked a question a few days ago on this list. I did not receive an answer. Since it was important to me, I looked for the answer in some references but as I am not really a statistics guy, the jargon was overwhelming for me. I apologize if this question is too trivial. Here is the question again: I used the lm() function to fit a linear model to a set of items that I got from a
2007 Aug 21
2
prediction interval for multiple future observations
Hi! '?predict.lm' says that the prediction intervals returned by predict() are for single observation only. Is there a way to specify the desired number of observations to construct the interval for? R version 2.4.1 (2006-12-18) -- Vlad Skvortsov, vss at 73rus.com, http://vss.73rus.com