Skip to content

Manuscript Error: Possible needless slicing in example? #161

Open
@paw-lu

Description

@paw-lu

Description

To be honest I'm a little unsure here, but in 5.10

with pm.Model() as sp_individual:
    τ = pm.HalfCauchy("τ", 1)
    β = pm.Normal("β", mu=0, sigma=τ, shape=(Bi.shape[1], groups))
    μi = pm.Deterministic("μi", pm.math.dot(Bi, β))
    σ = pm.HalfNormal("σ", 1)
    up = pm.Normal("up", μi[:,index].T.ravel(), σ, observed=uptake)
    idata_sp_individual = pm.sample(2000, return_inferencedata=True)

where

index = range(12)
groups = len(index)

I'm a bit confused on this line:

    up = pm.Normal("up", μi[:,index].T.ravel(), σ, observed=uptake)

specifically the μi[:, index] statement. If groups = len(index), μi has len(index) columns. So if we slice it using μi[:, index], then I think we do nothing to it? we're essentially saying: Take all rows (:) and all columns (index since μi has len(index) rows) of μi. So μi[:, index] == μi, and the slicing does nothing.

Reference

5.7 Listings 5.10

Author Section

Do not close until

  • Added to Errata
  • Fixed in Open Access
  • Fixed in latex source

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions