Learn R Programming

rewie (version 0.1.0)

rewie.rsq: 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

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.

%% ~Describe the value returned %% If it is a LIST, use %% \item{comp1 }{Description of 'comp1'} %% \item{comp2 }{Description of 'comp2'} %% ...

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.

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
  
# }
# NOT RUN {
    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)


  
# }

Run the code above in your browser using DataLab