-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/gamlss-dev/gamlss2 # Conflicts: # vignettes/families.Rmd
- Loading branch information
Showing
19 changed files
with
648 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,37 @@ | ||
|
||
|
||
# gamlss2: Infrastructure for Distributional Regression | ||
# gamlss2: GAMLSS Infrastructure for Flexible Distributional Regression | ||
|
||
## Installation | ||
|
||
The development version of *gamlss2* can be installed via | ||
The development version of _gamlss2_ can be installed via | ||
|
||
``` r | ||
```{r installation, eval = FALSE} | ||
install.packages("gamlss2", | ||
repos = c("https://gamlss-dev.R-universe.dev", "https://cloud.R-project.org")) | ||
``` | ||
|
||
## Overview | ||
|
||
The primary purpose of this package is to facilitate the creation of | ||
advanced infrastructures designed to enhance the GAMLSS modeling | ||
framework. Notably, the *gamlss2* package represents a significant | ||
overhaul of its predecessor, *gamlss*, with a key emphasis on improving | ||
estimation speed and incorporating more flexible infrastructures. These | ||
enhancements enable the seamless integration of various algorithms into | ||
GAMLSS, including gradient boosting, Bayesian estimation, regression | ||
trees, and forests, fostering a more versatile and powerful modeling | ||
environment. | ||
|
||
Moreover, the package expands its compatibility by supporting all model | ||
terms from the base R *mgcv* package. Additionally, the *gamlss2* | ||
package introduces the capability to accommodate more than four | ||
parameter families. Essentially, this means that users can now specify | ||
any type of model using these new infrastructures, making the package | ||
highly flexible and accommodating to a wide range of modeling | ||
requirements. | ||
|
||
- The main model function is `gamlss2()`. | ||
- The default optimizer functions is `RS()`. Optimizer functions can | ||
be exchanged. | ||
- Most important methods: `summary()`, `plot()`, `predict()`. | ||
- Easy development of new family objects, see `?family.gamlss2`. | ||
- User-specific “special” terms are possible, see `?special_terms`. | ||
## Overview | ||
|
||
The primary purpose of this package is to facilitate the creation of advanced infrastructures | ||
designed to enhance the GAMLSS modeling framework. Notably, the _gamlss2_ package represents a | ||
significant overhaul of its predecessor, _gamlss_, with a key emphasis on improving estimation | ||
speed and incorporating more flexible infrastructures. These enhancements enable the seamless | ||
integration of various algorithms into GAMLSS, including gradient boosting, Bayesian estimation, | ||
regression trees, and forests, fostering a more versatile and powerful modeling environment. | ||
|
||
Moreover, the package expands its compatibility by supporting all model terms from the base | ||
R _mgcv_ package. Additionally, the _gamlss2_ package introduces the capability to | ||
accommodate more than four parameter families. Essentially, this means that users can now | ||
specify any type of model using these new infrastructures, making the package highly | ||
flexible and accommodating to a wide range of modeling requirements. | ||
|
||
* The main model function is `gamlss2()`. | ||
* The default optimizer functions is `RS()`. Optimizer functions can be exchanged. | ||
* Most important methods: `summary()`, `plot()`, `predict()`. | ||
* Easy development of new family objects, see `?family.gamlss2`. | ||
* User-specific "special" terms are possible, see `?special_terms`. | ||
|
||
For examples, please visit the manual pages. | ||
|
||
``` r | ||
```{r help, eval = FALSE} | ||
help(package = "gamlss2") | ||
``` |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[general] | ||
creator=R package 'raster' | ||
created=2024-09-30 08:52:19 | ||
[data] | ||
datatype=FLT4S | ||
byteorder=little | ||
nbands=1 | ||
bandorder=BIL | ||
categorical=FALSE | ||
minvalue=-33 | ||
maxvalue=1992 | ||
nodatavalue=-3.4e+38 | ||
[legend] | ||
legendtype= | ||
values= | ||
color= | ||
[description] | ||
layername=file29ba723b9492a | ||
[georeference] | ||
nrows=209 | ||
ncols=246 | ||
xmin=5.87622623088577 | ||
ymin=47.2597641144092 | ||
xmax=15.0252873245434 | ||
ymax=55.0327469134923 | ||
projection=+proj=longlat +datum=WGS84 +no_defs | ||
wkt=GEOGCRS["unknown", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]], ID["EPSG",6326]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8901]], CS[ellipsoidal,2], AXIS["longitude",east, ORDER[1], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]], AXIS["latitude",north, ORDER[2], ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]]] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
\name{Germany} | ||
\alias{Germany} | ||
|
||
\encoding{UTF-8} | ||
|
||
\title{Map of Germany} | ||
|
||
\description{ | ||
The map contains the counties of Germany. The data was originally taken from | ||
GADM (\url{https://gadm.org/}) and slightly simplified to reduce disk space. | ||
} | ||
|
||
\usage{data("storms", package = "gamlss2")} | ||
|
||
\format{ | ||
A class \code{"sf"} data frame containing 403 counties of Germany. | ||
\describe{ | ||
\item{id}{Factor, a county id.} | ||
\item{county}{Character, the county in Germany where the weather station is located.} | ||
\item{state}{Character, the state in Germany where the weather station is located.} | ||
\item{geometry}{The polygon information.} | ||
} | ||
} | ||
|
||
\source{ | ||
Map of Germany: | ||
\describe{ | ||
\item{Data Source:}{GADM} | ||
\item{Licence:}{CC BY} | ||
\item{URL:}{\url{https://gadm.org/}} | ||
\item{Coordinate Reference System:}{Longitude/latitude and the WGS84 datum.} | ||
} | ||
} | ||
|
||
\examples{\dontshow{ if(!requireNamespace("sf")) { if(interactive() || is.na(Sys.getenv("_R_CHECK_PACKAGE_NAME_", NA))) { stop("not all packages required for the example are installed") } else q() }} | ||
## load sf package for plotting | ||
library("sf") | ||
|
||
## load the data | ||
data("Germany", package = "gamlss2") | ||
|
||
## plot the map | ||
plot(st_geometry(Germany)) | ||
} | ||
|
||
\keyword{datasets} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
\name{make.link2} | ||
\alias{make.link2} | ||
|
||
\title{Create a Link for Families} | ||
|
||
\description{ | ||
This function is used with the \code{family} functions in \code{gamlss2()}. | ||
Given the name of a link, it returns a link function, an inverse | ||
link function, the derivative \eqn{d\mu/d\eta}, and a function for domain | ||
checking. Note that \code{make.link2()} is slightly more flexible and also allows | ||
functions as arguments. | ||
} | ||
|
||
\usage{ | ||
make.link2(link) | ||
} | ||
|
||
\arguments{ | ||
\item{link}{ | ||
A character string, see function \code{\link[stats]{make.link}}, or function. | ||
} | ||
} | ||
|
||
\value{ | ||
A list containing the following components: | ||
\item{linkfun}{Link function \code{function(mu)}.} | ||
\item{linkinv}{Inverse link function \code{function(eta)}.} | ||
\item{mu.eta}{Derivative \code{function(eta)}: \eqn{d\mu/d\eta}.} | ||
\item{valideta}{Function \code{function(eta)} that returns \code{TRUE} if \code{eta} is in the domain of \code{linkinv}.} | ||
\item{name}{A character string representing the name of the link function.} | ||
} | ||
|
||
\seealso{ | ||
\code{\link[stats]{make.link}}, \code{\link{gamlss2}}, \code{\link{gamlss2.family}}. | ||
} | ||
|
||
\examples{ | ||
## character specification | ||
utils::str(make.link2("logit")) | ||
|
||
## functions | ||
utils::str(make.link2(softplus)) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
\name{storms} | ||
\alias{storms} | ||
|
||
\encoding{UTF-8} | ||
|
||
\title{Severe Storms in Germany} | ||
|
||
\description{ | ||
According to the Beaufort scale, severe storms occur from a wind speed of 24.5-28.4 m/s. | ||
This dataset contains annual severe storm counts from weather stations in Germany | ||
from 1981 to 2021. | ||
} | ||
|
||
\usage{data("storms", package = "gamlss2")} | ||
|
||
\format{ | ||
A data frame containing 3494 observations on 8 variables. | ||
\describe{ | ||
\item{id}{Factor, the weather station id.} | ||
\item{county}{Character, the county in Germany where the weather station is located.} | ||
\item{state}{Character, the state in Germany where the weather station is located.} | ||
\item{year}{Integer, the year the observation was measured.} | ||
\item{counts}{Integer, the number of severe storms in this year.} | ||
\item{alt}{Numeric, the altitude in meters above sea level of the weather station.} | ||
\item{lon}{Numeric, the longitude coordinate of the weather station.} | ||
\item{lat}{Numeric, the latitude coordinate of the weather station.} | ||
} | ||
} | ||
|
||
\source{ | ||
Severe Storms Data: | ||
\describe{ | ||
\item{Data Source:}{Deutscher Wetterdienst (DWD), Climate Data Center (CDC).} | ||
\item{Licence:}{CC BY 4.0} | ||
\item{URL:}{\url{https://opendata.dwd.de/climate_environment/CDC/}} | ||
\item{Coordinate Reference System:}{Longitude/latitude and the WGS84 datum.} | ||
} | ||
} | ||
|
||
\examples{ | ||
## load the data | ||
data("storms", package = "gamlss2") | ||
|
||
## yearly observations | ||
plot(counts ~ year, data = storms) | ||
|
||
## count distribution | ||
barplot(table(storms$counts)) | ||
|
||
## NBI model | ||
## model formula including spatial effect | ||
\dontrun{f <- counts ~ s(year) + s(alt) + s(lon, lat) | | ||
s(year) + s(alt) + s(lon, lat) | ||
|
||
## estimate model | ||
b <- gamlss2(f, data = storms, family = NBI) | ||
|
||
## estimated effects | ||
plot(b) | ||
|
||
## residual diagnostics | ||
plot(b, which = "resid") | ||
}} | ||
|
||
\keyword{datasets} | ||
|
Oops, something went wrong.