Commit cd6c1254 authored by luroth's avatar luroth
Browse files

spline fitting optimized

parent de7fc90b
...@@ -142,20 +142,6 @@ for(run in start_run:max_runs) { ...@@ -142,20 +142,6 @@ for(run in start_run:max_runs) {
### Merge design and plot information ### Merge design and plot information
df_values_for_fit_orig_ <- inner_join(inner_join(df_trait_values, df_designs, by="plot.UID"), df_genotypes, by="genotype.id") df_values_for_fit_orig_ <- inner_join(inner_join(df_trait_values, df_designs, by="plot.UID"), df_genotypes, by="genotype.id")
# Initial correction to test van Eeujwick 2018:
df_BLUEs_for_fit_orig_ <- df_values_for_fit_orig_ %>%
mutate(se=1, year_site.UID_ = year_site.UID) %>%
group_by(year_site.UID_, timestamp) %>%
nest() %>%
mutate(BLUEs = map(data, fit_SpATS, paste(year_site.UID_, timestamp), use_weights =FALSE, use_checks=TRUE))
df_BLUEs_for_fit_orig_ <- df_BLUEs_for_fit_orig_ %>% unnest(BLUEs)
df_BLUEs_for_fit_orig_ <- df_BLUEs_for_fit_orig_ %>%
mutate(year_site.UID = paste0(year_site.UID_, "_corrected"),
value = BLUE, value_se = BLUE_SE, plot.UID = paste0("BLUE_", genotype.id, year_site.UID))
df_values_for_fit_orig_$value_se <- 1
df_values_for_fit_orig <- bind_rows(df_values_for_fit_orig_, df_BLUEs_for_fit_orig_)
i <- length(measurement_dates_sets) i <- length(measurement_dates_sets)
i <- 1 i <- 1
for(i in length(measurement_dates_sets):1) { for(i in length(measurement_dates_sets):1) {
...@@ -165,14 +151,30 @@ for(run in start_run:max_runs) { ...@@ -165,14 +151,30 @@ for(run in start_run:max_runs) {
set <- paste0("set", str_replace_all(measurement_dates_set_name, " ", "")) set <- paste0("set", str_replace_all(measurement_dates_set_name, " ", ""))
print(paste0("Set: ", measurement_dates_set_name)) print(paste0("Set: ", measurement_dates_set_name))
files <- Sys.glob(paste0(path_simulation, "/", run, "/", set, "_plot_true_versus_predict.csv")) files <- Sys.glob(paste0(path_simulation, "/", run, "/", set, "_year_site_BLUE_predict.csv"))
if(TRUE | length(files)==0) { if(length(files)==0) {
#try({ #try({
df_values_for_fit <- df_values_for_fit_orig %>% df_values_for_fit_orig_ <- df_values_for_fit_orig_ %>%
filter(format(timestamp, "%m%d") %in% measurement_dates_set) filter(format(timestamp, "%m%d") %in% measurement_dates_set)
# Initial correction to test van Eeujwick 2018:
df_BLUEs_for_fit_orig_ <- df_values_for_fit_orig_ %>%
mutate(se=1, year_site.UID_ = year_site.UID) %>%
group_by(year_site.UID_, timestamp) %>%
nest() %>%
mutate(BLUEs = map(data, fit_SpATS, paste(year_site.UID_, timestamp), use_weights =FALSE, use_checks=TRUE))
df_BLUEs_for_fit_orig_ <- df_BLUEs_for_fit_orig_ %>% unnest(BLUEs)
df_BLUEs_for_fit_orig_ <- df_BLUEs_for_fit_orig_ %>%
mutate(year_site.UID = paste0(year_site.UID_, "_corrected"),
value = BLUE, value_se = BLUE_SE, plot.UID = paste0("BLUE_", genotype.id, year_site.UID))
df_values_for_fit_orig_$value_se <- 1
df_values_for_fit_orig <- bind_rows(df_values_for_fit_orig_, df_BLUEs_for_fit_orig_)
df_values_for_fit <- df_values_for_fit_orig
# Add timepoint of preliminar measurement and value delta (growth) to each timepoint # Add timepoint of preliminar measurement and value delta (growth) to each timepoint
df_values_for_fit <- df_values_for_fit %>% group_by(plot.UID) %>% df_values_for_fit <- df_values_for_fit %>% group_by(plot.UID) %>%
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment