R commands Flashcards Preview

MAS223 > R commands > Flashcards

Flashcards in R commands Deck (12):
1

How to calculate the RSS of some data given a linear model

deviance(modelName)

2

How to get the residual degree of freedom given a linear model

df.residual(modelName)

3

How to get specific confidence intervals for a linear model's parameters.

confint(linear_model_name)

you can specify the confidence intervals with the parameter "level="

e.g. confint(lin_model, level=0.99) = a 99% confidence interval for the linear model.

The result will look something like this:

(Intercept) -3.650418e+02 113.23450112
machine.diff 6.465675e-03 0.01894124

4

How to interpret this part of the summary command

Coefficients:
Estimate Std. Error t value Pr(>t)
(Intercept) -125.90364 114.25485 -1.102 0.284245
machine.diff 0.01270 0.00298 4.263 0.000421 ***

The Estimate column is the estimated values for β0 and β1

The Std. Error is the standard error in these estimations

5

How can you form confidence intervals for β0 and β1 from a summary command

β0= the value in the intercept row, estimate column
β1 = the value in the machine.dff row, estimate column

write these values and ± the value in the Std. Error column with the corresponding row multiplied by the t-distribution with ± T(n−2;1−δ/2).

6

How to get estimated standard residuals from a model

stdres(model_name)

7

How to perform a Kolmogorov-Smirnov test

ks.test(evals,function,function_parameters)
e.g.
ks.test(evals,"pnorm",0,1)

8

How to plot a linear model of two data points. eg weight and height.

lm(weight~height,data=measurements)

9

How to perform an F-test automatically

anova(lmreduced, lmfull)

10

With an F value of 0.02, do we reject the null hypothesis?

0.02 < 0.05 so we do reject the null hypothesis

11

With an F value of 0,34 do we reject the null hypothesis?

0.34 > 0.05 so we do not reject the null hypothesis

12

turning a vector into an ANOVA

first create a new vector that is made by factoring the values of your initial vector with the class labels so the classes line up with the data points, then form a data frame from these two vectors