# [R] confidence intervals when using polr()

From: Joe P King <jp_at_joepking.com>
Date: Wed, 09 Mar 2011 20:36:36 -0800

Hello, I am running a model with four categories and want predicted probabilities in each category. Now for this example I wont give a counterfactual just the training data is fine but is there anyway to get a confidence interval around the predicted probabilities in each group? I have tried but it gives me probabilities and I have used interval="confidence", level=.095 and then interval = "prediction". Below is a sample of my data and my code I am trying to run (its from an open access public data set; I tried to make the size as small as possible, sorry for its length).

polr.result<-polr(ordered(tvwatch)~ses+testscores,method="probit",Hess = T,data=testdata)

polr.predict<-predict(polr.result,type="probs",interval="confidence",level=. 95)

structure(list(tvwatch = c(2L, 2L, 1L, 4L, 2L, 4L, 3L, 2L, 3L,

2L, 3L, 4L, 4L, 3L, 4L, 3L, 2L, 1L, 3L, 1L, 2L, 3L, 4L, 4L, 1L,

1L, 2L, 2L, 4L, 4L, 2L, 1L, 3L, 3L, 3L, 2L, 4L, 2L, 1L, 1L, 1L,

1L, 2L, 3L, 4L, 4L, 2L, 1L, 2L, 2L), ses = c(-0.529, -0.377,

-0.859, -0.191, -0.319, -0.292, -0.601, -0.07, 0.198, 0.096,

0.136, -0.101, 0.11, -0.182, -0.323, 0.205, 0.21, 0.749, -0.273,

0.66, 0.009, -0.374, -0.094, -0.427, 1.369, -1.306, 0.611, 0.392,

-0.371, 1.059, 1.308, -0.89, -1.741, -0.169, 0.13, -0.698, 0.385,

-0.067, -0.386, 0.813, 0.997, 1.46, 1.196, -0.723, -0.612, 0.119,

1.421, -1.02, -0.807, 1.33), testscores = c(53.38, 57.91, 54.64,

45.67, 58.74, 57.55, 63.78, 59.97, 51.41, 49.54, 65.82, 44.04,

45.8, 56.67, 35.6, 50.41, 45.18, 61.22, 61.24, 66.58, 64.91,

40.79, 41.77, 46.51, 59.83, 49.95, 58.1, 54.53, 58.31, 69.92,

66.4, 50.94, 51.23, 47.45, 37.93, 59.66, 60.59, 55.11, 40.65,

67.89, 52.54, 61.76, 69.71, 44.37, 43.53, 45.89, 75.81, 53.18,

51.85, 58.03)), .Names = c("tvwatch", "ses", "testscores"), row.names = c(1L,

2L, 3L, 4L, 5L, 6L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 18L,

19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 28L, 29L, 30L, 31L, 32L,

34L, 35L, 38L, 39L, 40L, 41L, 42L, 44L, 45L, 46L, 47L, 48L, 49L,

50L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L), class = "data.frame")

Joe King, M.A.

Ph.D. Student

University of Washington - Seattle

206-913-2912

<mailto:jp_at_joepking.com> jp_at_joepking.com

Ad astra per aspera - "Through hardships to the stars"

[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
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. Received on Thu 10 Mar 2011 - 04:42:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 Mar 2011 - 06:20:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.