0

I have data the looks like the following:

set.seed(42)
M <- matrix(rnorm(40),ncol=2)
M <- as.data.frame(M)

M2 <- reshape(data=M, varying=list(1:2), 
        direction="long", 
        times = names(M), 
        timevar="A",
        v.names="B")

and I do a linear regression:

M2.lm = lm(B~A, data=M2)
summary(M2.lm)

which gives me the following output:

Call:
lm(formula = B ~ A, data = M2)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.84838 -0.48550 -0.01096  0.82592  2.16619 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)   0.1919     0.2718   0.706    0.484
AV2          -0.4629     0.3843  -1.204    0.236

Residual standard error: 1.215 on 38 degrees of freedom
Multiple R-squared:  0.03677,   Adjusted R-squared:  0.01142 
F-statistic: 1.451 on 1 and 38 DF,  p-value: 0.2359

I would like to do a power analysis using the following:

pwr.f2.test(u = , v = , f2 = ., sig.level = .05, power = NULL)

But I do not know how to find u, v and f2 from the output.

Icewaffle
  • 1
  • 1
  • 1
    u and v are the degrees of freedom for the F test. They are not something you would find from the output -- that makes it sound like you're doing a post hoc test which is not appropriate. Rather, these are quantities you should know prior to conducting the regression. – Demetri Pananos Feb 14 '21 at 04:31
  • I am doing a post-hoc power test. In this case, u and v would then be 1 and 38? and f2? – Icewaffle Feb 14 '21 at 14:53
  • 1
    do not do a post hoc calculation of power. [As I mention here and elsewhere](https://stats.stackexchange.com/questions/446641/post-hoc-power-analysis-on-secondary-data-using-binary-logistic-regression/446643#446643) it is meaningless. See also [this](https://stats.stackexchange.com/a/476443/111259) answer. – Demetri Pananos Feb 14 '21 at 17:27
  • Yes I have seen these posts. I am doing this as an exercise to familiarize myself with the different 'components'. Surely u, v and f2 corresponds to some 'parts' of the regression, but which? – Icewaffle Feb 14 '21 at 18:37
  • 1
    Have you read the documentation for the function you want to use? The answer to your question can be found there. – Demetri Pananos Feb 14 '21 at 18:43
  • Yes, but I am not sure I am reading it right. Would it be u = 1, v = 38, f2 = -0.4629? – Icewaffle Feb 14 '21 at 23:35

0 Answers0