Description Usage Arguments Value Author(s) See Also Examples
Function to find QME estimates of the regression coefficients for regression models with truncated response variables. Uses optim
. Intended to be called through qme
, not on its own, since qme
also transforms data into the correct form etc.
1 |
formula |
a symbolic description of the model to be estimated |
mf |
the |
point |
point of truncation |
direction |
direction of truncation |
bet |
starting values to be used by |
cv |
threshold value to be used, number or numeric vector of length 1. (See |
... |
additional arguments to be passed to |
a list with components:
startcoef |
the starting values of the regression coefficients used by |
coefficients |
the named vector of coefficients |
counts |
number of iterations used by |
convergence |
from |
message |
from |
residuals |
the residuals of the model |
df.residual |
the residual degrees of freedom |
fitted.values |
the fitted values |
Anita Lindmark and Maria Karlsson
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | require(utils)
##Model frame
n <- 10000
x <- rnorm(n,0,2)
y <- 2+x+4*rnorm(n)
d <- data.frame(y=y, x=x)
dl0 <- subset(d, y>0)
mf <- model.frame(y~x, data=dl0)
##Starting values and threshold value
lmmod <- lm(data=mf)
bet <- lmmod$coef
bet <- matrix(bet)
cv <- sqrt(deviance(lmmod)/df.residual(lmmod))
str(qme. <- qme.fit(y~x,mf,point=0,direction="left",bet,cv))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.