p_slr: p-value from simple linear regression model simulation

View source: R/p_slr.R

p_slrR Documentation

p-value from simple linear regression model simulation

Description

p-values associated with the simple linear regression model, y = \beta_0 + \beta_1 X + \epsilon. Focus is on the slope/intercept behavior of the model.

Usage

p_slr(
  n,
  beta,
  sd_x,
  sd_y,
  beta0 = 0,
  test = "x = 0",
  gen_fun = gen_slr,
  return_analysis = FALSE,
  ...
)

gen_slr(n, beta, sd_x, sd_y, ...)

Arguments

n

sample size

beta

slope parameter

sd_x

standard deviation of IV

sd_y

standard deviation of DV

beta0

null value to test against

test

test to evaluate using lht. Default evaluates the null hypothesis that the slope is equal to 0

gen_fun

function used to generate the required X-Y data. Object returned must be a data.frame with the columns 'y' and 'x'. Default uses gen_slr. User defined version of this function must include the argument ...

return_analysis

logical; return the analysis object for further extraction and customization?

...

additional arguments to be passed to gen_fun. Not used unless a customized gen_fun is defined

Value

a single p-value

Author(s)

Phil Chalmers rphilip.chalmers@gmail.com

See Also

p_glm, p_lm.R2

Examples


p_slr(n=100, beta = -0.0667, sd_x = 7.5, sd_y = 4)

## Not run: 
p_slr(n=100, beta = -0.0667, sd_x = 7.5, sd_y = 4) |> Spower()

## End(Not run)


Spower documentation built on Nov. 28, 2025, 1:06 a.m.