[R] Resetting Baseline Level of Predictor in svyglm Function

Courtney Benjamin cbenjami at BTBOCES.ORG
Fri Nov 4 01:57:06 CET 2016


Thank you, Anthony; it worked flawlessly.?


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

cbenjami at btboces.org<mailto:cbenjami at btboces.org>

607-763-8633

________________________________
From: Anthony Damico <ajdamico at gmail.com>
Sent: Tuesday, November 1, 2016 3:20 AM
To: Courtney Benjamin
Cc: r-help at r-project.org
Subject: Re: [R] Resetting Baseline Level of Predictor in svyglm Function

hi, i think you want

elsq1ch_brr <- update( elsq1ch_brr , F1HIMATH = relevel(F1HIMATH,"PreAlg or Less") )





On Mon, Oct 31, 2016 at 9:05 PM, Courtney Benjamin <cbenjami at btboces.org<mailto:cbenjami at btboces.org>> wrote:
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

cbenjami at btboces.org<mailto:cbenjami at btboces.org><mailto:cbenjami at btboces.org<mailto:cbenjami at btboces.org>>

607-763-8633<tel:607-763-8633>

        [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org<mailto:R-help at 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.


	[[alternative HTML version deleted]]



More information about the R-help mailing list