Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For <code>lme</code>, my personal version is below; you can download it with other similar addons, e.g. to extract <code>\Sexpr{}</code> string for p-values of lme/lm/glm tables as Dmisc from </p> <p><a href="http://www.menne-biomed.de/download" rel="nofollow">http://www.menne-biomed.de/download</a> </p> <p>This is very personalized, but if I like the rounding to really significant digits a lot. Sorry, package nlme does all I need (and more than lme/gaussian), so there is not lme4 version yet.</p> <pre><code>"latex.summary.lme" &lt;- function(object, title="",parameter=NULL, file="", shadep=0.05,caption=NULL,label=NULL,ctable=FALSE,form=NULL, interceptp = FALSE, moredec=0, where="!htbp", ...) { # This function can be mis-used for gls models when an explicit # form is given options(Hverbose=FALSE) require('Hmisc') require('nlme') dd &lt;- object$dims method &lt;- object$method fixF &lt;- object$call$fixed xtTab &lt;- as.data.frame(object$tTable) sigp &lt;- xtTab[,"p-value"]&lt; shadep # cells that will be shaded if (!interceptp){ sigp[1] &lt;- FALSE # intercept will never be shaded # Replace small significances, discarding p-value for (Intercept) xtTab[1,"p-value"] = 1 # we do not show it anyway, easier formatting } pval &lt;- format(zapsmall(xtTab[, "p-value"],4)) pval[as.double(pval) &lt; 0.0001] &lt;- "$&lt; .0001$" xtTab[, "p-value"] &lt;- pval xtTab[,"t-value"] &lt;- round(xtTab[,"t-value"],1) if (ncol(xtTab) == 5) # not for gls xtTab[,"DF"] &lt;- as.integer(xtTab[,"DF"]) # extract formula if (is.null(form)) { if (!is.null(object$terms)) { form=object$terms } else { form = formula(object) } } if (is.null(parameter)) { parameter=as.character(form[[2]]) } if (any(wchLv &lt;- (as.double(levels(xtTab[, "p-value"])) == 0))) { levels(xtTab[, "p-value"])[wchLv] &lt;- "&lt;.0001" } if (is.null(label)) label &lt;- lmeLabel("contr",form) form &lt;- deparse(removeFormFunc(as.formula(form)),width.cutoff=500) form &lt;- paste(sub('~','$\\\\sim$ ',form),sep="") # All I( in factors are replaced with (This could be improved) row.names(xtTab) &lt;- gsub("I\\(","(",dimnames(object$tTable)[[1]]) row.names(xtTab) &lt;- gsub("\\^2","\\texttwosuperior",row.names(xtTab)) # Determine base level levs &lt;- lapply(object$contrasts,function(object) {dimnames(object)[[1]][1]}) levnames &lt;- paste(names(levs),levs,sep=" = ",collapse=", ") # Try to locate numeric covariables # v1 &lt;- all.vars(formula(object))[-1] ## Changed 8.10.2008, not regression-tested v1 &lt;- all.vars(form)[-1] numnames &lt;- v1[is.na(match(v1,names(levs)))] if (length(numnames &gt; 0)) { numnames &lt;- paste(numnames," = 0",collapse=", ") levnames &lt;- paste(levnames,numnames,sep=", ") } if (is.null(caption)){ # TODO: Allow %s substitution if (inherits(object,"lme")) md = "Mixed model (lme)" else if (inherits(object,"gls")) md = "Extended linear model (gls)" else md = "Linear model" caption &lt;- paste(md," contrast table for \\emph{", parameter, "} (model ",form, "). The value in row (Intercept) gives the reference value for ", levnames,".",sep='') } caption.lot &lt;- paste("Contrast table for ",parameter, " by ", levnames) ndec &lt;- pmax(round(1-log10(xtTab[,2]+0.000001)+moredec),0) xtTab[,1] &lt;- formatC(round(xtTab[,1],ndec)) xtTab[,2] &lt;- formatC(round(xtTab[,2],ndec)) if (ncol(xtTab) == 5) { names(xtTab) &lt;- c("Value","StdErr","DF","t","p") pcol = 5 } else {# gls misuse names(xtTab) &lt;- c("Value","StdErr","t","p") pcol = 4 } # Only show intercept p/t when explicitely required if (!interceptp){ xtTab[1,pcol-1] &lt;- NA xtTab[1,pcol] &lt;- '' } cellTex &lt;- matrix(rep("", NROW(xtTab) * NCOL(xtTab)), nrow=NROW(xtTab)) cellTex[sigp,pcol] &lt;- "cellcolor[gray]{0.9}" rowlabel &lt;- ifelse(nchar(parameter) &gt;9,"",parameter) latex(xtTab, title=title, file=file, caption=caption,caption.lot=caption.lot, caption.loc="bottom", label=label, cellTexCmds = cellTex, rowlabel=rowlabel, ctable=ctable, where=where, booktabs = !ctable, numeric.dollar=FALSE,col.just=rep("r",5),...) } "latex.lme" &lt;- function(object, title="",parameter=NULL,file="",shadep=0.05, caption=NULL,label=NULL,ctable=FALSE,form=NULL, interceptp=FALSE, moredec= 0, where="!htbp",...) { options(Hverbose=FALSE) require('Hmisc') require('nlme') latex.summary.lme(summary(object),title=title,parameter=parameter, file=file, shadep=shadep, caption=caption, label=label, ctable=ctable, form=form, moredec=moredec, where=where,...) } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload