Skip to content

weights and model formulation #17

@larspett

Description

@larspett

This model used to work in 1.x.x :
m2 <- try(trim(total_number ~ site + year, data=obsTidy, weight=obsTidy$freq, model=3, serialcor=TRUE,overdisp=TRUE))
I noticed that weight is now called weights and had heard that the obsTidy$freq specification was not needed anymore (hence freq should be sufficient)

When I run m2 <- try(trim(total_number ~ site + year, data=obsTidy, weights=obsTidy$freq, model=3, serialcor=TRUE,overdisp=TRUE)), I get the response

"Error in trim.formula(total_number ~ site + year, data = obsTidy, weights = obsTidy$freq, : argument 'weights' should be character"

When I then modify it to:

m2 <- try(trim(total_number ~ site + year, data=obsTidy, weights=freq, model=3, serialcor=TRUE,overdisp=TRUE)), I then get the response

"Error in trim.formula(total_number ~ site + year, data = obsTidy, weights = freq, : object 'freq' not found"

I finally get it working by the unexpected version (guided by the above error stating that 'weights' should be character) :

m2 <- try(trim(total_number ~ site + year, data=obsTidy, weights="freq", model=3, serialcor=TRUE,overdisp=TRUE))

So it looks like the variable name freq is not recognised. BTW obsTidy is a tibble that look like this:

A tibble: 564 x 4
site year total_number freq

1 107 2010 0 0.167
2 107 2011 0 0.5

Best wishes, Lars

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