Skip to content

Commit

Permalink
Fixed issue with obsB, which is a dataframe. For a single functional …
Browse files Browse the repository at this point in the history
…group (#i), we use obsb_i
  • Loading branch information
holdenharris-NOAA committed Sep 17, 2024
1 parent 1e7cd3a commit 56b1554
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Compare-multiple-ecospace-outputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ for (init in scaling_list){
spa_fit_sums = data.frame()

## Loop through each Ecospace scenario ------------------------------------------
##
for(j in 1:length(spa_scenarios)){

fit_metrics <- data.frame(
Expand Down Expand Up @@ -194,10 +195,15 @@ for (init in scaling_list){
years_to_scale <- init_years_toscale)
mean_init_years = mean(non_na_obsB[1:years_to_scale]) # Calculate the mean of the first 'init_years_toscale' non-NA values
obsB_scaled = obs_df$obsB / mean_init_years # Scale the entire obs_df$obsB by this mean
} else obsB_scaled=rep(NA, length(simB))
obsB_i = obs_df$obsB
} else { ## Make NAs if there is no observed data
obsB_scaled = rep(NA, length(simB))
obsB_i = rep(NA, length(simB))
}


## Create data frame to compare observed, Ecosim, and Ecospace
comp_df <- data.frame(obs = obsB, sim = simB, spa = spaB)
comp_df <- data.frame(obs = obsB_i, sim = simB, spa = spaB)

## Calculate log-likelihood ------------------------------------------------
## Calculate log-likelihood for spa vs obs
Expand Down

0 comments on commit 56b1554

Please sign in to comment.