Description Usage Arguments Details Value Examples
View source: R/blcest_function.R
This function computes the maximum likelihood estimate (MLE) for bivariate normal and t data with left censoring.
1 2 | blcest(cenData, df = Inf, thetaG = defaultGuess(cenData), alpha = 0.05,
control = list(fnscale = -1, maxit = 1000))
|
cenData |
n x 4 matrix of data, in which first two columns hold data values for x and y variables and the second two columns hold flags for censoring such that 1 implies censored and 0 implies not censored. |
df |
Integer greater than 3, representing degrees of freedom with df=Inf implying normal. |
thetaG |
Vector of length 5, a guess of approximate values for (xmu,ymu,xsd,ysd,r), which by default uses the means, standard deviations and correlations not adjusting for censoring. |
alpha |
Number bewteen 0 and 1, such that confidence levels will be 1-alpha level. |
control |
List of parameters to pass to control in optim. See details and optim documentation for more information. |
The maximum likelihood method is done with the optim function. Thus thetaG is the initial values for the parameters to be optimized over, and the control parameter allow the user to change certian parameters in optim. The most helpful item in the list is likely maxit. Increaing maxit may slightly increase run time, but will decrease the change of no convergence from convergence error code 1. For more information on convergence error codes see optim documentation.
Important note: Please do not change fnscale from equaling -1. This is neccessay for MLE method.
Returns a list containing two elements, coefficients and varCovMatrix. The object coefficients is a 5x5 data frame with rows for each parameter (xMu, yMu, xSd, ySd, and R), and with columns for parameters estimates, standard errors, t-Value, upper confidence interval, and lower confidence interval. The varCovMatrix object is a 5x5 matrix which is the variance - covariance matrix.
1 2 3 4 5 6 7 8 9 10 | xmu = 0
ymu = 0
xsd = 1
ysd = 1
r = 0
df = Inf #normal
scaleMat <- buildScaleMat(xsd, ysd, r, df)
myData <- genData(10, c(xmu, ymu), scaleMat, Inf)
cenData <- censorData(uncenData = myData, cenLevelVec =c(.2,.2))
blcest(cenData)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.