similar to: rms: getting adjusted R^2 from ols object

Displaying 20 results from an estimated 1000 matches similar to: "rms: getting adjusted R^2 from ols object"

2011 Jun 08
1
predict with model (rms package)
Dear R-help, In the rms package, I have fitted an ols model with a variable represented as a restricted cubic spline, with the knot locations specified as a previously defined vector. When I save the model object and open it in another workspace which does not contain the vector of knot locations, I get an error message if I try to predict with that model. This also happens if only one workspace
2011 Apr 12
2
Model formula for ols function (rms package)
Dear R help, I'm having some trouble with model formulas for the ols function in the rms package. I want to have two variables represented as restricted cubic splines, and also include an interaction as a product of linear terms, but I get an error message. library(rms) d <- data.frame(x1 = rnorm(50), x2 = rnorm(50), y = rnorm(50)) ols(y ~ rcs(x1,3) + rcs(x2,3) + x1*x2, data=d) Error in
2010 Jun 07
1
ols function in rms package
Hello, I have a couple of questions about the ols function in Frank Harrell's rms package. Is there any way to specify variables by their column number in the data frame rather than by the variable name? For example, library(rms) x1 <- rnorm(100, 0, 1) x2 <- rnorm(100, 0, 1) x3 <- rnorm(100, 0, 1) y <- x2 + x3 + rnorm(100, 0, 5) d <- data.frame(x1, x2, x3, y) rm(x1, x2, x3,
2002 May 11
2
Bug on Mac version of lm()?
Dear Mac users, Hi, as you might have probably read the thread of "[R] Rsquared in summary(lm)" on May 10, it seems that Mac version of lm() seem to be working incorrectly. I enclose the script to produce the result both for lm() and manual calculation for a simple regression. Could you run the script and report with the version of R, so I don't have to go through every builds
2009 Sep 08
2
Very basic question regarding plot.Design...
Hello ALL! I have a problem to plot factor (lets say gender) as a line, or at least both line and point, from ols model: ols1 <- ols(Y ~ gender, data=dat, x=T, y=T) plot(ols1, gender=NA, xlab="gender", ylab="Y", ylim=c(5,30), conf.int=FALSE) If I convert gender into discrete numeric predictor, and use forceLines=TRUE, plot is not nice and true, since it shows values
2010 Jun 29
1
Model validation and penalization with rms package
I?ve been using Frank Harrell?s rms package to do bootstrap model validation. Is it the case that the optimum penalization may still give a model which is substantially overfitted? I calculated corrected R^2, optimism in R^2, and corrected slope for various penalties for a simple example: x1 <- rnorm(45) x2 <- rnorm(45) x3 <- rnorm(45) y <- x1 + 2*x2 + rnorm(45,0,3) ols0 <- ols(y
2010 Aug 10
1
Multiple imputation, especially in rms/Hmisc packages
Hello, I have a general question about combining imputations as well as a question specific to the rms and Hmisc packages. The situation is multiple regression on a data set where multiple imputation has been used to give M imputed data sets. I know how to get the combined estimate of the covariance matrix of the estimated coefficients (average the M covariance matrices from the individual
2009 Dec 02
1
Incorporating the results of White's HCCM into a linear regression:
Using hccm() I got a heteroscedasticity correction factor on the diagonal of the return matrix, but I don't know how to incorporate this into my linear model: METHOD 1: > OLS1 <- lm(formula=uer92~uer+low2+mlo+spec+degree+hit) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.0623377 0.0323461 -1.927 0.057217 . uer 0.2274742 0.0758720
2012 Apr 19
2
Gls function in rms package
Dear R-help, I don't understand why Gls gives me an error when trying to fit a model with AR(2) errors, while gls (from nlme) does not. For example: library(nlme) library(rms) set.seed(1) d <- data.frame(x = rnorm(50), y = rnorm(50)) gls(y ~ x, data=d, correlation = corARMA(p=2)) #This works Gls(y ~ x, data=d, correlation = corARMA(p=2)) # Gives error # Error in
2012 Jan 24
1
Column name containing "-"
I'm trying to create a data frame in which some of the column names contain a dash "-". A simple example: d <- data.frame(x = c(0, 1)) d <- data.frame(d, y = c(0,1)) names(d)[2] <- "a.-5" d x a.-5 1 0 0 2 1 1 d <- data.frame(d, y = c(0,1)) d x a..5 y 1 0 0 0 2 1 1 1 names(d)[2] <- "a.-5" d x a.-5 y 1 0 0 0 2 1 1 1 Why
2009 May 19
4
nlrwr package. Error when fitting the optimal Box-Cox transformation with two variables
Dear all: I'm trying to fit the optimal Box-Cox transformation related to nls (see the code below) for the demand of money data in Green (3th Edition) but in the last step R gives the next error message. Error en `[.data.frame`(eval(object$data), , as.character(formula(object)[[2]])[2]) : undefined columns selected. ?Any idea to solve the problem? Thanks in advance,
2009 Mar 25
3
very fast OLS regression?
Dear R experts: I just tried some simple test that told me that hand computing the OLS coefficients is about 3-10 times as fast as using the built-in lm() function. (code included below.) Most of the time, I do not care, because I like the convenience, and I presume some of the time goes into saving a lot of stuff that I may or may not need. But when I do want to learn the properties of an
2011 Nov 11
1
Fwd: Use of R for VECM
----- Forwarded Message ----- From: vramaiah at neo.tamu.edu To: "bernhard pfaff" <bernhard.pfaff at pfaffikus.de> Sent: Friday, November 11, 2011 9:03:11 AM GMT -06:00 US/Canada Central Subject: Use of R for VECM Hello Fellow R'ers I am a new user of R and I am applying it for solving Bi-Variate (Consumption and Output) VECM with Co-Integration (I(1)) with three lags on
2002 May 09
4
Rsquared in summary(lm)
Hello, I'm doing some linear regression: >lm<-lm(osas~alp,data) >summary(lm) However, the Rsquared in the output of summary() is not the same as the "standard" Rsquared calculated by spreadsheets, and outlined in statistical guidebooks, being SSR/SSTO. The output says "multiple Rsquared", but it is no multiple regression... What's the difference? Thanks,
2011 Jul 24
1
Replying on Nabble
Sorry for the non-R question, but how do I reply through the Nabble interface and have my reply emailed to the person I'm replying to (in case they don't use Nabble), with cc to the mailing list? If I choose the option to reply to the person by email, I don't see an option to cc to the mailing list. If I reply to the list, there's an option to email the post to someone, but I
2010 Jan 21
1
Simple effects with Design / rms ols() function
Hi everyone, I'm having some difficulty getting "simple effects" for the ols() function in the rms package. The example below illustrates my difficulty -- I'll be grateful for any help. #make up some data exD <- structure(list(Gender = structure(c(1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L), .Label = c("F", "M"), class = "factor"),
2012 Jun 26
1
rms package-superposition prediction curve of ols and data points
Hello, I have a question about the ?plot.predict? function in Frank Harrell's rms package. Do you know how to superpose in the same graph the prediction curve of ols and raw data points? Put most simply, I would like to combine these two graphs: > fit_linear <- ols (y4 ~ rcs(x2,c(5,10,15,20,60,80,90)), x=TRUE, y=TRUE) > p <- Predict(fit_linear,x2,conf.int=FALSE) > plot (p,
2010 Apr 08
2
Overfitting/Calibration plots (Statistics question)
This isn't a question about R, but I'm hoping someone will be willing to help. I've been looking at calibration plots in multiple regression (plotting observed response Y on the vertical axis versus predicted response [Y hat] on the horizontal axis). According to Frank Harrell's "Regression Modeling Strategies" book (pp. 61-63), when making such a plot on new data
2004 Mar 19
2
using "unstack" inside my function: that old scope problem again
I've been reading the R mail archives and I've found a lot of messages with this same kind of problem, but I can't understand the answers. Can one of you try to explain this to me? Here's my example. Given a regression model and a variable, I want to use unstack() on the vector of residuals and make some magic with the result. But unstack hates me. PCSE <- function
2010 Jun 10
2
Specifying formula inside a function
Hello, How does one specify a formula to lm inside a function (with variable names not known in advance) and have the formula appear explicitly in the output? For example, f <- function(d) { in.model <- sample(c(0,1), ncol(d)-1, replace=T) current.model <- lm(paste(names(d)[1], "~", paste(names(d[2:ncol(d)])[which(in.model == 1)], collapse= "+")), data=d) #***