Displaying 13 results from an estimated 13 matches for "resvar".
Did you mean:
resval
2015 Jan 14
2
R CMD check: "..." used in a situation where it does not exist
...(unstable)
(2015-01-13 r67453) gives me the following NOTE:
cbind.fsets: possible error in list(...): ... used in a situation
where it does not exist
The file that causes this note contains:
cbind.fsets <- function(..., deparse.level = 1) {
dots <- list(...)
res <- NULL
resVars <- NULL
resSpecs <- NULL
for (i in seq_along(dots)) {
arg <- dots[[i]]
argName <- names(dots)[i]
if (!is.null(arg)) {
if (!is.fsets(arg)) {
stop("Function 'cbind.fsets' cannot bind arguments
that are not valid &...
2015 Jan 14
0
R CMD check: "..." used in a situation where it does not exist
...t;
>
> cbind.fsets: possible error in list(...): ... used in a situation
> where it does not exist
>
>
> The file that causes this note contains:
>
>
> cbind.fsets <- function(..., deparse.level = 1) {
> dots <- list(...)
>
> res <- NULL
> resVars <- NULL
> resSpecs <- NULL
>
> for (i in seq_along(dots)) {
> arg <- dots[[i]]
> argName <- names(dots)[i]
>
> if (!is.null(arg)) {
> if (!is.fsets(arg)) {
> stop("Function 'cbind.fsets'...
2004 Jan 12
1
question about how summary.lm works
Hi,
While exploring how summary.lm generated its output I came across a section
that left me puzzled.
at around line 57
R <- chol2inv(Qr$qr[p1, p1, drop = FALSE])
se <- sqrt(diag(R) * resvar)
I'm hoping somebody could explain the logic of these to steps or
alternatively point me in the direction of a text that will explain these
steps.
In particular I'm puzzled what is the relationship between QR factorization
and the cholesky factorization such that one can give a (sort...
2005 Mar 03
2
regression on a matrix
...vector). I am wondering if
anyone has any idea of how to speed up the computations in R. The code
follows:
#regression function
#Linear regression code
qreg <- function(y,x) {
X=cbind(1,x)
m<-lm.fit(y=y,x=X)
p<-m$rank
r <- m$residuals
n <- length(r)
rss <- sum(r^2)
resvar <- rss/(n - p)
Qr <- m$qr
p1 <- 1:p
R <- chol2inv(Qr$qr[p1, p1, drop = FALSE])
se <- sqrt(diag(R) * resvar)
b <- m$coefficients
return(c(b[2],se[2]))
}
#simulate
a <- c(1,.63,.63,1)
a <- matrix(a,2,2)
c <- chol(a)
C <- 0.7
theta <- 0.8
sims <-...
2006 Nov 24
2
low-variance warning in lmer
...or" && length(grep("effectively zero",f1))>0)
options(ow)
f2 <- lmer(y~treat+(1|reef),data=x)
c(getranvar(f2),as.numeric(w))
}
rvec <- rep(c(0.01,0.05,0.1,0.15,0.2,0.3,0.5),each=100)
X <- t(sapply(rvec,estfun))
colnames(X) <- c("reefvar","resvar","warn")
rfrac <- X[,"reefvar"]/(X[,"reefvar"]+X[,"resvar"])
fracwarn <- tapply(X[,"warn"],rvec,mean)
est.mean <- tapply(rfrac,rvec,mean)
op <- par(mfrow=c(1,2))
plot(rvec,rfrac,type="n",xlim=c(-0.02,0.55),axes=FALSE)
ax...
2009 Jul 08
1
functions to calculate t-stats, etc. for lm.fit objects?
I'm running a huge number of regressions in a loop, so I tried lm.fit
for a speedup. However, I would like to be able to calculate the
t-stats for the coefficients.
Does anyone have some functions for calculating the regression summary
stats of an lm.fit object?
Thanks,
Whit
2011 Aug 01
3
formula used by R to compute the t-values in a linear regression
Hello,
I was wondering if someone knows the formula used by the function lm to compute the t-values.
I am trying to implement a linear regression myself. Assuming that I have K variables, and N observations, the formula I am using is:
For the k-th variable, t-value= b_k/sigma_k
With b_k is the coefficient for the k-th variable, and sigma_k =(t(x) x )^(-1) _kk is its standard deviation.
1998 May 29
0
aov design questions
...}
else {
if (is.null(w)) {
mss <- if (attr(z$terms, "intercept"))
sum((f - mean(f))^2)
else sum(f^2)
rss <- sum(r^2)
}
}
resvar <- rss/(n - p)
se <- sqrt(resvar * diag(z$cov.unscaled))
est <- z$coefficients
tval <- est/se
ans <- z[c("call", "terms")]
ans$residuals <- as.numeric(r)
ans$coefficients <- cbind(est, se, tval, 2 * (1 - pt(abs...
2009 Jul 26
0
Version 0.7 of package tsDyn, nonlinear time series
...CM.SeoTest() and
HanSeo_TVECM()
-new function to simulate/bootstrap a TVAR: function TVAR.sim()
-new function to simulate/bootstrap a TVECM: function TVECM.sim()
-new function to simulate/bootstrap a setar: function setar.sim()
-new function to estimate regime-specific variance in setar: function
resVar()
-new function to extend a bootstrap replication in setarTest: function
extendBoot()
-added in selectSETAR() and setar() following args: include, common,
model, trim, MM, ML, MH, model, restriction
-added in selectSETAR(): criterion "SSR" (sum of squares residual) and
argument max.ite...
2009 Jul 26
0
Version 0.7 of package tsDyn, nonlinear time series
...CM.SeoTest() and
HanSeo_TVECM()
-new function to simulate/bootstrap a TVAR: function TVAR.sim()
-new function to simulate/bootstrap a TVECM: function TVECM.sim()
-new function to simulate/bootstrap a setar: function setar.sim()
-new function to estimate regime-specific variance in setar: function
resVar()
-new function to extend a bootstrap replication in setarTest: function
extendBoot()
-added in selectSETAR() and setar() following args: include, common,
model, trim, MM, ML, MH, model, restriction
-added in selectSETAR(): criterion "SSR" (sum of squares residual) and
argument max.ite...
2008 Feb 26
3
OLS standard errors
Hi,
the standard errors of the coefficients in two regressions that I computed
by hand and using lm() differ by about 1%. Can somebody help me to identify
the source of this difference? The coefficient estimates are the same, but
the standard errors differ.
####Simulate data
happiness=0
income=0
gender=(rep(c(0,1,1,0),25))
for(i in 1:100){
happiness[i]=1000+i+rnorm(1,0,40)
2012 Mar 25
2
avoiding for loops
I have data that looks like this:
> df1
group id
1 red A
2 red B
3 red C
4 blue D
5 blue E
6 blue F
I want a list of the groups containing vectors with the ids. I am
avoiding subset(), as it is
only recommended for interactive use. Here's what I have so far:
df1 <- data.frame(group=c("red", "red", "red", "blue",
2009 Jul 09
2
How to Populate List
...ng lm() and summary.lm().
# Use at your own risk...untested on more complex models :-)
# 'x' is an lm.fit object
calc.lm.t <- function(x)
{
Qr <- x$qr
r <- x$residuals
p <- x$rank
p1 <- 1L:p
rss <- sum(r^2)
n <- NROW(Qr$qr)
rdf <- n - p
resvar <- rss/rdf
R <- chol2inv(Qr$qr[p1, p1, drop = FALSE])
se <- sqrt(diag(R) * resvar)
est <- x$coefficients[Qr$pivot[p1]]
tval <- est/se
res <- cbind(est = est, se = se, tval = tval)
res
}
Here is some simple example data:
set.seed(1)
y <- rnorm(100)
x <...