ejosymart / sizemat Goto Github PK
View Code? Open in Web Editor NEWEstimate Size at Sexual Maturity.
Estimate Size at Sexual Maturity.
Dear Josymar Torrejon-Magallanes,
I am currently trying to undertake some size of maturity analysis on some Whelk data, I am trying to classify the juveniles from adults using the classify_mature() function. However when plotting the results the PCA seems to deem the smaller individuals as Adults and the larger ones of Juveniles. A screen shot is below: (x = total shell length, y = penis length)
the call of classify_mature():
Is there a solution to this issue??
It took a while to locate this repos from https://cran.r-project.org/package=sizeMat. In order to easier find this repository, please consider adding a URL
(and BugReports
) entry to the DESCRIPTION that link to https://github.com/ejosymart/sizeMat/.
It might be useful to allow for the case where maturity has been determined elsewehere (not via classify_mature()
) but the size at maturity still needs to be calculated via morph_mature()
(guess who had this use case today?).
Prototype:
manual_classify <- function(x, y, mature) {
mat_data <- data.frame(x = x, y = y, mature = mature)
class(mat_data) <- c("classify", class(mat_data))
return(mat_data)
}
If there's nothing else that I'm missing (in terms of interacting with other functions) then sure, it's simple enough, but appending a specific class
to a data.frame
isn't something that every user will know how to do (correctly) to satisfy morph_mature()
's requirement.
Apologies if I've missed any existing implementation.
The new_data
list in .morph_mature_fq()
stores an excessive amount of data. It retains the entire list of niter
re-samples despite these only being required in the glm
on the line following, within the same loop.
Line 10 in 4d760a9
This quickly used up available memory when the input data was large and the default number of iterations were used.
I suggest the following replacement:
set.seed(seed)
n_coef <- list()
for(i in seq_len(niter)) {
new_data <- data[sample(nrow(data), replace = TRUE), ]
model_boot <- glm(mature ~ x, data = new_data, family = binomial(link = "logit"))
glm_coef <- coef(model_boot)
n_coef <- rbind(glm_coef, n_coef)
}
I also recommend updating 1:niter
to seq_len(niter)
which better handles the niter = 0
case (not explicitly forbidden, good practice in any case), and using TRUE
rather than T
. sample
by default takes size
to be the "number of items inferred from the first argument", which expands to 1:nrow(data)
, so the second nrow(data)
is redundant.
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.