Description Usage Arguments Format Value Examples
It returns a table of beta coefficients, standard error, t value, and p value as variables, and predictors as observations. It also prints out confidence intervals and descriptive univariate statistics.
1 | linear_regression(predictor, outcome)
|
predictor |
the predictor variables, can consist of multiple variables. It has to be in nxm matrix format |
outcome |
the outcome variables. It has to be in nx1 matrix format |
A sample health dataset is included and loaded automatically when loading the package
death rate, per 1,000 population
number of doctors, per 100,000 population
number of hospital, per 100,000 population
annual per capita income, in thousands of $
population density per square mile
returns a table of beta, SE, t value, p value of the linear regression
1 2 3 4 5 6 7 8 9 10 11 12 13 | Y = matrix(c(5.6, 7.9, 10.8), ncol=1)
X = matrix(c(1, 2, 3), ncol=1)
linear_regression(X, Y)
Y = matrix(c(1714,1664,1760,1685,1693,1670,1764,1764,1792,1850,1735,1775),
ncol=1)
X = matrix(c(2.4,2.52,2.54,2.74,2.83,2.91,3,3,3.01,3.01,3.02,3.07), ncol=1)
linear_regression(X, Y)
Y = mydata$death_rate
X = cbind(mydata$doctor_num, mydata$hos_num, mydata$capita_nuuanl_income,
mydata$population_den)
linear_regression(X, Y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.