Good ol'
. Let
be the dependent variable,
the residual,
the number of data points, and
the number of independent vars (including the constant). Returns an apop_data set with the following entries (in the vector element):
Internally allocates (and frees) a vector the size of your data set.
- Returns
- : a
apop_data table with the following fields:
- "R squared"
- "R squared adj"
- "SSE"
- "SST"
- "SSR"
If the output is in sss
, use apop_data_get(sss, .rowname="SSE")
to get the SSE, and so on for the other items.
- Parameters
-
m | A model. I use the pointer to the data set used for estimation and the info page named "<Predicted>" . The Predicted page should include observed, expected, and residual columns, which I use to generate the sums of squared errors and residuals, et cetera. All generalized linear models produce a page with this name and of this form, as do a host of other models. Nothing keeps you from finding the of, say, a kernel smooth; it is up to you to determine whether such a thing is appropriate to your given models and situation. |
apop_estimate(yourdata, apop_ols)
does this automatically
- If I don't find a Predicted page, I throw an error on the screen and return
NULL
.
- The number of observations equals the number of rows in the Predicted page
- The number of independent variables, needed only for the adjusted
, is from the number of columns in the main data set's matrix (i.e. the first page; i.e. the set of parameters if this is the parameters
output from a model estimation).
- If your data (first page again) has a
weights
vector, I will find weighted SSE, SST, and SSR (and calculate the
s using those values).