fit.glm {MetGen} | R Documentation |
Fitting Generalized Linear Models
Description
fit.glm is used to fit generalized linear models, taking account of covariates specified in the argument list
Usage
fit.glm(var.name, dep.var=NULL, geocov=TRUE, large.var, seasonal = TRUE,
speriod = 365.25, diurnal = TRUE, dperiod = 24, spatave=TRUE, lagspat,
movave = TRUE, bwM = 48, lagmov, spatmovave= TRUE, bwSM = 48, lagspatmov,
lagvar, add.cov= FALSE, others=NULL, fam.glm = "gaussian", data)
Arguments
var.name |
character that forms the name of the climatic variable to be fitted |
dep.var |
character that forms the name of depending variables |
geocov |
logical value indicating whether geographical information is part of covariates set |
large.var |
character object that forms the name of the large scale variable |
seasonal |
logical value indicating whether seasonal effects are among the covariates defined for the variable that will be fitted |
speriod |
A numeric vector that contains the lenght of seasonal cycles defined for the variable of interest |
diurnal |
logical value indicating whether diurnal effects are among the covariates defined for the variable that will be fitted |
dperiod |
A numeric vector that contain the lenght of diurnal cycles defined for the variable of interest |
spatave |
logical value indicating whether spatial average effects are among the covariates defined for the variable that will be fitted |
lagspat |
Numeric vector indicating values of lags performed for the spatial average |
movave |
logical value indicating whether moving average effects are among the covariates defined for the variable that will be fitted |
bwM |
A numeric vector that contains the bandwidth defined for the moving average |
lagmov |
Numeric vector indicating values of lags performed for the moving average |
spatmovave |
logical value indicating whether spatial moving average effects are among the covariates defined for the variable that will be fitted |
bwSM |
A numeric vector that contains the bandwidth defined for the spatial moving average |
lagspatmov |
Numeric vector indicating values of lags performed for the spatial moving average |
lagvar |
Numeric vector indicating values of lags performed for the variable |
add.cov |
logical value indicatng whether we have an additional covariates defined for the variable to fit |
others |
character that forms the name of additional covariates specified for the variable to fit |
fam.glm |
family objects to specify probability distribution that will be used for the simulation mode ("gaussian", "gaussian-hetero", "binomial" or "Gamma") |
data |
data frame that contains a variable named "dates" in chron format, possibly including times, geographical information for the measurement site, climatic variable to be fitted and all different covariates that will be used to fit the variable of interest |
Value
value returned is a variable fitted which inherits from the class "lm"
See Also
diurnal.effect
, seasonal.effect
, lagged.effect
Examples
##Create a new data that contains climatic series and all effects that will be
##used as covariates for the variable to fit
mat_effects <- seasonal.effect(myclimatic_data, period=c(365,183))
mat_effects <- diurnal.effect(mat_effects, period=24)
mat_effects <- lagged.effect(mat_effects, "temp",2, nstat=3)
##Add a large scale variable
mat_effects$t2m <- rnorm(nrow(myclimatic_data), mean=25, sd=1)
temp_fitted <- fit.glm("temp", dep.var = "Rh", geocov=TRUE, large.var="t2m",
seasonal = TRUE, speriod = c(365, 183), diurnal = TRUE, dperiod = 24,
spatave = FALSE, movave = FALSE, spatmovave= FALSE, add.cov = FALSE, others = NULL,
lagvar=2, fam.glm = "gaussian", data=mat_effects)