Closed christopherbalbach closed 1 year ago
Hi Chris,
I'm glad you're enjoying nmecr! You can extract the change point model coefficients via model_object$model_stats
, where model_object
is a trained model. See example below:
library(nmecr)
data(eload)
data(temp)
baseline_df <- create_dataframe(eload_data = eload, temp_data = temp,
start_date = "03/01/2012 00:00",
end_date = "02/28/2013 23:59",
convert_to_data_interval = "Monthly")
Three_PC_model <- model_with_CP(
training_data = baseline_df,
model_input_options = assign_model_inputs(regression_type = "3PC")
)
Three_PC_model$model_stats
TOWT stats need to be extracted from the occupied and unoccupied models separately. See example:
daily_df <- create_dataframe(eload_data = eload, temp_data = temp,
start_date = "03/01/2012 00:00",
end_date = "02/28/2013 23:59",
convert_to_data_interval = "Daily")
TOWT_model <- model_with_TOWT(
training_data = daily_df,
model_input_options = assign_model_inputs(regression_type = "TOWT")
)
TOWT_model$model_occupied_stats
TOWT_model$model_unoccupied_stats
Hope this helps. Let us know if you additional questions.
Thank you for getting back to Chris quickly, we are working with him to develop a no touch MV tool using nmecr.
We were able to extract the intercepts and independent variables for the change point models but can't seem to find where we would get the change point values for each model.
Three_P_Cool_stats_eff <- Three_P_Cool_model$model_stats Three_P_Heat_stats_eff <- Three_P_Heat_model$model_stats
For example the code above returns: [0] => Array ( [0] => Array ( [Variable] => (Intercept) [Estimate] => 5253.9687 [Std. Error] => 68.2958 [t value] => 76.9296 [Pr(>|t|)] => 1.3967E-251 [_row] => (Intercept) )
[1] => Array
(
[Variable] => U1.independent_variable
[Estimate] => 168.0667
[Std. Error] => 19.6105
[t value] => 8.5703
[Pr(>|t|)] => 1.9311E-16
[_row] => U1.independent_variable
)
)
[1] => Array
(
[0] => Array
(
[Variable] => (Intercept)
[Estimate] => 5974.0111
[Std. Error] => 105.0107
[t value] => 56.8896
[Pr(>|t|)] => 7.4337E-201
[_row] => (Intercept)
)
[1] => Array
(
[Variable] => U1.independent_variable
[Estimate] => -28.9804
[Std. Error] => 5.9038
[t value] => -4.9088
[Pr(>|t|)] => 1.3087E-6
[_row] => U1.independent_variable
)
)
Where would we find the x value for each change point?
Thank you for the help.
Hello,
You can extract the changepoint value(s) with model_object$model_input_options$estimated_breakpoint$Est.
.
model_object$model_input_options$estimated_breakpoint
will give you the initial estimate and the standard error as well as the final changepoint.
Let me know if you have more questions. I’d love to see the tool that you develop as well.
Thanks, Maggie
Maggie @.***> | Data Analyst II | kW Engineeringhttps://www.kw-engineering.com/ | 510-756-1930
From: Shaun Hawk @.> Sent: Thursday, May 4, 2023 11:29 AM To: kW-Labs/nmecr @.> Cc: Maggie Jacoby @.>; State change @.> Subject: Re: [kW-Labs/nmecr] Feature Request: [2P, 3PC, 3PH, 4P, 5P models] Expose model coefficients (slopes, intercepts and changepoints) to support post-processing (Issue #19)
Thank you for getting back to Chris quickly, we are working with him to develop a no touch MV tool using nmecr.
We were able to extract the intercepts and independent variables for the change point models but can't seem to find where we would get the change point values for each model.
Three_P_Cool_stats_eff <- Three_P_Cool_model$model_stats Three_P_Heat_stats_eff <- Three_P_Heat_model$model_stats
For example the code above returns: `[0] => Array ( [0] => Array ( [Variable] => (Intercept) [Estimate] => 5253.9687 [Std. Error] => 68.2958 [t value] => 76.9296 [Pr(>|t|)] => 1.3967E-251 [_row] => (Intercept) )
[1] => Array
(
[Variable] => U1.independent_variable
[Estimate] => 168.0667
[Std. Error] => 19.6105
[t value] => 8.5703
[Pr(>|t|)] => 1.9311E-16
[_row] => U1.independent_variable
)
)
[1] => Array
(
[0] => Array
(
[Variable] => (Intercept)
[Estimate] => 5974.0111
[Std. Error] => 105.0107
[t value] => 56.8896
[Pr(>|t|)] => 7.4337E-201
[_row] => (Intercept)
)
[1] => Array
(
[Variable] => U1.independent_variable
[Estimate] => -28.9804
[Std. Error] => 5.9038
[t value] => -4.9088
[Pr(>|t|)] => 1.3087E-6
[_row] => U1.independent_variable
)
)
`
Where would we find the x value for each change point?
Thank you for the help.
— Reply to this email directly, view it on GitHubhttps://github.com/kW-Labs/nmecr/issues/19#issuecomment-1535223303, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJ73MVNT73U3RZUL5T2XZ2TXEPYPDANCNFSM6AAAAAAXSBRVDY. You are receiving this because you modified the open/close state.Message ID: @.***>
Thank you for developing and supporting the nmecr package!
We have an application where we are using the nmecr "engine" to derive baseline models for 'day-corrected' time series, using monthly energy (utility bill) and monthly weather data.
For the respective models, where can we find the model coefficients (slopes/intercepts and changepoints)? We need these so that we can adjust our baseline periods to other weather conditions. We've studied the code in:
https://github.com/kW-Labs/nmecr/blob/master/man/model_with_CP.Rd,
but were unsure if/where these parameters might be written. Ideally, we would love to see an external file (csv, etc.) that summarizes these model attributes.
Thanks again for all of your efforts in maintaining and extending this code, and for any advice you can offer