> On Oct 22, 2017, at 6:04 AM, Sorkin, John <jsor...@som.umaryland.edu> wrote: > > I have a model (run with glm) that has a factor, type. Type has two levels, > "general" and "regional". I am trying to get estimates (and SEs) for the > model with type="general" and type ="regional" using fit.contrast
?fit.contrast No documentation for ‘fit.contrast’ in specified packages and libraries: you could try ‘??fit.contrast’ Perhaps the gmodels function of that name? > but I can't get the syntax of the coefficients to use in fit.contrast > correct. I hope someone can show me how to use fit.contrast, or some other > method to get estimate with SEs. (I know I can use the variance co-variance > matrix, but I would rather not have to code the linear contrast my self from > the coefficients of the matrix) > I'm having trouble understanding what you are trying to extract. There are only 2 levels so there is really only one interesting contrast ("general" vs "regional") , and it's magnitude would be reported by just typing `model`, and it's SE would show up in output of `summary(model)`. I'm thinking you should pick one of the examples in gmodels::fit.contrast that most resembles your real problem, post it, and and then explain what difficulties you are having with interpretation. -- David. > Thank you, > > John > > > My model: > > model=glm(events~type,family=poisson(link=log),offset=log(SS),data=data) > > > Model details: > >> summary(data$type) > > general regional > 16 16 > >> levels(data$type) > [1] "general" "regional" > >> contrasts(data$type) > regional > general 0 > regional 1 > > > I have tried the following syntax for fit.contrast > > fit.contrast(model,type,c(1,0)) > and get an error: > Error in `[[<-`(`*tmp*`, varname, value = cmat) : > no such index at level 1 > > >> fit.contrast(model,type,c(0,1),showall=TRUE) > and get an error: > Error in `[[<-`(`*tmp*`, varname, value = cmat) : > no such index at level 1 > > > >> fit.contrast(model,type,c(1,-1),showall=TRUE) > and get an error: > Error in `[[<-`(`*tmp*`, varname, value = cmat) : > no such index at level 1 > > >> fit.contrast(model,type,c(0)) > and get an error: > Error in make.contrasts(coeff, ncol(coeff)) : > Too many contrasts specified. Must be less than the number of factor levels > (columns). > >> fit.contrast(model,type,c(1)) > Error in make.contrasts(coeff, ncol(coeff)) : > and get an error > Too many contrasts specified. Must be less than the number of factor levels > (columns). > > > > > > > > > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine > Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. David Winsemius Alameda, CA, USA 'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.