[R] confint fails in quasibinomial glm: dims do not match
I am unable to calculate confidence intervals for the slope estimate in a quasibinomial glm using confint(). Below is the output and the package info for MASS. Thanks in advance! R 2.9.2 MASS 7.2-48 > confint(glm.palive.0.str) Waiting for profiling to be done... Error: dims [product 37] do not match the length of object [74] > glm.palive.0.str Call: glm(formula = cbind(alive, red) ~ str, family = quasibinomial, data = subset(master.palive, vtime == 0)) Coefficients: (Intercept) strs 1.05 1.01 Degrees of Freedom: 36 Total (i.e. Null); 35 Residual Null Deviance: 20800 Residual Deviance: 16200AIC: NA > packageDescription("MASS") Bundle: VR Contains: MASS class nnet spatial Priority: recommended Version: 7.2-48 Date: 2009-07-29 Depends: R (>= 2.5.0), grDevices, graphics, stats, utils Suggests: lattice, nlme, survival Author: S original by Venables & Ripley. R port by Brian Ripley , following earlier work by Kurt Hornik and Albrecht Gebhardt. Maintainer: Brian Ripley BundleDescription: Functions and datasets to support Venables and Ripley, 'Modern Applied Statistics with S' (4th edition). License: GPL-2 | GPL-3 URL: http://www.stats.ox.ac.uk/pub/MASS4/ Packaged: 2009-07-31 13:56:57 UTC; ripley Repository: CRAN Date/Publication: 2009-08-05 11:20:53 Package: MASS Description: The main library and the datasets Title: Main Package of Venables and Ripley's MASS LazyLoad: yes LazyData: yes Built: R 2.9.2; i686-pc-linux-gnu; 2009-08-25 10:52:10 UTC; unix Cheers, Chad -- View this message in context: http://www.nabble.com/confint-fails-in-quasibinomial-glm%3A-dims-do-not-match-tp25709756p25709756.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Coda not providing summary on mcmc object
The object is a mcmc sample from lmer. I am using R v2.7.1. Please let me know what additional information I can provide, hopefully I am just making a simple mistake. Thanks in advance! > data(ratdrink, package = 'faraway') > rd.er <- lmer(wt ~ weeks*treat + (1 | subject), data = ratdrink) > rd.mc <- mcmcsamp(rd.er, 1) > library(coda) Loading required package: lattice > summary(rd.mc) Length ClassMode 1 merMCMC S4 > HPDinterval(rd.mc) Error in UseMethod("HPDinterval") : no applicable method for "HPDinterval" > str(rd.mc) Formal class 'merMCMC' [package "lme4"] with 9 slots ..@ Gp : int [1:2] 0 27 ..@ ST : num [1, 1:1] 1.179 0.878 0.864 0.760 0.614 ... ..@ call: language lmer(formula = wt ~ weeks * treat + (1 | subject), data = ratdrink) ..@ deviance: num [1:1] 964 964 966 966 969 ... ..@ dims: Named int [1:14] 1 135 6 27 1 1 1 2 5 1 ... .. ..- attr(*, "names")= chr [1:14] "nf" "n" "p" "q" ... ..@ fixef : num [1:6, 1:1] 52.880 26.480 4.780 -0.794 -9.370 ... .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:6] "(Intercept)" "weeks" "treatthiouracil" "treatthyroxine" ... .. .. ..$ : NULL ..@ nc : int 1 ..@ ranef : num[1:27, 0 ] ..@ sigma : num [1, 1:1] 7.16 6.68 6.60 7.14 7.96 ... > search() [1] ".GlobalEnv""package:lme4" "package:Matrix" "package:coda" "package:lattice" "package:datasets" "package:grDevices" [8] "package:graphics" "package:stats" "package:utils" "package:methods" "Autoloads" "package:base" > Cheers, Chad -- View this message in context: http://www.nabble.com/Coda-not-providing-summary-on-mcmc-object-tp18204697p18204697.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Weighted means in aggregate.table
I need to calculate the weighted means by two factors, the subject id and the time of measurement. I was hoping to use aggregate.table, but this function does not allow me to use different weights for each mean that is calculated. id <- c(rep("a",4),rep("b",4)) time <- c(0,0,60,60,0,0,60,60) y <- c(10,20,30,40,10,20,30,40) weight <- c(1,2,3,4,4,3,2,1) aggregate.table(y,id,time,FUN=weighted.mean,w=weight) Error in FUN(X[[1L]], ...) : 'x' and 'w' must have the same length The function works if the data for each time are weighted the same across subjects: aggregate.table(y,id,time,FUN=weighted.mean,w=c(1,2)) 0 60 a 17 37 b 17 37 Can anyone suggest a solution? Thank you in advance! Sincerely, Chad Smith -- View this message in context: http://www.nabble.com/Weighted-means-in-aggregate.table-tp15945216p15945216.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.