rewie.rsq {rewie} | R Documentation |
Computes R-squared for RE panel models
Description
Calculates R-squared for BW, REWE, REWIE, and BW. Includes idiosyncratic R-squared, between R-squared, homogneous-within R-squared, and within R-Squared.
Usage
rewie.rsq(model,timevar,csvar,df)
Arguments
model |
is an lmerMod object fitted by calling the lmer() function in lme4. |
timevar |
is a character string providing the name of the time indicator variable. |
csvar |
is a character string providing the name of the cross-section indicator variable. |
df |
is a dataframe containing y, timevar, and csvar |
Details
Calculates the R-squared for each level of variation. It is calculated by computing the proportion of remaining variance to overall variance the model and then subtracting the quotient from 1.
Value
Returns the results for R-squares
Rsq.total |
is the overall R-squared. |
Rsq.within |
is the within R-squared. |
Rsq.time |
is the time (homogenous-within) R-squared. |
Rsq.idio |
is the idiosyncratic R-squared. |
Rsq.betw |
is the between R-squared. |
Author(s)
Scott Duxbury, Assistant Professor of Sociology at University of North Carolina, Chapel Hill
Examples
require(plm)
require(lme4)
data("Crime")
output<-lmer(lcrmrte~ldensity+(1|county)+(1|year),data=Crime)
rewie.rsq(output,csvar="county",timevar="year",df=Crime)