search for: asgn

Displaying 10 results from an estimated 10 matches for "asgn".

Did you mean: asan
2010 Feb 27
1
Newbie help with ANOVA and lm.
...he ANOVA code (anova.lm) is doing? I am having a hard time reconciling what the text books have as a brute force regression and the formula algorithm in 'R'. Specifically I see: p <- object$rank if (p > 0L) { p1 <- 1L:p comp <- object$effects[p1] asgn <- object$assign[object$qr$pivot][p1] nmeffects <- c("(Intercept)", attr(object$terms, "term.labels")) tlabels <- nmeffects[1 + unique(asgn)] ss <- c(unlist(lapply(split(comp^2, asgn), sum)), ssr) df <- c(unlist(lapply(split(asgn, a...
2000 Apr 25
0
Wrong SEs in predict.lm(..., type="terms")
...000 0.2476221 0.4952442 [8] 0.7428664 0.9904885 Here is what one should get: > abs((df$x-mean(df$x)))*summary(df.lm)$coef[2,2] [1] 0.5769836 0.4327377 0.2884918 0.1442459 0.0000000 0.1442459 0.2884918 [8] 0.4327377 0.5769836 Here is the corrected code: if (type=="terms"){ asgn <- attrassign(object) beta<-coef(object) hasintercept<-attr(tt,"intercept")>0 if (hasintercept) asgn$"(Intercept)"<-NULL nterms<-length(asgn) predictor<-matrix(ncol=nterms,nrow=NROW(X)) dimnames(predictor)<-list...
2000 Apr 26
0
Wrong SEs in predict.lm(..., type="terms") (PR#528)
...442 [8] 0.7428664 0.9904885 Here is what one should get: > abs((df$x-mean(df$x)))*summary(df.lm)$coef[2,2] [1] 0.5769836 0.4327377 0.2884918 0.1442459 0.0000000 0.1442459 0.2884918 [8] 0.4327377 0.5769836 Here is the relevant section of corrected code: if (type=="terms"){ asgn <- attrassign(object) beta<-coef(object) hasintercept<-attr(tt,"intercept")>0 if (hasintercept) asgn$"(Intercept)"<-NULL nterms<-length(asgn) predictor<-matrix(ncol=nterms,nrow=NROW(X)) dimnames(predictor)<-list...
2004 Jan 30
0
Two apparent bugs in aov(y~ *** -1 + Error(***)), with suggested (PR#6510)
...strata (only) nmstrata <- sub("^`(.*)`$", "\\1", nmstrata) if(intercept) nmstrata <- c("(Intercept)", nmstrata) qr.e <- er.fit$qr rank.e <- er.fit$rank qty <- er.fit$resid maov <- is.matrix(qty) asgn.e <- er.fit$assign[qr.e$piv[1:rank.e]] ## we want this to label the rows of qtx, not cols of x. nobs <- NROW(qty) if(nobs > rank.e) { ## APPARENT BUG 1: # result <- vector("list", max(asgn.e) + 2) # asgn.e[(rank.e+1):nobs] <- max(...
2004 Feb 02
0
Two apparent bugs in aov(y~ *** -1 + Error(***)), with (PR#6520)
...a <- sub("^`(.*)`$", "\\1", nmstrata) > if(intercept) nmstrata <- c("(Intercept)", nmstrata) > qr.e <- er.fit$qr > rank.e <- er.fit$rank > qty <- er.fit$resid > maov <- is.matrix(qty) > asgn.e <- er.fit$assign[qr.e$piv[1:rank.e]] > ## we want this to label the rows of qtx, not cols of x. > nobs <- NROW(qty) > if(nobs > rank.e) { > ## APPARENT BUG 1: > # result <- vector("list", max(asgn.e) + 2) > # asgn...
2006 Mar 13
1
anova.mlm (single-model case) does not handle factors? (PR#8679)
...arguments I think the problem lies in the computation of the 'ss' terms (line 237 in the file mlm.R in the source code). Changing this (and the following line) by something similar to what is done in summary.manova seems to resolve the problem: comp <- as.matrix(fit$effects)[seq(along=asgn), ,drop=FALSE] uasgn <- unique(asgn) nterms <- length(uasgn) ss <- list(nterms) df <- numeric(nterms) for(i in seq(nterms)) { ai <- (asgn == uasgn[i]) ss[[i]] <- crossprod(comp[ai, ,drop=FALSE]) df[i] <- sum(ai) }
2006 Aug 12
0
anova.mlm for single model (one-way repeated measured anova)
...lmfit<-lm(dat~1) > anova(mlmfit, X=~1) > Error: ceiling(length.out) : Non-numeric argument to mathematical function > > this error occurs in anova.mlm > > if (rk > 0) { > p1 <- 1:rk > comp <- object$effects[p1, ] > asgn <- object$assign[object$qr$pivot][p1] > nmeffects <- c("(Intercept)", attr(object$terms, > "term.labels")) > tlabels <- nmeffects[1 + unique(asgn)] > ix <- split(seq(length = nrow(comp)), asgn) #HERE &...
1999 Aug 30
3
model.matrix()
Hi, In R I get the following: > x <- 1:9 > f <- as.factor(1:9) > i <- model.matrix(~x+f) > > attr(i, "assign") [1] 0 1 2 2 2 2 2 2 2 2 whereas in S I get the following: > attr(i, "assign") $"(Intercept)": [1] 1 $x: [1] 2 $f: [1] 3 4 5 6 7 8 9 10 Has anybody written a model.matrix function to get the same result as S?
2005 Feb 16
2
problem with se.contrast()
...rs for certain contrasts and following the help page for se.contrast() I tried the following but I get an error: >se.contrast(test.aov,list(Material=="A",Material=="B",Material=="C",Material=="D"),coef=c(1,1,-1,-1),data=testdata) Error in matrix(0, length(asgn), ncol(effects), dimnames = list(nm[1 + : length of dimnames [1] not equal to array extent I have tested this on R 2.0.1 on Windows XP and Solaris and get the same error on both systems. I am unsure as to what I am doing wrong here. Thanks for any help. Jamie Jarabek
2000 Jun 02
3
graphical parameters in plot
I'm using plot to make a simple plot but I want to control where the tick marks go on bot axes. The graphical parameters xaxp and yaxp seem to be ignored by the plot function so I tried setting them using op <- par(no.readonly=T) par(xaxp=c(-2.4,-2.2,5), yaxp=c(-2500,10000,6)) plot(...) par(op) but they are still ignored. Next I tried to use the axis function as follows op <-