Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions R/ulam-function.R
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ ulam <- function( flist , data , pars , pars_omit , start , chains=1 , cores=1 ,
# add by default
built <- compose_distibution( left_symbol , flist[[i]] , as_log_lik=TRUE )
m_gq2 <- concat( m_gq2 , built )
N <- symbols[[left_symbol]]$dims[[2]]
N <- symbols[[left_symbol[1]]]$dims[[2]]
m_gq1 <- concat( m_gq1 , indent , "vector[" , N , "] log_lik;\n" )
# save N to attr so nobs/compare can get it later
nobs_save <- N
Expand Down Expand Up @@ -1440,7 +1440,7 @@ ulam <- function( flist , data , pars , pars_omit , start , chains=1 , cores=1 ,
if ( rstanout==TRUE )
stanfit <- rstan::read_stan_csv(cmdstanfit$output_files())
else
stanfit <- cmdstanfit
stanfit <- as_cmdstan_fit(cmdstanfit$output_files())
}
} else {
if ( cmdstan==FALSE ) {
Expand Down Expand Up @@ -1471,7 +1471,7 @@ ulam <- function( flist , data , pars , pars_omit , start , chains=1 , cores=1 ,
if ( rstanout==TRUE )
stanfit <- rstan::read_stan_csv(cmdstanfit$output_files())
else
stanfit <- cmdstanfit
stanfit <- as_cmdstan_fit(cmdstanfit$output_files())
}
}
} else {
Expand Down
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