search for: hasintercept

Displaying 4 results from an estimated 4 matches for "hasintercept".

2000 Apr 26
0
Wrong SEs in predict.lm(..., type="terms") (PR#528)
...bs((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(rownames(X),names(asgn)) if (se.fit){ ip<-matrix(ncol...
2000 Apr 25
0
Wrong SEs in predict.lm(..., type="terms")
...e 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(rownames(X),names(asgn)) if (se.fit){ ip<-matrix(ncol...
2011 Dec 19
1
pls help to print out first row of terms(model) output in example program
...re I have "##fix me fix me## ##Paul Johnson ## 2011-12-19 ## mcDiagnose.R lmAuxiliary <- function(model){ dat <- as.data.frame(model.matrix(model)) ## ivnames <- attr(delete.response(terms(model)), "term.labels") ## previous does not work with transforms like poly hasIntercept <- attr(terms(model), "intercept") if (hasIntercept) dat <- dat[ , -1] # removes intercept. assumes intercept in column 1 ivnames <- colnames(dat) print("The following auxiliary models are being estimated and returned in a list:") results <- list() for (...
2012 Jan 03
1
returning information from functions via attributes rather than return list
...del$contrasts, xlev = model$xlevels) ##contrastIdx: indexes of contrast variables in dm contrastIdx <- which(attr(dm, "assign")== match(isFac, tl)) contrastVars <- colnames(dm)[contrastIdx] nc <- c(nc, contrastVars) dm <- as.data.frame(dm) hasIntercept <- attr(t, "intercept") if (hasIntercept) dm <- dm[ , -1] # removes intercept, column 1 dv <- rdf[ ,names(tmdc)[1]] #tmdc[1] is response variable name dm <- cbind(dv, dm) colnames(dm)[1] <- names(tmdc)[1] #put colname for dv dmnames <- col...