- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I feel like I am missing a small thing probably. But, I have been doing Proc T tests for a set of data. But can anyone help me set up the top portion if I do not have a set of data but instead i am given the sample size, mean and variance. Is anyone able to help me figure out what I need do to in place of the data lines and or cards?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So someone tells you the N (sample size), mean and variance, and you want to test if the mean is zero??? Is this a one-sample test or a two-sample test? You don't tell us.
If so, then you can do this with a calculator, the formula is here: https://en.wikipedia.org/wiki/Student%27s_t-test#One-sample_t-test. I don't think you can do this in PROC TTEST.
Or you can program that formula into a SAS data step, and also use the SAS function CDF('T', t, df [, nc]) to replace looking up the probability in a statistical table.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@KB131619 wrote:
No there is no 0.
I'm afraid this doesn't really explain anything. Are you doing one-sample or two-sample t-tests? If you don't want to compare to zero, what do you want to compare to?
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Well, you could simulate some data based on your parameters and then run TTEST on that -- just showing PROC MEANS here to demonstrate that we have two groups with the mean and standard deviation that we expect. If you have unequal variances (which the below assumes), then be sure to select the correct options in PROC TTEST.
%let SAMPLESIZE_A=1000;
%let MEAN_A=40;
%let VARIANCE_A=16;
%let SAMPLESIZE_B=1500;
%let MEAN_B=35;
%let VARIANCE_B=25;
data sim;
group='A';
do i=1 to &SAMPLESIZE_A;
x=&MEAN_A+rand('normal')*sqrt(&VARIANCE_A);
output;
end;
group='B';
do i=1 to &SAMPLESIZE_B;
x=&MEAN_B+rand('normal')*sqrt(&VARIANCE_B);
output;
end;
run;
proc means data=sim mean std;
class group;
var x;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Documentation is always your good friend . Check its example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you can run PROC TTEST when you have only the summary statistics and not the raw data. See
"Summary statistics and t tests in SAS"