[R] using subset command in glm and glm coefficients output
Courtney Coon
ccoon at mail.usf.edu
Tue Jul 26 19:46:59 CEST 2011
I am a graduate student who's just starting to use more advanced
statistics and is completely new to R. I'm looking for whether
parasite prevalence varies with region. I'd like to try using just a
subset of the data defined by one these covariates, sex, looking at
data only from adults, without using it as a covariate in the
analyses. I tried using subset=sex=='A' in the following context:
malaria1<-glm(Malaria ~ X2sppclass+place+place*X2sppclass,
subset=sex=='A', na.action=na.omit, family=binomial(link="logit""))
with sex being the column name and 'A' standing for adult but R
doesn't seem to like that. It says there is an unexpected '=' but
that's how I found it coded in other R forums.
Because I couldn't get the above code to work, I ended up running the
following model:
malaria2<-glm(Malaria ~ X2sppclass+place+place*X2sppclass,
na.action=na.omit, family=binomial(link='logit'))
but I don't understand the summary output for the coefficients:
Coefficients: (2 not defined because of singularities)
Estimate Std. Error z value Pr(>|z|)
(Intercept) 12.9786 624.1941 0.021 0.9834
X2sppclassH -12.4375 624.1941 -0.020 0.9841
X2sppclassN -12.5512 624.1940 -0.020 0.9840
placeEast 1.3304 0.5870 2.266 0.0234 *
placeWest 1.5875 0.5468 2.903 0.0037 **
X2sppclassH:placeEast 0.9532 0.7325 1.301 0.1931
X2sppclassN:placeEast NA NA NA NA
X2sppclassH:placeWest 0.2992 0.7218 0.414 0.6785
X2sppclassN:placeWest NA NA NA NA
issue 1: the error "2 not defined because of singularities" even
though I know there are multiple individuals that are 'N' and from the
East or West.
issue 2: It never gives any output for placeCentral. Is this because
I'm using a binomial function and one of my predictors (place) is not
binomial?
Thanks for any help.
--
Courtney Coon
PhD candidate
Department of Integrative Biology
University of South Florida
4202 E. Fowler Ave., SCA 110
Tampa, FL 33620-5200
813-974-0157
More information about the R-help
mailing list