ocProb | R Documentation |
This function computes the probability values for a continuous variable, based on an ordered choice model. Either an ordered probit or logit model can be used.
ocProb(w, nam.c, n = 100, digits = 3)
w |
a object of class of "polr" estimated from |
n |
number of points for calculating probability; the large the number, the smoother the curve. |
nam.c |
a name of a continuous indepedent variable; this must be given for the function to work. |
digits |
number of digitis for output formatting. |
This function computes the probability values associated with a continous variable in an ordered probit or logit model. The standard errors of each probability value by factor level is computed using delta method. The software of LIMDEP is used to compare and benchmark the results.
Return a list object of class "ocProb" with the following components:
w, nam.c, method=w$method, mean.x=colMeans(x), out, lev)
w |
an object of class "polr" |
nam.c |
the name of a continous variable |
method |
type of the ordered choice model of |
mean.x |
mean values of the independent variables used in |
out |
This is a list object with the estimated probability values, standard errors, t values, and p values for each of the factor level in |
lev |
a character string representing the factor level used in |
Two methods are defined as follows:
print
:print the probability output.
plot
:Plot the probability values for a continuous variable.
Changyou Sun (edwinsun258@gmail.com)
Greene, W.H. 2003. Econometric Analysis (5th ed.). Prentice Hall, New York. 1026 P.
ocME
# Loading data from the MASS library
library(MASS)
data(housing)
str(housing); head(housing)
# Fit an ordered choice model with polr from the MASS library
# Note this is a fake specification
# The variable of "Freq" is included to have a
# continuous variable for demonstration.
fm2 <- Sat ~ Infl + Type + Cont + Freq
rc <- polr(fm2, data = housing, Hess = TRUE, method = "probit")
rd <- polr(fm2, data = housing, Hess = TRUE, method = "logistic")
summary(rc); summary(rd)
# Compute predicated probabilities with one continous variable
(fa <- ocProb(w = rc, nam.c = 'Freq', n = 300))
(fb <- ocProb(w = rd, nam.c = 'Freq', n = 300))
plot(fa)
plot(fb)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.