Displaying 20 results from an estimated 2000 matches similar to: "ols function in rms package"
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
2011 Mar 09
2
rms: getting adjusted R^2 from ols object
How can I extract the adjusted R^2 value from an ols object (using rms package)?
library(rms)
x <- rnorm(10)
y <- x + rnorm(10)
ols1 <- ols(y ~ x)
Typing "ols1" displays adjusted R^2 among other things, but how can I
assign it to a variable? I tried str(ols1) but couldn't see where to
go from there.
Thanks,
Mark Seeto
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
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
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
2007 Mar 14
2
ols Error : missing value where TRUE/FALSE needed
I have installed Hmisc and Design. When I use ols, I get the
following error message:
Error in if (!length(fname) || !any(fname == zname)) { :
missing value where TRUE/FALSE needed
The model that I am running is:
> ecools <- ols(eco$exp ~ eco$age + eco$own + eco$inc + inc2, x=TRUE)
I have tried several other combinations of arguments that take TRUE/
FALSE values, but no luck.
2009 Nov 05
1
help with ols and contrast functions in Design library
Dear All,
I'm trying to use the ols function in the Design library (version
2.1.1) of R to estimate parameters of a linear model, and then use the
contrast function in the same library to test various contrasts.
As a simple example, suppose I have three factors: feature (3
levels), group (2 levels), and patient (3 levels). Patient is coded
as a non-unique identifier and is
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
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,
2011 Mar 01
0
Major update to rms package
A new version of rms is now available on CRAN for Linux and Windows (Mac
will probably be available very soon). Largest changes include latex
methods for validate.* and adding the capability to force a subset of
variables to be included in all backwards stepdown models (single model or
validation by resampling).
Recent updates:
* In survplot.rms, fixed bug (curves were undefined if
2011 Mar 01
0
Major update to rms package
A new version of rms is now available on CRAN for Linux and Windows (Mac
will probably be available very soon). Largest changes include latex
methods for validate.* and adding the capability to force a subset of
variables to be included in all backwards stepdown models (single model or
validation by resampling).
Recent updates:
* In survplot.rms, fixed bug (curves were undefined if
2007 May 04
3
Error in if (!length(fname) || !any(fname == zname)) { :
Dear R users,
I tried to fit a cox proportional hazard model to get estimation of stratified survival probability. my R code is as follows:
cph(Surv(time.sur, status.sur)~ strat(colon[,13])+colon[,18] +colon[,20]+colon[,9], surv=TRUE)
Error in if (!length(fname) || !any(fname == zname)) { :
missing value where TRUE/FALSE needed
Here colon[,13] is the one that I want to stratify and the
2008 Apr 01
1
lrm -interaction without main effect-error message
Dear all,
this might be not only an R-question but also a statistical.
When I do a logistic regression analysis (species distribution modeling)
with function lrm (Design package) I get the follwoing error message:
> tadl1<-lrm(triad~fd+dista+fd2+dista2+fd:dista+dista:geo2, x=T, y=T)
Error in if (!length(fname) || !any(fname == zname)) { :
missing value where TRUE/FALSE needed
The
2001 Feb 10
1
match.call() and do.call()
hi all -
i have a function that needs to call glm() with a weights argument that
includes a variable whose name comes from the caller. so instead of:
fit <- glm(formula, poisson(), data, weights = 1-z, ...),
i do something like this:
fit <- do.call("glm", list(formula=formula, family=poisson(),
data=data, weights = call("-", 1, as.name(zname)), ...))
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
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
2005 Dec 17
2
diagnostic functions to assess fitted ols() model: Confidence is too narrow?!
Dear all,
When fitting an "ols.model", the confidence interval at 95% doesn't cover
the plotted data points because it is very narrow.
Does this mean that the model is 'overfitted' or is there a specific amount
of serial correlation in the residuals?
Which R functions can be used to evaluate (diagnostics) major model
assumptions (residuals, independence, variance) when
2011 May 17
2
can not use plot.Predict {rms} reproduce figure 7.8 from Regression Modeling Strategies (http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf)
Dear R-users,
I am using R 2.13.0 and rms 3.3-0 , but can not reproduce figure 7.8 of the
handouts *Regression Modeling Strategies* (
http://biostat.mc.vanderbilt.edu/wiki/pub/Main/RmS/course2.pdf) by the
following code. Could any one help me figure out how to solve this?
setwd('C:/Rharrell')
require(rms)
load('data/counties.sav')
older <- counties$age6574 + counties$age75
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