What's the difference between fitting a model with feature X and a model that fits with X but then zeros it out?
Say, I have many features to fit a regression model. The features can be categorized into 2 classes: X
and Y
. I'd like to know how X
affects the labels. I wonder the difference between 2 methods:
 Directly fitting the models with
X
, and withoutY
;  Fitting with
X
andY
both in, but after fitting, zeroing out coef's ofY
and looking at coef ofX
.
What's the difference between the two? What are they modeling, respectively? Which should I take? Thanks
See also questions close to this topic

equation that takes datetime into account
I am trying to set up a function with two different dictionaries.
datetime demand 0 20160101 00:00:00 50.038 1 20160101 00:00:10 50.021 2 20160101 00:00:20 50.013 datetime dap 20160101 00:00:00+01:00 23.86 20160101 01:00:00+01:00 22.39 20160101 02:00:00+01:00 20.59
As you can see, the dates are equal however the deltaT is different. The function I have set up is as follows
for key, value in dap.items(): a = demand * value print(a)
How do I make sure that in this function the dap value
23.86
is used for the datetime interval20160101 00:00:00 until 20160101 01:00:00
? This would mean that from the first dictionary indexed values 16 should be applied in the equation for20160101 00:00:00+01:00 23.86
, and indexed values 712 are used for dap value 22.39 and so on?datetime demand 0 20190101 00:00:00 50.038 1 20190101 00:00:10 50.021 2 20190101 00:00:20 50.013 3 20190101 00:00:30 50.004 4 20190101 00:00:40 50.004 5 20190101 00:00:50 50.009 6 20190101 00:01:00 50.012 7 20190101 00:01:10 49.998 8 20190101 00:01:20 49.983 9 20190101 00:01:30 49.979 10 20190101 00:01:40 49.983 11 20190101 00:01:50 49.983 12 20190101 00:02:00 49.983

Predict Model Reciprocal (1/x) function from Statsmodels
I have been wracking my brain at this for 2 days now and cannot seem to find any prediction model that is based off the reciprocal function. What I am trying to do is base a prediction model off the data from my pandas Dataframe. The standard ones I have tried (ex: Linear Regression) have come back with very poor results, so I graphed the data and saw that it is because the data has a (1/x) relationship, instead of being linearly correlated.
#Create a prediction model: result = smf.ols(data = temp2, formula = "n_guns_involved ~ injured_killed").fit() result.summary()
#Bad results, let's see what reciprocal function is like result2 = smf.ols(data = temp2, formula = "n_guns_involved ~ I(1/injured_killed)").fit() result2.summary()
ik_temp = pd.DataFrame({"injured_killed": np.arange(0,20.0,0.01)}) ik_temp['Linear_prediction'] = result.predict(ik_temp) ik_temp['Reciprocal_prediction'] = result2.predict(ik_temp) plt.scatter(temp2['n_guns_involved'], temp2['injured_killed']) plt.plot(ik_temp['injured_killed'], ik_temp['Linear_prediction'], color = 'red') plt.plot(ik_temp['injured_killed'], ik_temp['Reciprocal_prediction'], color = 'green')
For reference, the purple line above is the Reciprocal function (1/x) that I just plotted onto the same graph  as you can see it needs to be adjusted to fit the data and I unfortunately have not been able to do so. The red line is the "Linear" line and the "Green" line is my attempt at the reciprocal function (via result2 in the snippet above).
Please also note that I tried to use X**(1), but of course it failed.
Any and all help is greatly appreciated  Thank you!

How submit a Set attribute from a spring/thymelaf form?
I have this on my model class:
@OneToMany(fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) private Set<Autorizacao> autorizacoes;
in my html form, I try use this 2 approaches:
<div class="formgroup"> <table class="table tablestriped"> <tr th:each="autorizacao : ${autorizacoes}"> <td> <input type="checkbox" name="autorizacoes" th:value="${autorizacao.id}" class="formcheckinput"> </td> <td th:text="${autorizacao}"></td> </tr> </table> </div>
or
<div class="formgroup"> <table class="table tablestriped"> <tr th:each="autorizacao : ${autorizacoes}"> <td> <input type="checkbox" name="autorizacoes[]" th:value="${autorizacao.id}" class="formcheckinput"> </td> <td th:text="${autorizacao}"></td> </tr> </table> </div>
with the first one, the form is submited without errors, but no data is saved (only for this attribute). with the second one, the submission is not concluded (the error indicates I need a array, list or map).
what's the correct approach here?

Regression model point estimation
I'd like to retrieve the values of a second order polynomial regression line based on a list of values for a parameter.
Here is the model:
fit < lm(y ~ poly(age, 2) + height + age*height)
I would like to use a list of values for age and retrieve the value on the regression line, as well as the standard deviation and standard errors. 'age' is a continuous variable, but I want to create an array of discrete values and return the predicted values from the regression line.
Example:
age < c(10, 11, 12, 13, 14)

What kind of statistical analysis can I use to compare distance estimates in three experimental methods?
I have three data sets of distance estimates by humans in three different experimental methods such as (real life, virtual reality, and computerbased simulation). I want to compare how do humans differ in estimating distances in these three experimental methods. Which statistical analysis would be good to use for it? My dependent variable is the distance estimates and independent variable are the three different experimental conditions. Thank you.

Imputation of Missing Values by Categorical Mean?
I have a dataset with several columns, one of which is missing chunks of data that is needed.
The column with missing data, df$Variable, is always attributed to a specific person, df$Name. Is there a way to impute each person's average  rather than the entire dataset's average  whenever there is missing data in df$Variable?
I've been playing around with the imputeTS library.