Hello R Users:
I am using the survey package in R for modeling with complex survey data. I am
trying to reset the baseline level of certain predictor variables being used in
a logistic regression without success. The following is a reproducible example:
library(RCurl)
library(survey)
data <-
getURL("https://raw.githubusercontent.com/cbenjamin1821/careertech-ed/master/elsq1adj.csv")
elsq1ch <- read.csv(text = data)
#Specifying the svyrepdesign object which applies the BRR weights
elsq1ch_brr<-svrepdesign(variables = elsq1ch[,1:16], repweights =
elsq1ch[,18:217], weights = elsq1ch[,17], combined.weights = TRUE, type = "BRR")
elsq1ch_brr
#Log. Reg. model
allCC <-
svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1&G10COHRT==1,na.action=na.omit)
summary(allCC)
##Attempting to reset baseline level for predictor variable
#Both attempts did not work
elsq1ch$F1HIMATH <- C(elsq1ch$F1HIMATH,contr.treatment, base=1)
elsq1ch$F1HIMATH <- relevel(elsq1ch$F1HIMATH,"PreAlg or Less")
#Log. Reg. model with no changes in baseline levels for the predictors
allCC <-
svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH+F1RTRCC,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1&G10COHRT==1,na.action=na.omit)
summary(allCC)
Any guidance is greatly appreciated.?
Sincerely,
Courtney?
Courtney Benjamin
Broome-Tioga BOCES
Automotive Technology II Teacher
Located at Gault Toyota
Doctoral Candidate-Educational Theory & Practice
State University of New York at Binghamton
[email protected]<mailto:[email protected]>
607-763-8633
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.