sety: Set y-Values

Description Usage Arguments Details Note Examples

Description

Reset the response values in the C++ object.

Usage

1
2
## S4 method for signature 'Cpp_Clmbr'
sety( rWy )

Arguments

rWy

vector of 'y' values, pre-multiplied by the square-root of 'weights'.

Details

The 'rWy' vector is simply the y-vector if the model does not specify weights. The square-root of a vector 'W' is the vector 'rW' of the square-roots of the elements of 'W'. The square-root of a matrix 'W' here is the matrix 'rW' such that rW*rW = W (a stricter definition than rW*transpose(rW) = W).

Note

The pre-multiplied vector is more convenient as input during simulation tests. 'sety' changes the y-values only for the accessor functions 'sl', 'ci', 'cr' and 'mle'. 'rW' is the inverse square-root if 'inverse' was TRUE in the 'lm.br' call.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#  A simulation test
x <- c( 1.0, 1.1, 1.3, 1.7, 2.4, 3.9, 5.7, 7.6, 8.4, 8.6 )
y <- x
LLmodel <- lm.br( y ~ x )    
countCLR <- countAF <- 0
theta <- 3
for( i in 1:10000 )  {
  y <- 0 + (-1.)*pmin(x-theta,0) + (0.5)*pmax(x-theta,0) + rnorm(10)
  LLmodel$sety( y )
  stest <- LLmodel$sl( theta, 'clr', .0001, "V" )
  if( stest > 0.05 )  countCLR <- countCLR + 1
  stest <- LLmodel$sl( theta, 'af', .0001, "V" )
  if( stest > 0.05 )  countAF <- countAF + 1
  if( floor(i/1000) - i/1000 == 0 ) cat(i, countCLR/i, countAF/i, "\n")
}

Example output

Loading required package: Rcpp
 lm.br  version 2.9.3,  '?lm.br' starts help
1000 0.963 0.907 
2000 0.9645 0.9175 
3000 0.9616667 0.9146667 
4000 0.96 0.91275 
5000 0.9582 0.9106 
6000 0.9553333 0.9095 
7000 0.9558571 0.9102857 
8000 0.955625 0.911 
9000 0.9555556 0.9108889 
10000 0.9546 0.9104 

lm.br documentation built on May 2, 2019, 9:59 a.m.

Related to sety in lm.br...