similar to: Wish R Core had a standard format (or generic function) for "newdata" objects

Displaying 20 results from an estimated 6000 matches similar to: "Wish R Core had a standard format (or generic function) for "newdata" objects"

2009 Dec 30
2
Negbin Error Warnings
Hi, I ran a negative binomial regression (NBR) using the Zelig-package and the negbin model. When I then try to use the simumlation approach using the setx () and sim() functions to calculate expected values and first difference for different levels of one of my independent variables, I get 50 errors warnings, telling me that the calculation rpois produced NAs. However, the data I use
2009 Oct 30
1
Package zelig
hello all I am using the R package Zelig for some tobit regression with robust standard errors. I have got R version 2.9.2 (2009-08-24) and Zelig Version: 3.4-5 when i do demo(robust) It ends like this way data(coalition) > # Fit the model with robust standard error > user.prompt() Press <return> to continue: > z.out3 <- zelig(Surv(duration, ciep12) ~ polar + numst2 +
2009 Dec 30
1
Fwd: Negbin Error Warnings
Dear Clara, Thanks for the reply. I am forwarding your message to the list, ok. When I wrote was a way of get further information to help the helpers. happy holidays, milton ---------- Forwarded message ---------- From: Clara Brück <clara_brueck@web.de> Date: 2009/12/30 Subject: Re: [R] Negbin Error Warnings To: milton ruser <milton.ruser@gmail.com> Dear Milton, Thanks for
2011 Dec 16
1
Zellig Error Message
I'm trying to calculate predicted probabilities in R with Zelig and keep getting the following error. Can anyone help? > x.low <- setx(mod, type=1)Error in dta[complete.cases(mf), names(dta) %in% vars, drop = FALSE] : incorrect number of dimensions When I ran the model, I ran everything but the explanatory variable as a numeric variable. Now, I'm trying everything and no
2004 Mar 23
0
New R package
Zelig: Everyone's Statistical Software Kosuke Imai, Gary King and Olivia Lau Version 1.0 (Available at http://gking.harvard.edu/zelig) A growing proportion of statisticians and methodologists from many disciplines are converging on R, a powerful statistics package and programming language. As an open source project, R is freely
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
2010 Jun 26
1
predict newdata question
Hi: I am using a subset of the below dataset to predict PRED_SUIT for the whole dataset but I am having trouble with 'newdata'. The model was created with 153 records and want to predict for 208 records. wolf2 <- structure(list(gridcell = c(367L, 444L, 533L, 587L, 598L, 609L, 620L, 629L, 641L, 651L, 662L, 674L, 684L, 695L, 738L, 748L, 804L, 805L, 872L, 919L, 929L, 938L, 950L, 958L,
2006 Mar 30
1
Predict function for 'newdata' of different dimension in svm
I am using the "predict" function on a support vector machine (svm) object, and I don't understand why I can't predict on a dataset with more observations than the training dataset. I think this problem is a generic "predict" problem, but I'm not sure. The original svm was fit on 50 observations.
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) :
2008 Apr 04
2
predict.glm & newdata
Hi all - I'm stumped by the following mdl <- glm(resp ~ . , data = df, family=binomial, offset = ofst) WORKS yhat <- predict(mdl) WORKS yhat <- predict(mdl,newdata = df) FAILS Error in drop(X[, piv, drop = FALSE] %*% beta[piv]) : subscript out of bounds I've tried without offset, quoting binomial. The offset variable ofst IS in df. Previous postings indicate possible
2012 May 16
1
survival survfit with newdata
Dear all, I am confused with the behaviour of survfit with newdata option. I am using the latest version R-2-15-0. In the simple example below I am building a coxph model on 90 patients and trying to predict 10 patients. Unfortunately the survival curve at the end is for 90 patients. Could somebody please from the survival package confirm that this behaviour is as expected or not - because I
2008 Nov 11
1
using newdata in survfit with categorical variable
Hi R-helpers, I was trying to put gender='Male' in newdata to create a expected survival curve for a pseudo cohort by using survfit based on Cox regression. My codes are shown below: fit<- coxph(Surv(end, status2)~gender, data=wlwsn1) Summary(fit) coef exp(coef) se(coef) z p genderMale 0.204 1.23 0.0912 2.23 0.025
2010 May 19
1
Pausing calculations for a fixed amount of time
Is there any way to pause R for a gvien time period, i.e. without the need for user intervention? I've got a loop that I want to have work as hard as it can as long as there is data coming in, but when there is no new data, I would like it to pause before checking again. Something like in the following construction: Set up environment: load libraries, establish database connections, etc.
2008 Apr 07
2
basehaz and newdata
I am unable to get the basehaz function to apply a proportional hazards model to a new data frame. I replicated my specific situation with the example for coxph in the help, where I changed the x value of the first record from 0 to 1. Is there something incorrect in the syntax that I am using? Thanks in advance! test1 <- list(time= c(4, 3,1,1,2,2,3), status=c(1,NA,1,0,1,1,0),
2010 Dec 25
2
predict.lrm vs. predict.glm (with newdata)
Hi all I have run into a case where I don't understand why predict.lrm and predict.glm don't yield the same results. My data look like this: set.seed(1) library(Design); ilogit <- function(x) { 1/(1+exp(-x)) } ORDER <- factor(sample(c("mc-sc", "sc-mc"), 403, TRUE)) CONJ <- factor(sample(c("als", "bevor", "nachdem",
2012 May 23
1
prcomp with previously scaled data: predict with 'newdata' wrong
Hello folks, it may be regarded as a user error to scale() your data prior to prcomp() instead of using its 'scale.' argument. However, it is a user thing that may happen and sounds a legitimate thing to do, but in that case predict() with 'newdata' can give wrong results: x <- scale(USArrests) sol <- prcomp(x) all.equal(predict(sol), predict(sol, newdata=x)) ## [1]
2004 Apr 09
2
Regression models w/ splines
Hi - I am fitting various Cox PH models with spline predictors. After fitting the model, I would like to use termplot() to examine the functional form of the fitted model (e.g., to obtain a plot of the relative risk (or log r.r.) versus the predictors). When there is only 1 predictor in the model, termplot returns a "?". In this case, I have not been able to figure out how to create
2013 Feb 24
1
Use of the newdata parameter in the predict.coxph function
Hello, I've executed the following predict.coxph function to enable prediction for new variable values (error is included). *predict(cox_out,newdata=data.frame(Meter3.Value=100.001, Meter4.Value=200.001,Meter5.Value=300.001,Meter10.Value= 400.001,type="expected")) Error in model.frame.default(data = data.frame(Meter3.Value = 100.001, : variable lengths differ (found for
2005 Jun 15
3
Error using newdata argument in survfit
Dear R-helpers, To get curves for a pseudo cohort other than the one centered at the mean of the covariates, I have been trying to use the newdata argument to survfit with no success. Here is my model statement, the newdata and the ensuing error. What am I doing wrong? > summary(fit) Call: coxph(formula = Surv(Start, Stop, Event, type = "counting") ~ Week + LagAOO + Prior.f +
2010 Dec 21
0
"variable lengths differ (found for '(weights)')" error in Zelig library
Dear R users, I am trying to estimate to estimate the average treatmen effect on the treated (ATT) using first the MatchIt software to weight the data set and, after this, the Zelig software as shown in Ho et al. (2007). See here for an explanation of how to apply this technique in R: http://imai.princeton.edu/research/files/matchit.pdf I encounter a slight problem when I apply the weights that