Skip to content

lengths from predict.ALKmodel #10

@mebrooks

Description

@mebrooks

It would be convenient if predict.ALKmodel somehow indicated the length classes and possibly also age classes for the matrix it returns. I thought it might be related to an attribute of the data (e.g. attr(dat, "cm.breaks")), but it isn't transparent to me. In the following example, it would be nice if the rownames and colnames were assigned by the predict.ALKmodel function. The length classes (11:109) differ from cm.breaks (5:115)

Edit: Sorry, cm.breaks are 10:115 for this quarter. They were 5:115 if I look at quarters 1 and 3.

library(DATRAS)

#Get data from DATRAS
dat_all_spp = getDatrasExchange("NS-IBTS", years = 2021, quarters = 1)
#Subset to only look at Atlantic cod
dat0 = subset(dat_all_spp, Species=="Gadus morhua") 

#Define how wide the length categories should be
dat = addSpectrum(dat0, by=1)
attr(dat, "cm.breaks")

#Fit age-length keys to multiple ages with one funciton
alk = fitALK(dat, minAge=1, maxAge=6)

#Plot the model predictions
plotALKfit(alk, row=1)

#Plot the observations with the predictions
plotALKraw(dat, minAge=1, maxAge=6, add=TRUE)

ALKprobs = predict(alk, type="ALK")[[1]]
rownames(ALKprobs) = 11:109
colnames(ALKprobs)=1:6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions