Giter Club home page Giter Club logo

tmsalab / iccbeta Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 111 KB

A function and vignettes for computing an intraclass correlation described in Aguinis & Culpepper (2015) <doi:10.1177/1094428114563618>. This package quantifies the share of variance in a dependent variable that is attributed to group heterogeneity in slopes.

Home Page: https://tmsalab.github.io/iccbeta

R 81.01% C++ 18.99%
r rcpparmadillo armadillo correlation rcpp intraclass-correlation

iccbeta's Issues

lmer wrapper buglet

In #6, there was a wrapper added to perform the extraction. However, we extracted a bit too many terms. In particular, we only want to extract elements corresponding to the random-effects, not all effects (p). c.f.

T1 <- VarCorr(x)[[group_term]][1:p,1:p]

Consider revising given:

iccbeta/R/iccbeta.R

Lines 145 to 152 in f649ced

# Figure out the class term:
term_labels <- attr(mf, "names")
# Retrieve the _LAST_ variable (assume it is a group variable.)
# To Do: What is the best way to make this approach robust ?
group_term <- term_labels[length(term_labels)]
T1 <- VarCorr(x)[[group_term]][1:p,1:p]

Issue arose with:

m <- lmer(DV ~ P + P:H + (1+P||id), data = data)

No data was given, so an equivalent test case should be:

fm1 <- lmer(Reaction ~ Days + (1+Days || Subject), data = sleepstudy)

icc_beta throws error: "Mat::row(): index out of bounds"

The icc_beta threw the following error:

error: Mat::row(): index out of bounds
Error in icc_beta(X, df_icc[, "L2id"], T1, vy) : 
  Mat::row(): index out of bounds

I just tried to calculate the icc_beta for a dataset with the following structure:
I have a dataset where L1 = time point, L2 = person. Each L2 unit has several L1 units.

However,

  • the L1 are not equal between L2 (different group sizes).
  • and sometimes persons skipped time points, resulting in cases where L1 may be NA for, say, L1id 1, 2, 3, but have a value for L1id 4,5,6. In such cases, the L1id rows 1,2,3 are retained, even if NA for the Y variable.

My hunch is that this data structure leads to the aforementioned error. Specifically, df_icc[, "L2id"] is 444, whereas nrow(X) is 297.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.