The code I am using is as follows:
ods html close;
ods html;
data petrol2;
infile 'M:\Dissertation\Raw Data\split2forecast.csv' delimiter=',';
input date $ price;
run;
proc arima data=petrol2;
identify var=price(1);
estimate p=2 q=1 method=ml;
forecast lead=3;
run;
I need to calculate the MSE and Bias from my time series but cannot figure out what to do, help greatly appreciated. Thanks
MSE can be calculated using PROC MODEL:
How to get MSE of ARIMA model in SAS?
MSE has a relationship with bias that you can calculate. MSE is exactly equal to:
Using the output from PROC MODEL and the MSE-Bias relationship, you can calculate the bias of your estimators.
Related
I am looking to have SAS calculated the predicted R-squared value using PROC REG.
You mean the R-Square? It's very easy to get.
ods output FitStatistics = FitStatistics;
proc reg data = sashelp.class;
model height = age;
quit;
ods output close;
The R-Square is located at data set FitStatistics.
I'm working on a project and have run into an expected issue. After running PROC LOGISTIC on my data, I noticed that a few of the odds ratios and regression coefficients seemed to be the inverse of what they should be. After some investigation using PROC FREQ to run the odds ratios, I believe there is some form of error with the odds ratios from PROC LOGISTIC.
The example below is of the response variable "MonthStay" and one of the variables in question "KennelCough". MonthStay = Y and the event of interest is KennelCough = N.
I don't know how to remedy this suspected error. Am I missing something in my code to get the correct calculations? Or am I totally misunderstanding what's going on? Thanks!
Here is the PROC FREQ code and result:
proc freq data = capstone.adopts_dog order = freq;
tables KennelCough*MonthStay / relrisk;
run;
Here is the PROC LOGISTIC CODE and results:
proc logistic data = capstone.adopts_dog plots(only)=(roc(id=prob) effect);
class Breed(ref='Chihuahua') Gender(ref='Female')
Color(ref='Black') Source(ref='Stray') EvalCat(ref='TR') SNAtIn(ref='No')
FoodAggro(ref='Y') AnimalAggro(ref='Y') KennelCough(ref='Y') Dental(ref='Y')
Fearful(ref='Y') Handling(ref='Y') UnderAge(ref='Y') InJuris(ref='Alameda County')
InRegion(ref='East Bay SPCA - Dublin') OutRegion(ref='East Bay SPCA - Dublin')
/ param=ref;
model MonthStay(event='Y') = Age Gender Breed Weight Color Source EvalCat SNatIn
NumBehvCond NumMedCond FoodAggro AnimalAggro KennelCough Dental Fearful
Handling UnderAge Injuris InRegion OutRegion
/ lackfit aggregate scale = none selection = backward rsquare;
output out = probdogs4 PREDPROBS=I reschi = pearson h = leverage;
run;
Class Level Info
Odds Ratios Estimates
In Proc Freq, you are calculating unadjusted odds ratio while in proc logistics, all odds ratio were adjusted for covariates included in the logistic regression model
how i can do if I want to assign i to intercept to make i = 906.73916.thanks
Parameter Estimates
Parameter Standard
Variable Label DF Estimate Error t Value Pr > |t|
Intercept Intercept 1 906.73916 28.26505 32.08 <.0001
acs_k3 avg class size k-3 1 -2.68151 1.39399 -1.92 0.0553
meals pct free meals 1 -3.70242 0.15403 -24.04 <.0001
full pct full credential 1 0.10861 0.09072 1.20 0.2321
ODS is very helpful for this. The names of different output components differ for different procs. Example for PROC REG below, should be about the same for most regression PROCS:
ods output ParameterEstimates=MyIntercept(where=(Variable="Intercept"));
proc reg data=sashelp.class;
model weight=age;
run;
quit;
ods output close;
proc print data=MyIntercept;
run;
In SAS proc corr, I want the output to show only Pearson Correlation Coefficient.
By default, the output also shows the following :- Prob > |r| under H0: Rho=0 and Number of observations. How do I do this? Thanks for your help.
I would output a dataset and then proc print or report or whatnot that dataset.
proc corr data=sashelp.class out=corrcoeff(where=(_type_='CORR');
var age height weight;
run;
I am trying to carry out a logistic regression with SAS. I have few settings for the model, and try to compare the difference.
What I want to archieve is to output the estimated coefficients to a file. I think ODS maybe a promising way, but don't know how to use it.
Can anyone write me a simple example?
Thank you very much.
To add a bit of additional color; ODS OUTPUT <NAME>=DATASET ... ; will save the output into the specified dataset.
Use ODS TRACE get the names of output tables. Information on the tables will be written to the log.
ods trace on;
ods output ParameterEstimates=estimates;
proc logistic data=test;
model y = i;
run;
ods trace off;
For Logistic:
proc logistic data = in descending outest = out;
class rank / param=ref ;
model admit = gre gpa rank;
run;
For proc reg:
proc reg data=a;
model y z=x1 x2;
output out=b
run;
for proc glm:
ods output Solution=parameters FitStatistics=fit;
proc glm data=hers;
model glucose = exercise ;
quit;
run;
for proc reg this doesn't work for me
Use proc reg OUTEST=b
proc reg data=a outest=b;
model y=x1;
run;
other reg can get other parameters added to OUTEST.