Skip to content

Commit

Permalink
Fix log_lik for multi_normals with >2 variables
Browse files Browse the repository at this point in the history
  • Loading branch information
timjzee committed Jun 26, 2024
1 parent 7cd5ba0 commit 1a040c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/ulam_templates.R
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,9 @@ ulam_dists <- list(
out <- concat( out , indent , out_var , " ~ multi_normal( " , MU_var , " , " , SIGMA , " );\n" )

} else {
out <- concat( out , indent , "log_lik = multi_normal_lpdf( " , out_var , " | " , MU_var , " , " , SIGMA , " );\n" )
out <- concat( out , indent , "for ( j in 1:" , n_cases , " ) {\n" )
out <- concat( out , indent , indent , "log_lik[j] = multi_normal_lpdf( " , out_var , "[j] | " , MU_var , "[j] , " , SIGMA , " );\n" )
out <- concat( out , indent , "}\n" )
}

# close local environment, if necessary
Expand Down

0 comments on commit 1a040c3

Please sign in to comment.