smooth.surp | R Documentation |

Surprisal is -log(probability) where the logarithm is to the base being the
dimension `M`

of the multinomial observation vector. The surprisal
curves for each question are estimated by fitting the surprisal values of
binned data using curves whose values are within the `M-1`

-dimensional
surprisal subspace that is within the space of non-negative M-dimensional
vectors.

```
smooth.surp(argvals, y, Bmat0, Sfd, Zmat, wtvec=NULL, conv=1e-4,
iterlim=50, dbglev=0)
```

`argvals` |
Argument value array of length N, where N is the number of observed curve values for each curve. It is assumed that that these argument values are common to all observed curves. If this is not the case, you will need to run this function inside one or more loops, smoothing each curve separately. |

`y` |
A |

`Bmat0` |
A |

`Sfd` |
A functional data object used toinitialize the optimization process. |

`Zmat` |
An |

`wtvec` |
A vector of weights to be used in the smoothing. |

`conv` |
A convergence criterion. |

`iterlim` |
the maximum number of iterations allowed in the minimization of error sum of squares. |

`dbglev` |
Either 0, 1, or 2. This controls the amount information printed out on each iteration, with 0 implying no output, 1 intermediate output level, and 2 full output. If either level 1 or 2 is specified, it can be helpful to turn off the output buffering feature of S-PLUS. |

A named list of class `surpFd`

with these members:

`PENSSE` |
The final value of the penalized fitting criterion. |

`DPENSSE` |
The final gradient of the penalized fitting criterion. |

`D2PENSSE` |
The final hessian of the fitting criterion. |

`SSE` |
The final value of the error sum of squares. |

`DSSE` |
The final gradient of the error sum of squares. |

`D2SSE` |
The final hessian of the error sum of squares. |

`DvecSmatDvecB` |
The final cross derivative DvecSmatDvecX times DvecXmatDvecB of the surprisal curve and the basis coordinates. |

Juan Li and James Ramsay

Ramsay, J. O., Li J. and Wiberg, M. (2020) Full information optimal scoring. Journal of Educational and Behavioral Statistics, 45, 297-315.

Ramsay, J. O., Li J. and Wiberg, M. (2020) Better rating scale scores with information-based psychometrics. Psych, 2, 347-360.

`eval.surp`

,
`ICC_plot`

,
`Sbinsmth`

```
oldpar <- par(no.readonly=TRUE)
# evaluation points
x <- seq(-2,2,len=11)
# evaluate a standard normal distribution function
p <- pnorm(x)
# combine with 1-p
mnormp <- cbind(p,1-p)
M <- 2
# convert to surprisal values
mnorms <- -log2(mnormp)
# plot the surprisal values
matplot(x, mnorms, type="l", lty=c(1,1), col=c(1,1),
ylab="Surprisal (2-bits)")
# add some log-normal error
mnormdata <- exp(log(mnorms) + rnorm(11)*0.1)
# set up a b-spline basis object
nbasis <- 7
sbasis <- create.bspline.basis(c(-2,2),nbasis)
# define an initial coefficient matrix
cmat <- matrix(0,7,1)
# set up a fd object for suprisal smoothing
Sfd <- fd(cmat, sbasis)
Zmat <- matrix(c(1,-1),2,1)
# smooth the noisy data
result <- smooth.surp(x, mnormdata, cmat, Sfd, Zmat)
# plot the data and the fits of the two surprisal curves
xfine <- seq(-2,2,len=51)
sfine <- eval.surp(xfine, result$Sfd, Zmat)
matplot(xfine, sfine, type="l", lty=c(1,1), col=c(1,1))
points(x, mnormdata[,1])
points(x, mnormdata[,2])
# convert the surprisal fit values to probabilities
pfine <- 2^(-sfine)
# check that they sum to one
apply(pfine,1,sum)
par(oldpar)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.