Title: | Rank-Based Estimation and Prediction in Random Effects Nested Models |
---|---|
Description: | Estimates robust rank-based fixed effects and predicts robust random effects in two- and three- level random effects nested models. The methodology is described in Bilgic & Susmann (2013) <https://journal.r-project.org/archive/2013/RJ-2013-027/>. |
Authors: | Yusuf Bilgic, Herb Susmann and Joseph McKean |
Maintainer: | Yusuf Bilgic <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.5 |
Built: | 2024-11-03 07:18:44 UTC |
Source: | CRAN |
An R package for rank-based robust estimation and prediction in random effects nested models
Package: | rlme |
Type: | Package |
Version: | 0.2 |
Date: | 2013-07-07 |
License: | GPL (>= 2) |
Yusuf Bilgic [email protected], Herb Susmann [email protected] and Joseph McKean [email protected]
Maintainer: Yusuf Bilgic [email protected] or [email protected]
library(rlme) data(schools) formula = y ~ 1 + sex + age + (1 | region) + (1 | region:school) rlme.fit = rlme(formula, schools) summary(rlme.fit)
library(rlme) data(schools) formula = y ~ 1 + sex + age + (1 | region) + (1 | region:school) rlme.fit = rlme(formula, schools) summary(rlme.fit)
Fixed effect variance estimation for Joint Rank Method (JR). It assumes Compound Symmetric (CS) structure of error terms. For k-level design, there are k-1 intra/inter-class parameters to place in a correlation matrix of errors.
beta_var(x, school, tauhat, v1, v2, v3, section, mat)
beta_var(x, school, tauhat, v1, v2, v3, section, mat)
x |
Data frame of covariates. |
school |
A vector of cluster. |
tauhat |
This is obtained from Rank-based fitting.
|
v1 |
This is 1, main diagonal element for correlation matrix of observations. Correlation of an observation with itself is 1. |
v2 |
Intra-cluster correlation coefficient. |
v3 |
Intra-subcluster correlation coefficient. |
section |
A vector of subclusters, nx1. |
mat |
A matrix of numbers of observations in subclusters. Dimension is Ixmax(number ofsubclusters). Each row indicates one cluster. |
Correlation coefficients are obtained using Moment Estimates. See Klole et. al (2009), Bilgic (2012) and HM (2012)
var |
The variance of fixed estimated. |
Yusuf Bilgic
Y. K. Bilgic. Rank-based estimation and prediction for mixed effects models in nested designs. 2012. URL http://scholarworks.wmich.edu/dissertations/40. Dissertation.
J. Kloke, J. W. McKean and M. Rashid. Rank-based estimation and associated inferences for linear models with cluster correlated errors. Journal of the American Statistical Association, 104(485):384-390, 2009.
T. P. Hettmansperger and J. W. McKean. Robust Nonparametric Statistical Methods. Chapman Hall, 2012.
Compares two model fits. It returns tdbeta value and cfits values of two fits. The function uses the fixed effects estimates from fit 1 and fit 2 along with the covariance of the rank-based fit.
compare.fits(x, fit1, fit2)
compare.fits(x, fit1, fit2)
x |
Matrix of covariates |
fit1 |
A class of type rlme. |
fit2 |
A class of type rlme. |
Returns tdbeta and cfits values.
data(schools) model = y ~ 1 + sex + age + (1 | region) + (1 | region:school) # Extract covariants into matrix cov = as.matrix(data.frame(schools[,"sex"], schools[,"age"])) # Fit the models using each method reml.fit = rlme(model, schools, method="reml") gr.fit = rlme(model, schools, method="gr") compare.fits(cov, reml.fit, gr.fit)
data(schools) model = y ~ 1 + sex + age + (1 | region) + (1 | region:school) # Extract covariants into matrix cov = as.matrix(data.frame(schools[,"sex"], schools[,"age"])) # Fit the models using each method reml.fit = rlme(model, schools, method="reml") gr.fit = rlme(model, schools, method="gr") compare.fits(cov, reml.fit, gr.fit)
This is an unbiased estimator with a correction factor for standard deviation when normal errors.
dispvar(x, score = 1)
dispvar(x, score = 1)
x |
vector |
score |
score type - 1 or 2 |
T. P. Hettmansperger and J. W. McKean. Robust Nonparametric Statistical Methods. Chapman Hall, 2012.
Obtains measurement for the fits based on estimates beta1, beta2 and covariance matrix from a rank based methods.
fitdvcov(x1, beta1, beta2, vcw)
fitdvcov(x1, beta1, beta2, vcw)
x1 |
data |
beta1 |
model 1 beta estimate |
beta2 |
model 2 beta estimate |
vcw |
variance matrix |
# Compare GR and JR methods data(schools) model = y ~ 1 + sex + age + (1 | region) + (1 | region:school) # Extract covariants into matrix cov = as.matrix(data.frame(schools[,"sex"], schools[,"age"])) # Fit the models using each method jr.fit = rlme(model, schools, method="jr") gr.fit = rlme(model, schools, method="gr") # Extract beta estimates, ignoring the intercept jr.beta = jr.fit$fixed.effects$Estimate[c(2, 3)] gr.beta = gr.fit$fixed.effects$Estimate[c(2, 3)] # Extract beta variance matrix var.b = jr.fit$var.b fitdvcov(cov, jr.beta, gr.beta, var.b)
# Compare GR and JR methods data(schools) model = y ~ 1 + sex + age + (1 | region) + (1 | region:school) # Extract covariants into matrix cov = as.matrix(data.frame(schools[,"sex"], schools[,"age"])) # Fit the models using each method jr.fit = rlme(model, schools, method="jr") gr.fit = rlme(model, schools, method="gr") # Extract beta estimates, ignoring the intercept jr.beta = jr.fit$fixed.effects$Estimate[c(2, 3)] gr.beta = gr.fit$fixed.effects$Estimate[c(2, 3)] # Extract beta variance matrix var.b = jr.fit$var.b fitdvcov(cov, jr.beta, gr.beta, var.b)
The package rlme calls this function for gee method, one of the methods proposed in Bilgic's study (2012). Also see Kloke et al. (2013). concise (1-5 lines) description of what the function does. ~~
GEER_est(x, y, I, sec, mat, school, section, weight = "wil", rprpair = "hl-disp", verbose = FALSE)
GEER_est(x, y, I, sec, mat, school, section, weight = "wil", rprpair = "hl-disp", verbose = FALSE)
x |
Design matrix, pxn, without intercept. |
y |
Response vector of nx1. |
I |
Number of clusters. |
sec |
A vector of subcluster numbers in clusters. |
mat |
A matrix of numbers of observations in subclusters. Dimension is Ixmax(number ofsubclusters). Each row indicates one cluster. |
school |
A vector of clusters, nx1. |
section |
A vector of subclusters, nx1. |
weight |
When weight="hbr", it uses hbr weights in GEE weights. By default, ="wil", it uses Wilcoxon weights. See the theory in the references. |
rprpair |
By default, it uses "hl-disp" in the random prediction procedure (RPP). Also, "med-mad" would be an alternative. |
verbose |
Boolean indicating whether to print out diagnostic messages. |
theta |
Fixed effect estimates. |
ses |
Standard error for the fixed esimates. |
sigma |
Variances of cluster, subcluster, and residual. |
ehat |
Raw error. |
ehats |
Independence error from last weighted step. |
effect_sch |
Cluster random error. |
effect_sec |
Subcluster random error. |
effect_err |
Epsilon error. |
Yusuf K. Bilgic, [email protected]
Y. K. Bilgic. Rank-based estimation and prediction for mixed effects models in nested designs. 2012. URL http://scholarworks.wmich.edu/dissertations/40. Dissertation.
A. Abebe, J. W. McKean, J. D. Kloke and Y. K. Bilgic. Iterated reweighted rank-based estimates for gee models. 2013. Submitted.
rlme, GR_est, JR_est, rprmeddisp
# See the rlme function.
# See the rlme function.
It gets Q-Q Plot and Standardized Residual Plot of residuals.
getgrstplot(rlme.fit)
getgrstplot(rlme.fit)
rlme.fit |
RLME fit object |
The fit is obtained from rlme()
rlme
It gets Q-Q Plot and Standardized Residual Plot of residuals. concise (1-5 lines) description of what the function does.
getlmestplot(rlme.fit)
getlmestplot(rlme.fit)
rlme.fit |
The fit is obtained from rlme() |
rlme
Fits a model using the GR method
GR_est(x, y, I, sec, mat, school, section, rprpair = "hl-disp", verbose = FALSE)
GR_est(x, y, I, sec, mat, school, section, rprpair = "hl-disp", verbose = FALSE)
x |
Covariate matrix or data frame. |
y |
Response matrix or data frame. |
I |
Number of clusters |
sec |
A vector of subcluster numbers in clusters. |
mat |
A matrix of numbers of observations in subclusters. Dimension is Ixmax(number ofsubclusters). Each row indicates one cluster. |
school |
A vector of clusters, nx1. |
section |
A vector of subclusters, nx1. |
rprpair |
By default, it uses "hl-disp" in the random prediction procedure (RPP). Also, "med-mad" would be an alternative. |
verbose |
Boolean indicating whether to print out messages from the algorithm. |
theta |
Fixed effect estimates. |
ses |
Standard error for the fixed esimates. |
sigma |
Variances of cluster, subcluster, and residual. |
ehat |
Raw error. |
ehats |
Independence error from last weighted step. |
effect_sch |
Cluster random error. |
effect_sec |
Subcluster random error. |
effect_err |
Epsilon error. |
Yusuf Bilgic
# See rlme function
# See rlme function
Calculates hbr weights for the GEER method. This turns a vector of weights for a vector of errors. Used to make factor space more robust, up to 50% breakdown. See HM (2012) and Terpstra and McKean (2005) for details. The ww package produces this weights as well.
hbrwts_gr(xmat, y, percent = 0.95, intest = ltsreg(xmat, y)$coef)
hbrwts_gr(xmat, y, percent = 0.95, intest = ltsreg(xmat, y)$coef)
xmat |
Design matrix, pxn, without intercept. |
y |
Response vector in nx1. |
percent |
This is 0.95. |
intest |
This is obtained from myltsreg(xmat, y)$coef |
The ww package explains how it is obtained.
J. W. McKean
T. P. Hettmansperger and J. W. McKean. Robust Nonparametric Statistical Methods. Chapman Hall, 2012.
J. T. Terpstra and J. W. McKean. Rank-based analysis of linear models using R. Journal of Statistical Software, 14(7):1 - 26, 7 2005. ISSN 1548-7660. URL http://www.jstatsoft.org/v14/i07.
GEER_est
A data frame on school instruction results.
A data frame with 1190 observations on the following 13 variables.
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector
a numeric vector identifying the class within school
a numeric vector identifying the school
a numeric vector
West, B., Welch, K. B., & Galecki, A. T. (2006). Linear mixed models: a practical guide using statistical software. Chapman & Hall/CRC.
# The following code takes a few minutes to run. # In the interest of saving CRAN's example testing time, # it has been commented out. If you want to use it, # just uncomment and run. # data(instruction) # attach(instruction) # data = data.frame( # y = mathgain, # mathkind = mathkind, # girl = girl, # minority = minority, # ses = ses, # school = factor(schoolid), # section = factor(classid)) # fit.rlme = rlme(y ~ 1 + mathkind + girl + minority + ses + (1 | school) + (1 | school:section), # data = data, # method = "gr") # summary(fit.rlme)
# The following code takes a few minutes to run. # In the interest of saving CRAN's example testing time, # it has been commented out. If you want to use it, # just uncomment and run. # data(instruction) # attach(instruction) # data = data.frame( # y = mathgain, # mathkind = mathkind, # girl = girl, # minority = minority, # ses = ses, # school = factor(schoolid), # section = factor(classid)) # fit.rlme = rlme(y ~ 1 + mathkind + girl + minority + ses + (1 | school) + (1 | school:section), # data = data, # method = "gr") # summary(fit.rlme)
Fit a model using the JR method
JR_est(x, y, I, sec, mat, school, section, rprpair = "hl-disp", verbose = FALSE)
JR_est(x, y, I, sec, mat, school, section, rprpair = "hl-disp", verbose = FALSE)
x |
Covariate matrix or data frame |
y |
Response matrix or data frame |
I |
Number of clusters. |
sec |
A vector of subcluster numbers in clusters. |
mat |
A matrix of numbers of observations in subclusters. Dimension is
Ixmax(number ofsubclusters). Each row indicates one cluster.
|
school |
A vector of clusters, nx1. |
section |
A vector of subclusters, nx1. |
rprpair |
By default, it uses "hl-disp" in the random prediction procedure (RPP). Also, "med-mad" would be an alternative. |
verbose |
Boolean indicating whether to print out diagnostic messages. |
theta |
Fixed effect estimates. |
ses |
Standard error for the fixed esimates. |
sigma |
Covariate variance estimates using RPP (Groggel and Dubnicka's procedure). |
ehat |
Raw error. |
effect_sch |
Cluster random error. |
effect_sec |
Subcluster random error. |
effect_err |
Epsilon error. |
Yusuf Bilgic
rlme
This gets the REML or ML estimates and predictions of random effects from the nlme package. function does.
LM_est(x, y, dat, method = "REML")
LM_est(x, y, dat, method = "REML")
x |
Design matrix, (p+1)xn, with intercept. |
y |
Response vector of nx1. |
dat |
Data frame |
method |
Character string indicating method to use, either "ML" or "REML" (defaults to REML). |
theta |
Fixed effects esimates. |
ses |
Standard error for fixed effects. |
varb |
Variances. |
sigma |
Error. |
ehat |
Raw residuals |
standr.lme |
Standardized residual |
effect_sch |
Cluster random error. |
effect_sec |
Subcluster random error. |
effect_err |
Epsilon error. |
Yusuf Bilgic
J. Pinheiro, D. Bates, S. DebRoy, D. Sarkar and R Development Core Team. nlme linear and non- linear mixed effects models. The R Journal, 2011. URL http://CRAN.R-project.org/package=nlme. R package version 3.1-98.
Computes rank based regression estimates for fixed effect models.
lmr(f, data, se = FALSE, method = "L-BFGS-B")
lmr(f, data, se = FALSE, method = "L-BFGS-B")
f |
A model formula |
data |
Data to use for model fitting |
se |
Boolean indicating whether or not to calculate standard errors for intercept and slope estimates |
method |
Optimization method to use. Will accept any method usable by optim, e.g. one of c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"). "BFGS" or "L-BFGS-B" are reccomended. "L-BFGS-B" should be used for large datasets to conserve memory. |
fixed.effects |
Fixed effect estimates |
ehat |
Residuals from model |
Herb Susmann
rlme, optim
# load schools data data(schools) # Fit fixed effects model with lmr lmr.fit = lmr(y ~ age + sex, data=schools) summary(lmr.fit) # Fit with lmr and calculate standard errors lmr.fit = lmr(y ~ age + sex, data=schools, se=TRUE) summary(lmr.fit)
# load schools data data(schools) # Fit fixed effects model with lmr lmr.fit = lmr(y ~ age + sex, data=schools) summary(lmr.fit) # Fit with lmr and calculate standard errors lmr.fit = lmr(y ~ age + sex, data=schools, se=TRUE) summary(lmr.fit)
Uses optim to find regression estimates which minimize dispersion function on X and Y input matrices
minimize_dispersion(X, Y, method = "BFGS", init.guess = "quantreg", verbose = FALSE, se = TRUE)
minimize_dispersion(X, Y, method = "BFGS", init.guess = "quantreg", verbose = FALSE, se = TRUE)
X |
Input matrix |
Y |
Response vector |
method |
Method optim should use - one of "Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", or "Brent". |
init.guess |
How to calculate the first regression estimate. Defaults to using quantile regression. |
verbose |
Whether to print out verbose messages. |
se |
Whether or not to calculate standard errors of regression estimates. |
theta |
Regression parameter estimates |
ehat |
Regression residuals |
Herb Susmann
Generates Normal Q-Q plot of residuals from rlme fit
## S3 method for class 'rlme' plot(x, ...)
## S3 method for class 'rlme' plot(x, ...)
x |
A list of class rlme. Store as fit.rlme. |
... |
not used |
data(schools) rlme.fit = rlme(y ~ 1 + sex + age + (1 | region) + (1 | region:school), schools, method="gr") plot(rlme.fit)
data(schools) rlme.fit = rlme(y ~ 1 + sex + age + (1 | region) + (1 | region:school), schools, method="gr") plot(rlme.fit)
Moment estimate version of correlation coefficient in a cluster in a three-level nested design.
rhosch(ahat, school, section)
rhosch(ahat, school, section)
ahat |
A vector of scores. Wilcoxon scores are used in the package. |
school |
A vector of clusters. |
section |
A vector of subclusters. |
Y. K. Bilgic. Rank-based estimation and prediction for mixed effects models in nested designs. 2012. URL http://scholarworks.wmich.edu/dissertations/40. Dissertation.
Moment estimate version of correlation coefficient in a subcluster in a three-level nested design.
rhosect(ahat, school, section)
rhosect(ahat, school, section)
ahat |
A vector of scores. Wilcoxon scores are used in the package. |
school |
A vector of clusters. |
section |
A vector of subclusters. |
Y. K. Bilgic. Rank-based estimation and prediction for mixed effects models in nested designs. 2012. URL http://scholarworks.wmich.edu/dissertations/40. Dissertation.
This function estimates fixed effects and predicts random effects in two- and three-level random effects nested models using three rank-based fittings (GR, GEER, JR) via the prediction method algorithm RPP.
rlme(f, data, method = "gr", print = FALSE, na.omit = TRUE, weight = "wil", rprpair = "hl-disp", verbose = FALSE)
rlme(f, data, method = "gr", print = FALSE, na.omit = TRUE, weight = "wil", rprpair = "hl-disp", verbose = FALSE)
f |
An object of class formula describing the mixed effects model. The syntax is same as in the lme4 package. Example: y ~ 1 + sex + age + (1 | region) + (1 | region:school) - sex and age are the fixed effects, region and school are the nested random effects, school is nested within region. |
data |
The dataframe to analyze. Data should be cleaned prior to analysis: cluster and subcluster columns are expected to be integers and in order (e.g. all clusters and subclusters ) |
method |
string indicating the method to use (one of "gr", "jr", "reml", and "geer"). defaults to "gr". |
print |
Whether or not to print a summary of results. Defaults to false. |
na.omit |
Whether or not to omit rows containing NA values. Defaults to true. |
weight |
When weight="hbr", it uses hbr weights in GEE weights. By default, ="wil", it uses Wilcoxon weights. See the theory in the references. |
rprpair |
By default, it uses "hl-disp" in the random prediction procedure (RPP). Also, "med-mad" would be an alternative. |
verbose |
Boolean indicating whether to print out diagnostic messages. |
The iterative methods GR and GEER can be quite slow for large datasets; try JR for faster analysis. If you want to use the GR method, try using rprpair='med-mad'. This method avoids building a NxN covariance matrix which can quickly become unwieldly with large data.
The function returns a list of class "rlme". Use summary.rlme to see a summary of the fit.
formula |
The model formula. |
method |
The method used. |
fixed.effects |
Estimate of fixed effects. |
random.effects |
Estimate of random effects. |
standard.residual |
Residuals. |
intra.class.correlations |
Intra/inter-class correlationa estimates obtained from RPP. |
t.value |
t-values. |
p.value |
p-values. |
location |
Location. |
scale |
Scale. |
y |
The response variable y. |
num.obs |
Number of observations in provided dataset. |
num.clusters |
The number of clusters. |
num.subclusters |
The number of subclusters. |
effect.err |
Effect from error. |
effect.cluster |
Effect from cluster. |
effect.subcluster |
Effect from subcluster. |
var.b |
Variances of fixed effects estimate (Beta estimates). |
xstar |
Weighted design matrix with error covariance matrix. |
ystar |
Weighted response vector with its covariance matrix. |
ehat |
The raw residual. |
ehats |
The raw residual after weighted step. Scaled residual. |
Yusuf Bilgic [email protected] and Herb Susmann [email protected]
Y. K. Bilgic. Rank-based estimation and prediction for mixed effects models in nested designs. 2012. URL http://scholarworks.wmich.edu/dissertations/40. Dissertation.
T. P. Hettmansperger and J. W. McKean. Robust Nonparametric Statistical Methods. Chapman Hall, 2012.
summary.rlme, plot.rlme, compare.fits
data(schools) rlme.fit = rlme(y ~ 1 + sex + age + (1 | region) + (1 | region:school), schools, method="gr") summary(rlme.fit) # Try method="geer", "reml", "ml" and "jr" along with # rprpair="hl-disp" (not robust), and "med-mad" (robust), # weight="hbr" is for the gee method.
data(schools) rlme.fit = rlme(y ~ 1 + sex + age + (1 | region) + (1 | region:school), schools, method="gr") summary(rlme.fit) # Try method="geer", "reml", "ml" and "jr" along with # rprpair="hl-disp" (not robust), and "med-mad" (robust), # weight="hbr" is for the gee method.
Partitions model residuals into cluster and subcluster effects using RPP algorithm.
rpr(f, resd, data, rprpair = "hl-disp")
rpr(f, resd, data, rprpair = "hl-disp")
f |
A model formula which specifices the random effects (see example) |
resd |
The residuals from the fitted model |
data |
The data the model was fitted on |
rprpair |
Character string indicating the location and scale parameters to use. Default to "hl-disp", but may also be "med-mad". See Bilgic (2012). |
siga2 |
Variance from cluster |
sigw2 |
Variance from subcluster |
sigmae2 |
Remaining variance not accounted for by variance of cluster and subcluster |
J. W. McKean and Y. K. Bilgic
Y. K. Bilgic. Rank-based estimation and prediction for mixed effects models in nested designs. 2012. URL http://scholarworks.wmich.edu/dissertations/40. Dissertation.
rprmeddis, dispvar
# Load school data data(schools) # Fit fixed effects model with lmr lmr.fit = lmr(y ~ age + sex, data=schools) # Three level design # Partition residuals into school and region effects with rpp algorithm rpr(y ~ age + sex + (1 | school) + (1 | school:region), lmr.fit$ehat, schools) # Two level design # Estimate variance in residuals from school rpr(y ~ age + sex + (1 | school), lmr.fit$ehat, schools)
# Load school data data(schools) # Fit fixed effects model with lmr lmr.fit = lmr(y ~ age + sex, data=schools) # Three level design # Partition residuals into school and region effects with rpp algorithm rpr(y ~ age + sex + (1 | school) + (1 | school:region), lmr.fit$ehat, schools) # Two level design # Estimate variance in residuals from school rpr(y ~ age + sex + (1 | school), lmr.fit$ehat, schools)
Robust rank-based prediction algorithm that gets predictions for random errors in three-level nested design. It needs one location and scale estimators. Hodges-Lehmann location estimate and dispersion functional estimate pair is called with rprpair="hl-disp" -by default- ; median and MAD pair is called with rprpair="med-mad" in rlme().
rprmeddis(I, sec, mat, ehat, location, scale, rprpair = "hl-disp")
rprmeddis(I, sec, mat, ehat, location, scale, rprpair = "hl-disp")
I |
Number of clusters. |
sec |
A vector of subcluster numbers in clusters. |
mat |
A matrix of numbers of observations in subclusters. Dimension is Ixmax(number ofsubclusters). Each row indicates one cluster. |
ehat |
The residuals that inherits random effects and error effect to be predicted. |
location |
If location = scale = 1 then use Median and MAD in RPP If location = scale = 2 then use HL & Dispvar in RPP Note: this is deprecated. You should specify the location & scale parameters by using the rprpair parameter. |
scale |
1 means mad, 2 means disp as scale estimators |
rprpair |
Character string indicating the location and scale parameters to use. Default to "hl-disp", but may also be "med-mad". See Bilgic (2012). |
The rprmeddisp() function yields predictions of random effects and errors vectors along with scale estimates in each level. This function was designed for three-level nested design. See rprmeddisp2() in the package, this is for two-level nested design.
Yusuf Bilgic [email protected]
Y. K. Bilgic. Rank-based estimation and prediction for mixed effects models in nested designs. 2012. URL http://scholarworks.wmich.edu/dissertations/40. Dissertation.
The data in Program for International Assessment (PISA) on academic proficiency in schools around the world.
A data frame with 334 observations on the following 6 variables.
a numeric vector indicating student literacy
a numeric vector
a numeric vector
a numeric vector
a numeric vector indicating four regions
a numeric vector indicating the schools within region
OECD (2010). PISA 2009 Results. http://www.oecd.org/
# # The example takes a few seconds to run, so in order to # save CRAN's testing time it has been commented out. # To run, simply uncomment and execute. # # data(schools) # rlme.fit = rlme(y ~ 1 + sex + age + (1 | region) + (1 | region:school), # schools, method="gr") # summary(rlme.fit)
# # The example takes a few seconds to run, so in order to # save CRAN's testing time it has been commented out. # To run, simply uncomment and execute. # # data(schools) # rlme.fit = rlme(y ~ 1 + sex + age + (1 | region) + (1 | region:school), # schools, method="gr") # summary(rlme.fit)
Standardizes the residuals obtained from the GR fitting.
stanresidgr(x, y, resid, delta = 0.8, param = 2, conf = 0.95)
stanresidgr(x, y, resid, delta = 0.8, param = 2, conf = 0.95)
x |
Design matrix. |
y |
Response vector. |
resid |
Residuals obtained from the rank-based fitting. |
delta |
See HM (2012). |
param |
See HM (2012). |
conf |
See HM (2012). |
J. W. McKean
T. P. Hettmansperger and J. W. McKean. Robust Nonparametric Statistical Methods. Chapman Hall, 2012.
Y. K. Bilgic. Rank-based estimation and prediction for mixed effects models in nested designs. 2012. URL http://scholarworks.wmich.edu/dissertations/40. Dissertation.
Summarizes a model fit from the rmle function
## S3 method for class 'rlme' summary(object, ...)
## S3 method for class 'rlme' summary(object, ...)
object |
A list of class rlme |
... |
not used |
Herb Susmann [email protected]
This function gets weighted rank based fittings.
wilonestep(y, x)
wilonestep(y, x)
y |
Response vector of nx1. |
x |
Design matrix, pxn, without intercept. |
J. T. Terpstra and J. W. McKean. Rank-based analysis of linear models using R. Journal of Statistical Software, 14(7) 1 – 26, 7 2005. ISSN 1548-7660. URL http://www.jstatsoft.org/v14/i07.
Gets weighted rank based fittings for nested designs.
wilstep(I, sec, mat, init = F, y, x, sigmaa2 = 1, sigmaw2 = 1, sigmae2 = 1, thetaold = c(0), eps = 1e-04, iflag2 = 0, rprpair = "hl-disp")
wilstep(I, sec, mat, init = F, y, x, sigmaa2 = 1, sigmaw2 = 1, sigmae2 = 1, thetaold = c(0), eps = 1e-04, iflag2 = 0, rprpair = "hl-disp")
I |
Number of clusters. |
sec |
A vector of subcluster numbers in clusters. |
mat |
A matrix of numbers of observations in subclusters. Dimension is Ixmax(number ofsubclusters). Each row indicates one cluster. |
init |
boolean |
y |
Response vector of nx1. |
x |
Design matrix, pxn, without intercept. |
sigmaa2 |
Initial sigma for cluster in three-level design. |
sigmaw2 |
Initial sigma for subcluster in three-level design. |
sigmae2 |
Initial sigma for error in three-level design. |
thetaold |
Initial input. |
eps |
Epsilon value |
iflag2 |
y or n |
rprpair |
Either 'hl-disp' or 'med-mad' |
Initial inputs are from the independent model.
J. W. McKean and Y. K. Bilgic
Y. K. Bilgic and J. W. McKean. Iteratively reweighted generalized rank-based method in mixed models. 2013. Under preperation.
J. T. Terpstra and J. W. McKean. Rank-based analysis of linear models using R. Journal of Statistical Software, 14(7) 1 - 26, 7 2005. ISSN 1548-7660. URL http://www.jstatsoft.org/v14/i07.