Proportional odds and related models
svyolr.RdFits cumulative link models: proportional odds, probit, complementary log-log, and cauchit.
Usage
svyolr(formula, design, ...)
# S3 method for class 'survey.design2'
svyolr(formula, design, start, subset=NULL,...,
na.action = na.omit,method = c("logistic", "probit", "cloglog", "cauchit"))
# S3 method for class 'svyrep.design'
svyolr(formula,design,subset=NULL,...,return.replicates=FALSE,
multicore=getOption("survey.multicore"))
# S3 method for class 'svyolr'
predict(object, newdata, type = c("class", "probs"), ...)Arguments
- formula
Formula: the response must be a factor with at least three levels
- design
survey design object
- subset
subset of the design to use;
NULLfor all of it- ...
dots
- start
Optional starting values for optimization
- na.action
handling of missing values
- multicore
Use
multicorepackage to distribute computation of replicates across multiple processors?- method
Link function
- return.replicates
return the individual replicate-weight estimates
- object
object of class
svyolr- newdata
new data for predictions
- type
return vector of most likely class or matrix of probabilities
Examples
data(api)
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
dclus1<-update(dclus1, mealcat=cut(meals,c(0,25,50,75,100)))
m<-svyolr(mealcat~avg.ed+mobility+stype, design=dclus1)
m
#> Call:
#> svyolr(mealcat ~ avg.ed + mobility + stype, design = dclus1)
#>
#> Coefficients:
#> avg.ed mobility stypeH stypeM
#> -2.6999217 0.0325042 -1.7574715 -0.6191463
#>
#> Intercepts:
#> (0,25]|(25,50] (25,50]|(50,75] (50,75]|(75,100]
#> -8.857919 -6.586464 -4.924938
## Use regTermTest for testing multiple parameters
regTermTest(m, ~avg.ed+stype, method="LRT")
#> Working (Rao-Scott+F) LRT for avg.ed stype
#> in svyolr(formula = mealcat ~ avg.ed + mobility + stype, design = dclus1)
#> Working 2logLR = 0.6580304 p= 0.73257
#> (scale factors: 2.7 0.22 0.11 ); denominator df= 10
## predictions
summary(predict(m, newdata=apiclus2))
#> (0,25] (25,50] (50,75] (75,100]
#> 51 46 16 13
summary(predict(m, newdata=apiclus2, type="probs"))
#> (0,25] (25,50] (50,75] (75,100]
#> Min. :0.004597 Min. :0.004944 Min. :0.0004632 Min. :0.0001086
#> 1st Qu.:0.096088 1st Qu.:0.153546 1st Qu.:0.0353593 1st Qu.:0.0086690
#> Median :0.334762 Median :0.330429 Median :0.1326655 Median :0.0374619
#> Mean :0.400508 Mean :0.307402 Mean :0.1658904 Mean :0.1262000
#> 3rd Qu.:0.691552 3rd Qu.:0.465418 3rd Qu.:0.2877986 3rd Qu.:0.1555944
#> Max. :0.994485 Max. :0.513732 Max. :0.3927701 Max. :0.8091764