pharmcat / metida.jl Goto Github PK
View Code? Open in Web Editor NEWJulia package for fitting mixed-effects models with flexible random/repeated covariance structure.
Home Page: http://metidajl.org
License: MIT License
Julia package for fitting mixed-effects models with flexible random/repeated covariance structure.
Home Page: http://metidajl.org
License: MIT License
as deprecated
Check rank before variance-covariance matrix of β calc
Hi, new to Julia coming from R, I have a question about an error message I get trying to apply a mixed effects model using Metida on my data.
using Metida, CSV, DataFrames, CategoricalArrays
df = CSV.File("../data/mydata.csv") |> DataFrame;
transform!(df, :Peptide => categorical, renamecols=false);
transform!(df, :Protein => categorical, renamecols=false);
transform!(df, :Treatment => categorical, renamecols=false);
transform!(df, :Subject => categorical, renamecols=false);
df
24,104 rows × 5 columns
Peptide | Protein | Measurement | Treatment | Subject
Cat... | Cat... | Float64?.. | Cat... | Cat...
AACAQLNDFLQEYGTQGC | P0C0L4 | missing | G | 6
AACAQLNDFLQEYGTQGC | P0C0L5 | 22.3928 | G | 6
...
# This is the full model I want to specify
lmm = LMM(@formula(Measurement ~ Treatment * Peptide + Protein), df;
random = VarEffect(@covstr(1 | Subject / Protein), CSH));
MethodError: no method matching fulldummycodingdict(::FunctionTerm{typeof(/), var"#68#70", (:Subject, :Protein)})
...
# Removing the nested term lets me specify the formula
lmm = LMM(@formula(Measurement ~ Treatment * Peptide + Protein), df;
random = VarEffect(@covstr(1 | Subject), CSH));
# But the fit throws an error
fit!(lmm)
BoundsError: attempt to access 20683×1109 Matrix{Float64} at index [UInt32[0x00004dc9, 0x00004dca, 0x00004dcb, 0x00004dcc, 0x00004dcd, 0x00004dce, 0x00004dcf, 0x00004dd0, 0x00004dd1, 0x00004dd2 … 0x000051d7, 0x000051d8, 0x000051d9, 0x000051da, 0x000051db, 0x000051dc, 0x000051dd, 0x000051de, 0x000051df, 0x000051e0], 1:1109]
Stacktrace:
[1] throw_boundserror(A::Matrix{Float64}, I::Tuple{Vector{UInt32}, Base.Slice{Base.OneTo{Int64}}})
...
# This works in MixedModels.jl, perhaps the nested terms have different syntax i Metida?
fm = @formula(Measurement ~ 1 + Treatment*Peptide + Protein + (1 | Subject/Protein))
mm = fit(MixedModel, fm, df, REML=true)
However in MixedModels.jl I am unable to get degrees of freedom and confidence intervals for my model.
Ultimately I want to obtain pairwise contrasts from my model. In R using lme4 and emmeans I would do this:
lmm = lmer(Measurement ~ Treatment * Peptide + Protein + (1 | Subject / Protein), mydata)
emm <- emmeans(lmm, pairwise ~ Treatment | Peptide)
emm <- confint(emm)
emm <- as.data.frame(emm$contrasts)
Any help appreciated
Add to model result check for positive definite G matrix
There is no need to use multiple repeated effects in most cases, but in some rare cases, it can be useful.
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
1.6 test error on experimental functions
Add weights
Now it impossible to fit model with rank deficient fixed effect matrix. There are two ways to fix it:
First lead to lost compatibility with packages like Effects.jl
Second take tonnes of "hardcoding".
Hi. Is there any detailed documetation about the parameters used in Metida
? Like, if I have a kinship matrix, which commonly used in genetic studies reflects the pairwised genetic relatedness, and i want to include it into LMM as a random effect, how could I possibly do it?
Bootstrap validation
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.