toolRegression: toolRegression

View source: R/toolRegression.R

toolRegressionR Documentation

toolRegression

Description

Regression model for the correlation of a denominator and quotient to the GDP, allowing for an additional driver z next to income.

Usage

toolRegression(
  denominator,
  quotient = NULL,
  func = y ~ (a * x)/(b + x),
  x = "IHME_USD05_PPP_pc",
  z = NULL,
  ylab = NULL,
  xlab = NULL,
  data = NULL,
  countries_nlsAddLines = NULL,
  weight = "pop",
  x_log10 = FALSE,
  crossvalid_sample = NULL,
  crossvalid_drawing = 1,
  ...
)

Arguments

denominator

denominator of the dependent variable that shall be estimated using the regression

quotient

quotient of the dependent variable that shall be estimated using the regression

func

functional relation for the regression, shall be in the format y~f(x,...) with x being gdp, y being denominator/quotient, and f() being any type of functional relationship. ... can inlcude either z or parameters to be estimated.

x

independet variable, by default income

z

additional independet variable

ylab

name of y axis

xlab

name of x axis

data

data can be provided if Data shall not be derived by mrcommons:::calcCollectFoodDemandRegressionData()

countries_nlsAddLines

the number of weightiest countries or the name of countries that shall be plotted by lines in the plot

weight

the weight

x_log10

passed on to nlsregression()

crossvalid_sample

sample name from madrat used for crossvalidation. Name is built as follows: crossvalid_seedX_kY X is the random seed, Y is the number of drawings. The combination of all drawings is the full sample.

crossvalid_drawing

selected drawing of k in crossvalidsample

...

further attributes that will be handed on to nlsregression():

An additional explanatory variable z can be added. A regression model has to be chosen. Startvalues can be predetermained.

Value

regression plot and the parameters from nlsregression

Author(s)

Antonia Walther, Benjamin Leon Bodirsky

See Also

calcOutput

Examples


## Not run:  

toolRegression(denominator=livestock,
                     func=y~(a*x)/(b+x),
                     z=NULL,
                     startvalues=list(a=1100,b=7770)
                     )
                     
toolRegression(denominator=findset("kap"),
                     quotient=findset("kfo"),
                     func=y~(a*x)/(b+x),
                     z=NULL,
                     startvalues=list(a=0.5,b=7770)
                     )
                     

## End(Not run)

pik-piam/regressionworlddata documentation built on June 6, 2024, 11:08 p.m.