fitted.femlm {FENmlm} | R Documentation |
This function extracts the fitted values from a model estimated with femlm
. The fitted values that are returned are the expected predictor.
## S3 method for class 'femlm' fitted(object, type = c("response", "link"), ...) ## S3 method for class 'values.femlm' fitted(object, type = c("response", "link"), ...)
object |
An object of class |
type |
Character either equal to |
... |
Not currently used. |
This function returns the expected predictor of a femlm
fit. The likelihood functions are detailed in femlm
help page.
It returns a numeric vector of length the number of observations used to estimate the model.
If type = "response"
, the value returned is the expected predictor, i.e. the expected value of the dependent variable for the fitted model: E(Y|X).
If type = "link"
, the value returned is the linear predictor of the fitted model, that is X\cdot β (remind that E(Y|X) = f(X\cdot β)).
Laurent Berge
femlm
, resid.femlm
, predict.femlm
, summary.femlm
, vcov.femlm
, getFE
.
# simple estimation on iris data, clustering by "Species" res_poisson = femlm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width | Species, iris) # we extract the fitted values y_fitted_poisson = fitted(res_poisson) # Same estimation but in OLS (Gaussian family) res_gaussian = femlm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width | Species, iris, family = "gaussian") y_fitted_gaussian = fitted(res_gaussian) # comparison of the fit for the two families plot(iris$Sepal.Length, y_fitted_poisson) points(iris$Sepal.Length, y_fitted_gaussian, col = 2, pch = 2)