[R] Further Subsetting of Data for Log. Reg. Results in qr.default Error

Courtney Benjamin cbenjami at BTBOCES.ORG
Wed Nov 23 12:54:02 CET 2016

Hello R Experts,

In further subsetting data within a logistic regression in the survey package, I am getting a qr.default error.

Below is an example of the original model that runs correctly, but when I subset the data further to look at students of a particular curriculum concentration, the qr.default error occurs.  I thought it may have been related to converting the F1RTRCC variable into a factor for use in the original model; I went back and restored that variable to its original form and it didn't help.

Any guidance is greatly appreciated.


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")

##Resetting baseline levels for predictors
elsq1ch_brr <- update( elsq1ch_brr , F1HIMATH = relevel(F1HIMATH,"PreAlg or Less") )
elsq1ch_brr <- update( elsq1ch_brr , BYINCOME = relevel(BYINCOME,"0-25K") )
elsq1ch_brr <- update( elsq1ch_brr , F1RACE = relevel(F1RACE,"White") )
elsq1ch_brr <- update( elsq1ch_brr , F1SEX = relevel(F1SEX,"Male") )
elsq1ch_brr <- update( elsq1ch_brr , F1RTRCC = relevel(F1RTRCC,"Academic") )

#Log. Reg. model-all curric. concentrations including F1RTRCC as a predictor
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)

##CTE Log. Reg. model that is resulting in the qr.default error
CTE <- svyglm(formula=F3ATTAINB~F1PARED+BYINCOME+F1RACE+F1SEX+F1RGPP2+F1HIMATH,family="binomial",design=elsq1ch_brr,subset=BYSCTRL==1&G10COHRT==1&F1RTRCC=="Academic",na.action=na.omit)

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>


	[[alternative HTML version deleted]]

More information about the R-help mailing list