powered by
This is a function that estimates coefficients for a linear model using Ordinary Least Squares (OLS) regression.
ols(data,y,x,alpha=0.025,verbose=TRUE)
coefficients of the linear model, or a table with the coefficients, standard errors, t-values, p-values and confidence intervals
Dataset used to estimated the coefficients
name of the dependent variable
name or a vector of names of the independent variables
confedence level
logical, if TRUE, the table will be printed
df = data.frame("hours"=c(1, 2, 4, 5, 5, 6, 6, 7, 8, 10, 11, 11, 12, 12, 14), "score"=c(64, 66, 76, 73, 74, 81, 83, 82, 80, 88, 84, 82, 91, 93, 89)) ols(df,"score","hours")
Run the code above in your browser using DataLab