SAS Proc TTest - Difference from fixed value - sas

How do I test if a variable is significantly different from the value 15?
What value does the test need to be greater than for a confidence level of 95% that is it different (i.e 5% opportunity the average is 15?)

To specify a null value to test against look at the H0 option. For the 5%, I assume is the alpha level. If your test is two sided then the default side option is fine, otherwise set that value to 1.
Proc ttest data=sashelp.class h0=15 alpha=0.05 sides=2;
Var age;
Run;
All of these options are detailed in the documentation. The value used for comparison against the test statistic varies based on the sample size.
https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_ttest_sect002.htm
UCLA offers a detailed walk through of Proc Ttest
http://www.ats.ucla.edu/stat/sas/output/ttest.htm

Related

Getting Chi-Square statistics in proc surveylogistic

per Default proc surveylogistic displays an F test in the "testing the null hypothesis /beta = 0 " output. Can I somehow change that to a Chi-Square Test?
Usually I use proc logistics but this time I have a cluster variable and to my knowledge proc logistic cant handle those.
In the documentation I read the F and Chi-Square test are equivallent but I get different results for the significance tests (although the point estimates for intercept and my independent variable are the same) to proc logistic for the same analysis.
I also tried using the df=infinity option but the name just changes the value stays the same.
Regards

Test the hypothesis that the means are equal. Use PROC MEANS to generate descriptive statistics for the four groups

Consider an experiment to study four types of fertilizer, labeled 1, 2, 3, and 4. One fertilizer is chemical and the rest are organic. You want to see whether the average weights of the garlic bulbs are significantly different for plants in beds that use different fertilizers.
Test the hypothesis that the means are equal. Use PROC MEANS to generate descriptive statistics for the four groups, and use PROC SGPLOT to produce box plots of bulb weight for the four groups. Submit the code and view the results?
proc means data=dataset;
var BulbWt;
class Fertilizer;
run;
proc sgplot data=dataset;
vbox BulbWt / category=Fertilizer
connect=mean;
run;

Detailed of predictions on proc logistic

I am implementing a logit model in a database of households using as dependent variable the classification of poor or not poor household (1 if it is poor, 0 if it is not):
proc logistic data=regression;
model poor(event="1") = variable1 variable2 variable3 variable4;
run;
Using the proc logistic in SAS, I obtained the table "Association of predicted probabilities and observed responses" that allows me to know the concordant percentage. However, I require detailed information of how many households are classified poor adequately, in this way:
I will appreciate your help with this issue.
Add the CTABLE option to your MODEL statement.
model poor(event="1") = variable1 variable2 variable3 variable4 / ctable;
CTABLE classifies the input binary response observations according to
whether the predicted event probabilities are above or below some
cutpoint value z in the range . An observation is predicted as an
event if the predicted event probability exceeds or equals z. You can
supply a list of cutpoints other than the default list by specifying
the PPROB= option. Also, you can compute positive and negative
predictive values as posterior probabilities by using Bayes’ theorem.
You can use the PEVENT= option to specify prior probabilities for
computing these statistics. The CTABLE option is ignored if the data
have more than two response levels. This option is not available with
the STRATA statement.
For more information, see the section Classification Table.

How to compute the effect size for Friedman's test using sas?

I was looking for a way to compute the effect size for Friedman's test using sas, but could not find any reference. I wanted to see if there is any difference between the groups and what its size was.
Here is my code:
proc freq data=mydata;
tables id*b*y / cmh2 scores=rank noprint;
run;
These are the results:
The FREQ Procedure
Summary Statistics for b by y
Controlling for id
Cochran-Mantel-Haenszel Statistics (Based on Rank Scores)
Statistic Alternative Hypothesis DF Value Prob
1 Nonzero Correlation 1 230.7145 <.0001
2 Row Mean Scores Differ 1 230.7145 <.0001
This question is correlated with the one posted on Cross Validated, that is concerned with the general statistical formula to compute the effect size for Friedman's test. Here, I would like to find out how to get the effect size in sas.

SAS proc ttest modify HO

I have a data with GENDER=(1/0) INCOME SENIORITY=(1/0). I need to run a ttest on INCOME by GENDER for SENIORITY=1.
As far as I know, the default of HO=0, which means that there is no difference between the genders, but how can I define an HO that will check if mu of female(gender=1) is =higher= than mu of male(gender=0).
this is my basic code:
proc ttest data=l;
var INCOME;
class gender;
where SENIORITY=1;
run;
This becomes a one sided test, so you use the one tailed p-value. Please see the free SAS training course via SAS University Home Page that has the first statistical course, https://communities.sas.com/community/sas-analytics-u, see the training widget on the left handd side of the page.
If you have a SAS Communities ID and are logged in this link would take you directly to the page.
http://support.sas.com/ecst1
The sides option only affect the CI, the one tailed p-value is the same. The directionality is dependent on how you set up your hypothesis.
SIDES=L
specifies lower one-sided tests, in which the alternative hypothesis indicates a mean less than the null value, and lower
one-sided confidence intervals between minus infinity and the upper
confidence limit.
SIDES=U
specifies upper one-sided tests, in which the alternative hypothesis indicates a mean greater than the null value, and upper
one-sided confidence intervals between the lower confidence limit and
infinity.