squidgroup / squid Goto Github PK
View Code? Open in Web Editor NEWStatistical Quantification of Individual Differences: an simulation tool for understanding multi-level phenotypic data in linear mixed models
License: Other
Statistical Quantification of Individual Differences: an simulation tool for understanding multi-level phenotypic data in linear mixed models
License: Other
The default values of the residual and group variances don't work in the full model. But they get updated and properly accounted for when the user changes them.
tabPanel("squidR",
fixedPage(wellPanel(shiny::includeMarkdown("./source/pages/squidr/squidr.md")))
includeMarkdown(.)
seems case sensitive and the file & directory name include a capital R instead of a small r. When that is changed, the app runs in R.
There are various warnings thrown by lines that include icon("refresh")
in var_fullmodel.R
and var_modules.R
which, if the warning text is correct, should be corrected to icon("sync")
.
A final warning seems to be thrown by navbarpage(.)
in ui.R of which I am still unsure how to improve that.
@hallegue please let me know if you would like me to submit a PR with fixes.
Hi Hassen!
some file systems are case sensitive, you may want to accomodate for that (case in point: source("./source/pages/fullmodel/UIenvironment.R",local=TRUE)
does not work for me (ubuntu 14.04), as the actual filepath is
source("./source/pages/fullModel/UIenvironment.R",local=TRUE)
)
there a probably several ways we can implement simulating multivariate effects. Perhaps have one that allow the user to just put in parameters at the different levels and then everything gets added up, and another way where things can more specifically be added up
Likely very easy comment to address, but as far as I can tell, there is no explanation for what/how to specify the 'cov' parameter in the residual arguments in the simulation? I assume this is just residual variance, correct? This just became apparent to me when I noticed that cov =1 for the first few simulations (simple linear model), but cov =0.3 for the next few (interactions and non-linear effects) without any explanation as to why this changed?
for squidAPP() - Random-slope regression model
currently
I think naming the lists observation and individual may be restrictive. Can we go with level one, level two or something like that. Also useful when there are more than two levels.
Add more documentation to SQUID app (page "Full model (Step by step)") that describes the full model equation.
Hi,
I have a problem running squidApp, it may be because of the function ifelse
This is a new problem because I didn't any trouble 6 months ago.
I run :
library(squid) squidApp()
And I get this warning:
Warning: Error in rep: attempt to replicate an object of type 'environment'
46: ifelse
45: [./source/server/fullmodel/SVRFullModel.R#310]
2: shiny::runApp
1: squidApp
I will be very gratefull if you can help me.
Thank you
This error occurs when running squidApp:
Warning in file(filename, "r", encoding = encoding) :
cannot open file './source/pages/full_model_sbys/ui_fullmodel_sbys_bivar_summary.R.R': No such file or directory
Warning: Error in file: cannot open the connection
need a way to nicely specify interactions between covariates. Probably do this through allowing a user to add a named interaction parameter to the parameter list, which they can add into their model formula
To make the function name more general, I think the word "population" should be avoided.
For example, this function could be named: simulate()
, simulate_data()
, sim_data()
Need to work out a nice way to add factors with fixed effects, not simulated from a normal distribution. If someone wants to simulate sex effects, for example, then this is likely to be a fixed difference between sexes, rather than one drawn from a distribution.
It'll be nice to set the column and row names of the (co)variance matrices with the predictor names.
It'll be easier and faster for the users to understand those matrices when they extract them from the squid output.
For example:
squid_data <- sim_population(
parameters=list(
observation=list(
names=c("temperature","rainfall", "wind"),
mean = c(10,1,20),
cov = matrix(c(1,0,1,0,0.1,0,1,0,2), nrow=3 ,ncol=3),
beta =c(0,-3,0.5),
n_level=2000
),
residual=list(
mean=10,
cov=1,
n_level=2000
)
)
)
cov_mat <- squid_data$parameters$observation$cov
cov_mat
[,1] [,2] [,3]
[1,] 1 0.0 1
[2,] 0 0.1 0
[3,] 1 0.0 2
colnames(cov_mat) <- rownames(cov_mat) <- squid_data$parameters$observation$names
cov_mat
temperature rainfall wind
temperature 1 0.0 1
rainfall 0 0.1 0
wind 1 0.0 2
The same thing could be applied to the mean and the beta vectors.
I'm wondering if isn't more user-friendly to have the predictors' (co)variance matrix as a variance/correlation matrix instead?
The observation and the residual levels should have the same size (i.e., n_level).
When setting different values, such as in this code:
squid_data <- sim_population(
parameters = list(
observation = list(
names = c("temperature", "rainfall"),
n_level = 1000
),
residual = list(
cov = 1,
n_level = 2000
)
)
)
The following error is returned:
Error in (function (..., deparse.level = 1) : number of rows of matrices must match (see arg 2)
It'll be nice to have a more informative error message such as: "Error: The observation and the residual levels must have the same number of levels (i.e., n_level)"
Also, it'll be nice to check that the n_level is a positive integer otherwise return an error message. This could be done for any input parameter.
In the function make_structure()
when the number of observations entered by the user (N) is lower or not a multiplicative of the minimum number of observations to generate properly the grouping levels (Nlevel), the function returns an error.
Example:
ds <- make_structure(structure = "sex(2)/individual(10)", N=9)
ds <- make_structure(structure = "sex(2)/individual(10)", N=38)
Error in levels[, i] <- rep(1:Ns[i], each = N/Ns[i]) :
number of items to replace is not a multiple of replacement length
here:
N = 9 or 38
and Nlevel = 10*2 = 20
It would be nice to either:
(1) return a constructive error message
(2) or (which I recommend) automatically adjust N to Nlevel or to the closest multiplicative of Nlevel, and return a warning message to inform the user that N was changed.
This could also be an issue when multiple grouping structures are defined. Ex:
ds <- make_structure(structure = "sex(2)/individual(10) + season(4)/day(7)", N=40)
N = 40
Nlevel1 = 20
Nlevel2 = 28
The user should be warned that samples sizes within nested structures should match among nested structures and with N.
Write and generate documentation (using roxygen2 packgae) for these SQUID package functions:
I suggest to change the name of the pop_data()
function to: get_data()
Also the data of each step of the squid process could be accessed through, for example, these functions:
get_data_structure()
get_population_data()
get_sample_data()
I am not sure if it is relevant at this stage. But we need to be able to simulate many populations within a world. I assume there will be a sampling function allowing to sample the generated population data using "pop_data". However we still need to generate different populations with the same parameters. Maybe an argument within "pop_data".
The residual level does not have a default variance value. This code returns an error:
squid_data <- sim_population(
parameters = list(
residual = list(
n_level = 2000
)
)
)
Error: The number of parameters given for residual are not consistent
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.