gapminder_lmfit: Model pop/lifeExp/gdpPercap VS year for countries in...

Description Usage Arguments Value Examples

Description

gapminder_lmfit is used to fit linear models to pop/lifeExp/gdpPercap and year for a specific country in gapminder dataset. It can be used to carry out regression between pop/lifeExp/gdpPercap and year, then it will return the coefficients, residuals and fitError(=sum of residuals^2) of fitted linear model back at the same time.

Usage

1
gapminder_lmfit(countryName, x = "year", y = "pop", offset = 1952)

Arguments

countryName

character this should be the name of country that you want to explore in gapminder dataset.

x

character this should be variable "year" here.

y

character this could be one of the three variables(pop/lifeExp/gdpPercap) in gapminder dataset. Default value of y is "pop".

offset

this can be used to specify an a priori known component to be included in the linear predictor during fitting. In this function, the default value of offset is 1952, because we think it makes more sense for the intercept to correspond to pop/lifeExp/gdpPercap in 1952, the earliest date in gapminder dataset.

Value

list

Examples

1
2
3
library(gapminder)
gapminder_lmfit("Canada")
gapminder_lmfit("Canada","year","lifeExp")

LinaQiu/GapminderPackage documentation built on May 8, 2019, 11:52 p.m.