Fit single factor models

sfModel(formula, data, response, factor, time, constrained = FALSE,
  save.data = TRUE, correlation = NULL)

Arguments

formula

a formula of the form y ~ factor + time

data

a data frame in which formula is evaluated

constrained

a logical indicating whether the model parameters are constrained

correlation

an optional nlme::corStruct object describing the within-group correlation structure. See the documentation of nlme::corClasses for a description of the available nlme::corStruct classes. If a grouping variable is to be used, it must be specified in the form argument to the nlme::corStruct constructor. Defaults to NULL, corresponding to uncorrelated errors.

Value

an lm object with some additional attributes

Examples

data(EconUK) sfModel(iGDP ~ iK + iYear, data = EconUK)
#> Generalized least squares fit by REML #> Model: log(iGDP) ~ iK + iYear #> Data: data #> Log-restricted-likelihood: 90.73298 #> #> Coefficients: #> (Intercept) iK iYear #> -0.07143534 0.10760947 0.01775149 #> #> Degrees of freedom: 51 total; 48 residual #> Residual standard error: 0.0318531
sfModel(response = "iGDP", factor = "iK", time = "iYear", data = EconUK)
#> Generalized least squares fit by REML #> Model: log(iGDP) ~ iK + iYear #> Data: data #> Log-restricted-likelihood: 90.73298 #> #> Coefficients: #> (Intercept) iK iYear #> -0.07143534 0.10760947 0.01775149 #> #> Degrees of freedom: 51 total; 48 residual #> Residual standard error: 0.0318531