Extract Standard Errors from a Model Fit
Source:R/all_generic.R, R/fmri_latent_lm.R, R/fmri_lm_methods.R
standard_error.RdExtract standard errors of parameter estimates from a fitted model object. This is part of a family of functions for extracting statistical measures.
Arguments
- x
The fitted model object
- ...
Additional arguments passed to methods
- type
For
fmri_lmfits, the parameter family:"betas"(default) for the event coefficients returned bycoef(), or"contrasts"."estimates"is accepted as a synonym of"betas".- recon
Logical; whether to reconstruct the full matrix representation (default: FALSE)
Value
A tibble or matrix containing standard errors of parameter
estimates. For fmri_lm fits, one row per voxel and one column per
term, in the same orientation as coef().
See also
Other statistical_measures:
coef_names(),
p_values(),
stats()
Examples
# Create example data
event_data <- data.frame(
condition = factor(c("A", "B", "A", "B")),
onsets = c(1, 10, 20, 30),
run = c(1, 1, 1, 1)
)
# Create sampling frame and dataset
sframe <- sampling_frame(blocklens = 50, TR = 2)
dset <- matrix_frame(
matrix(rnorm(50 * 2), 50, 2),
TR = 2,
run_length = 50,
event_table = event_data
)
# Fit model
fit <- fmri_lm(
onsets ~ hrf(condition),
block = ~run,
dataset = dset
)
# Extract standard errors
se <- standard_error(fit)