bias.rmse: compute bias and RMSE

Description Usage Arguments Value Warning Author(s) Examples

Description

compute bias and RMSE

Usage

1
bias.rmse ( true , est , id.col , val.col , repl.col = NULL , group.col = NULL , method = c ( "group" , "repl" ) , verbose = FALSE )

Arguments

true

data frame with true parameters

est

data frame with estimated parameters

id.col

name of id column (must be equal in both data frames)

val.col

name of value column (must be equal in both data frames)

repl.col

name of replication column (in est)

group.col

name of group columns (must be equal in both data frames)

method

either "group" (aggregation over groups) or "repl" (aggregation over replications)

verbose

logical, print information while processing

Value

returns a data frame

Warning

This version is beta. Use with care.

Author(s)

Martin Hecht

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
### Example 1, no replicates
true <- data.frame ( "variable" = c ("item1","item2") ,
					 "value" = c ( 1 , 2 ) ,
					 "group" = rep ( "items" , 2 ) , 
					 stringsAsFactors = FALSE )
est <-  data.frame ( "variable" = c ("item1","item2") ,
					 "value" = rnorm ( 2 , 1 , 1 ) ,
					 stringsAsFactors = FALSE )
bias.rmse ( true , est , id.col = "variable" , val.col = "value" , group.col = "group" , verbose = TRUE )	


### Example 2, additionally 2 replicates
true <- data.frame ( "variable" = c ("item1","item2") ,
					 "value" = c ( 1 , 2 ) ,
					 "group" = rep ( "items" , 2 ) , 
					 stringsAsFactors = FALSE )
est <-  data.frame ( "variable" = c ("item1","item1","item2","item2") ,
					 "value" = rnorm ( 4 , 1 , 1 ) ,
					 "replicates" = c ( 1 , 2 , 1 , 2 ) , 					 
					 stringsAsFactors = FALSE )

bias.rmse ( true , est , id.col = "variable" , val.col = "value" , group.col = "group" , repl.col = "replicates" , method = "group" , verbose = TRUE)		 
bias.rmse ( true , est , id.col = "variable" , val.col = "value" , group.col = "group" , repl.col = "replicates" , method = "repl" , verbose = TRUE)		 
bias.rmse ( true , est , id.col = "variable" , val.col = "value" , group.col = "group" , repl.col = "replicates" , verbose = TRUE)		 

					 
### Example 3, additionally 2 data conditions
true <- data.frame ( "variable" = rep ( c ("item1","item2") , 2 ) ,
					 "value" = 1:4 ,
					 "group" = rep ( rep ( "items" , 2 ) , 2 ) , 
					 "data.cond" = c ( rep ( 1 , 2 ) , rep ( 2 , 2 ) ) ,
					 stringsAsFactors = FALSE )
est <-  data.frame ( "variable" = rep ( c ("item1","item1","item2","item2") , 2 ) ,
					 "value" = rnorm ( 8 , 1 , 1 ) ,
					 "replicates" = rep ( c ( 1 , 2 , 1 , 2 ) ) , 
					 "data.cond" = c ( rep ( 1 , 4 ) , rep ( 2 , 4 ) ) ,
					 stringsAsFactors = FALSE )
bias.rmse ( true , est , id.col = "variable" , val.col = "value" , group.col = "group" , repl.col = "replicates" , verbose = TRUE )		 
	
	
### Example 4, 2 models
true <- data.frame ( "variable" = c ("item1","item2") ,
					 "value" = c ( 1 , 2 ) ,
					 "group" = rep ( "items" , 2 ) , 
					 stringsAsFactors = FALSE )
est <-  data.frame ( "variable" = rep ( c ("item1","item1","item2","item2") , 2 ),
					 "value" = rnorm ( 8 , 1 , 1 ) ,
					 "replicates" = rep ( c ( 1 , 2 , 1 , 2 ) ) , 
					 "model" = c ( rep ( "m1" , 4 ) , rep ( "m2" , 4 ) ) ,
					 stringsAsFactors = FALSE )
bias.rmse ( true , est , id.col = "variable" , val.col = "value" , group.col = "group" , repl.col = "replicates" , verbose = TRUE )		 


### Example 5, 2 data conditions and 2 models
true <- data.frame ( "variable" = rep ( c ("item1","item2") , 2 ) ,
					 "value" = 1:4 ,
					 "group" = rep ( rep ( "items" , 2 ) , 2 ) , 
					 "data.cond" = c ( rep ( 1 , 2 ) , rep ( 2 , 2 ) ) ,
					 stringsAsFactors = FALSE )
est <-  data.frame ( "variable" = rep ( rep ( c ("item1","item1","item2","item2") , 2 ) , 2 ),
					 "data.cond" = rep ( c ( rep ( 1 , 4 ) , rep ( 2 , 4 ) ) , 2 ) ,
					 "value" = rnorm ( 16 , 1 , 1 ) ,
					 "replicates" = rep ( rep ( c ( 1 , 2 , 1 , 2 ) ) , 2 ) , 
					 "model" = c ( rep ( "m1" , 8 ) , rep ( "m2" , 8 ) ) ,
					 stringsAsFactors = FALSE )
bias.rmse ( true , est , id.col = "variable" , val.col = "value" , group.col = "group" , repl.col = "replicates" , verbose = TRUE )


### Example 6, multiple groups
true <- data.frame ( "variable" = c ("item1","item2","person1","person2","randeff1") ,
					 "value" = 1:5 ,
					 "group" = c ( rep ( "items" , 2 ) , rep ( "persons" , 2 ) , NA ) , 
					 stringsAsFactors = FALSE )
est <-  data.frame ( "variable" = c ("item1","item2","person1","person2","randeff1") ,
					 "value" = rnorm ( 5 , 1 , 1 ) ,
					 stringsAsFactors = FALSE )
bias.rmse ( true , est , id.col = "variable" , val.col = "value" , group.col = "group" , verbose = TRUE )	

eatDev documentation built on May 2, 2019, 5:56 p.m.

Related to bias.rmse in eatDev...