Commit b6786836 authored by William F Godoy's avatar William F Godoy

Switching X

parent 053a0bf9
......@@ -24,7 +24,7 @@ struct AmrexCastro <: AbstractAmrex
"castro.max_grid_size",
],
Dict{String,Array{String}}(
"plots_size" => ["amr.nplot_files", "amr.ncells", "amr.max_level"],
"plots_size" => ["amr.nplot_files", "amr.ncells"],
"checks_size" => [
"amr.check_int",
"amr.ncheck_files",
......@@ -128,21 +128,31 @@ function _run_linear_model_plots_size(extractor::AmrexCastro, X::DataFrames.Data
push!(plotsSizesData, [plotsSize])
end
println(plotsSizesData)
# Prepare the X independent variables in the linear model
XNames::Array{String} = extractor.outputs["plots_size"]
for XName in XNames
columnName = Symbol(XName)
col1 = Symbol("amr.nplot_files")
col2 = Symbol("amr.ncells")
insert!(plotsSizesData, 2 ,X[!,col1] .* X[!,col2], :new_data)
#plotsSizesData[!,col1] =
#for XName in XNames
#columnName = Symbol(XName)
# this syntax [!, symbol] does not make a copy, use [:, symbol] for copies
plotsSizesData[!, columnName] = X[!, columnName]
end
#plotsSizesData[!, columnName] = X[!, columnName]
#end
# formula from https://discourse.julialang.org/t/glm-jl-with-unknown-column-names/20692/5
response = Symbol(names(plotsSizesData)[1])
predictors = Symbol.(names(plotsSizesData)[2:end])
println(plotsSizesData)
f = @eval(GLM.@formula($response ~ (+)(1, $(predictors...))))
f = @eval(GLM.@formula($response ~ (+)( $(predictors...))))
ols = GLM.lm(f, plotsSizesData)
......
Markdown is supported
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