Displaying 10 results from an estimated 10 matches for "ols1".
Did you mean:
ols
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
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 2.998 0.003541 **
low2 0.0276404 0.0375770 0.736 0.463973
mlo 0.1491...
2002 May 11
2
Bug on 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 and versions of Mac R?
Here is my result where "ols1.R" is the file name for the enclosed
script.
> source("ols1.R")
-------------------------------------
Simple regression manually calculated
-------------------------------------
(Intercept) X
Estimate -67.58065 0.97926692
Std.Error 27.91071 0.03160707...
2009 May 19
4
nlrwr package. Error when fitting the optimal Box-Cox transformation with two variables
...1023.10,1163.60,1286.60,1388.90,1497.90,1631.40,1794.40,1954.90,2188.80,2371.70,2563.60)
Y<-c(2208.30,2271.40,2365.60,2423.30,2416.20,2484.80,2608.50,2744.10,2729.30,2695.00,2826.70,2958.60,3115.20,3192.40,3187.10,3248.80,3166.00,3277.70,3492.00,3573.50)
money<-data.frame(r,M,Y)
attach(money)
ols1<-lm(log(M)~log(r)+log(Y))
output1<-summary(ols1)
coef1<-ols1$coefficients
a1<-coef1[[1]]
b11<-coef1[[2]]
b21<-coef1[[3]]
money.m1<-nls(log(M)~a+b*r^g+c*Y^g,data=money,start=list(a=a1,b=b11,g=1,c=b21))
summary(money.m1)
money.m2<-boxcox(money.m1)
Prof. Ikerne del Valle Er...
2011 Jun 08
1
predict with model (rms package)
...tor of
knot locations, I get an error message if I try to predict with that
model. This also happens if only one workspace is used, but the vector
of knot locations is removed:
library(rms)
set.seed(1)
x <- rnorm(100)
y <- 1 + x + x^2 + rnorm(100)
x.knots <- quantile(x, c(0.2, 0.5, 0.8))
ols1 <- ols(y ~ rcs(x, x.knots))
predict(ols1, data.frame(x = 0)) # This works
rm(x.knots)
predict(ols1, data.frame(x = 0)) # Gives error
The first predict gives
1
0.8340293
while the second predict gives
Error in rcs(x, x.knots) : object 'x.knots' not found
The same error happe...
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
between 1 and 2.
Thanks!
PM
2011 Nov 11
1
Fwd: Use of R for VECM
...t;-us[,c("Y","C")]
> sjd.vecm1 <- ca.jo(sjd, ecdet='const', type="eigen", K=3, spec="longrun",
+ season=4)
> sjd.vecm2 <- ca.jo(sjd, ecdet='const', type="eigen", K=3, spec="transitory",
+ season=4)
> sjd.vecm.ols1 <- cajools(sjd.vecm1)
> sjd.vecm.ols2 <- cajools(sjd.vecm2)
> summary(sjd.vecm.ols1)
Response Y.d :
Call:
lm(formula = substitute(Y.d), data = data.mat)
Residuals:
Min 1Q Median 3Q Max
-0.0049787 -0.0012948 0.0000703 0.0009653 0.0063192
Coeffici...
2004 Mar 19
2
using "unstack" inside my function: that old scope problem again
...<- as.matrix(resUnstacked)
SIGMA <- (1/nrow(E))*(t(E) %*% E)
OMEGA <- diag(x=1, nrow=nrow(E), ncol=nrow(E)) %x% SIGMA
X <- model.matrix(tmodel)
XPRIMEXINV <- solve(t(X) %*% X)
PCSECOVB <- XPRIMEXINV %*% (t(X) %*% OMEGA %*% X ) %*% XPRIMEXINV
}
The error is:
PCSE(eld.ols1,dat2$STATEID)
Error in eval(expr, envir, enclos) : Object "groupVar" not found
Here's what I don't understand the most.
If I hack this so that the "resUnstacked" is created by a "matrix"
command, then the function works. Why would matrix() work when unstack...
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,
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