Displaying 3 results from an estimated 3 matches for "stdresiduals".
2018 Feb 23
2
How to Save the residuals of an LM object greater or less than a certin value to an R object?
...linear regression, and now I want
to find out which cases have a residual of above + 2.5 and ? 2.5.
Below I provide the R commands I have used.
Reg<-lm(a~b+c+d+e+f) # perform multiple regression with a as the
dependent variable.
Residuals<-residuals(reg) # store residuals to an R object.
stdresiduals<-rstandard(reg) #save the standardized residuals.
#now I want to type a command that will save the residuals of
certain range to an object.
I realize that by plotting the data I can quickly see the residuals
outside a certain boundtry, however, I am totally blind, so visually
inspecting th...
2018 Feb 23
0
How to Save the residuals of an LM object greater or less than a certin value to an R object?
Residuals are stored as a numeric vector. The R software comes with a document "Introduction to R" that discusses basic math functions and logical operators that can create logical vectors:
abs( stdresiduals ) > 2.5
It also discusses indexing using logical vectors:
stdresiduals[ abs( stdresiduals ) > 2.5 ]
Note that in most cases it is worth going the extra step of making your example reproducible [1][2][3] because many problems arise from issues in the data or in code that you don't thin...
2018 Feb 25
0
How to Save the residuals of an LM object greater or less than a certin value to an R object?
...e:
my_res[my_res >= 0.1]
About your second question, I don't entirely understand what you want. The
"which()" function returns the indexes for which the condition is TRUE. In
this case, that the absolute value is greater than 2.5.
Alberto Garre
> Also,
>
> which( abs( stdresiduals ) > 2.5 )
>
> will tell you which of the standardized residuals are bigger than 2.5 in
absolute value. It returns a vector of indices, as in
>
> > set.seed(1234)
> > x <- rnorm(100)
> > which (abs(x) > 2.5)
> [1] 62
> > x[62]
> [1] 2.548991
>
>...