I'm performing logistical regression with SPSS and Exp(B) is showing the reciprocal of what I'd like. E.g., where I'd like to display, say 2.0, Exp(B) is listed as 0.5. My variables are all categorical, so the coding is arbitrary.
I know I can recode variables, but I'm wondering if there's a simple setting in one of the dialogs to display reciprocals or recode on the fly? If possible, I'd like to do it through the UI rather than the command line input?
If you're using the LOGISTIC REGRESSION procedure (Analyze>Regression>Binary Logistic in the menus), clicking on the Categorical button will allow you to specify predictor variables as categorical and the desired type of contrast coding for each one. As long as the variables of interest are binary or the contrasts you want use either the first or last level of the variables as the reference category in forming the contrasts, you can specify them in that dialog box in order to get what you want.
If a variable has more than two levels and you want to use a category other than the first or the last as the reference category, you'd have to paste the command from the dialogs and add the sequential number of the desired category to the CONTRAST subcommand for that predictor variable. For example, if you have a three-category variable named X and you want to compare the first and third categories against the second one, you'd edit it to read
/CONTRAST (X)=Indicator(2)
or
/CONTRAST (X)=Simple(2)
depending on the type of contrasts specified in the dialogs (these two would produce the same results for these contrasts in models where X is not contained in an interaction term also in the model, differing only in how the constant or intercept is represented).
Related
I am doing a logistic regression (in three steps) in SPSS on radical right support and gender, using data from the European social survey. The outcome variable is whether the person voted for a radical right party or not.
I have some attitudinal variables, as well as sociodemographics like age, marital status etc.
These all go on the first regression model. Then in the second one I add 'female_leader' (i.e. whether the party they voted for had a female leader), and on the third an interaction between 'female' (of the voter) and 'female_leader'.
My problem is that it doesn't add the 'female_leader' in the second step, just repeats the first step. The third one it does add the interaction variable.
I'm unsure why SPSS doesn't add the 'female_leader' variable.
Here's my code:
LOGISTIC REGRESSION VARIABLES all_votes
/METHOD=ENTER female marriage_recode religion_recode attendence_recode
unemployed
professional_worker skilled_workers culture_undermined gays_free_disagree
democracy_important
secondary_below_education degree_education_plus agea cntry
/METHOD=ENTER female_leader
/METHOD=ENTER interaction
/CONTRAST (cntry)=Indicator
/CONTRAST (marriage_recode)=Indicator
/CONTRAST (religion_recode)=Indicator
/CONTRAST (attendence_recode)=Indicator
/SAVE=RESID ZRESID
/CLASSPLOT
/PRINT=GOODFIT CI(95)
/CRITERIA=PIN(0.05) POUT(0.10) ITERATE(20) CUT(0.5).
Hopefully this is enough info. Thanks.
The likely reason for the female_leader variable not to be entered in this situation is that it's redundant or linearly dependent upon the variables already entered in the first block, which means that it won't add any information to those variables in trying to predict the dependent. Look for a warning message at the top of your output reading: "Due to redundancies, degrees of freedom have been reduced for one or more variables."
Good morning, I'm trying to perform a 2D FFT as 2 1-Dimensional FFT.
The problem setup is the following:
There's a matrix of complex numbers generated by an inverse FFT on an array of real numbers, lets call it arr[-nx..+nx][-nz..+nz].
Now, since the original array was made up of real numbers, I exploit the symmetry and reduce my array to be arr[0..nx][-nz..+nz].
My problem starts here, with arr[0..nx][-nz..nz] provided.
Now I should come back in the domain of real numbers.
The question is what kind of transformation I should use in the 2 directions?
In x I use the fftw_plan_r2r_1d( .., .., .., FFTW_HC2R, ..), called Half complex to Real transformation because in that direction I've exploited the symmetry, and that's ok I think.
But in z direction I can't figure out if I should use the same transformation or, the Complex to complex (C2C) transformation?
What is the correct once and why?
In case of needing here, at page 11, the HC2R transformation is briefly described
Thank you
"To easily retrieve a result comparable to that of fftw_plan_dft_r2c_2d(), you can chain a call to fftw_plan_dft_r2c_1d() and a call to the complex-to-complex dft fftw_plan_many_dft(). The arguments howmany and istride can easily be tuned to match the pattern of the output of fftw_plan_dft_r2c_1d(). Contrary to fftw_plan_dft_r2c_1d(), the r2r_1d(...FFTW_HR2C...) separates the real and complex component of each frequency. A second FFTW_HR2C can be applied and would be comparable to fftw_plan_dft_r2c_2d() but not exactly similar.
As quoted on the page 11 of the documentation that you judiciously linked,
'Half of these column transforms, however, are of imaginary parts, and should therefore be multiplied by I and combined with the r2hc transforms of the real columns to produce the 2d DFT amplitudes; ... Thus, ... we recommend using the ordinary r2c/c2r interface.'
Since you have an array of complex numbers, you can either use c2r transforms or unfold real/imaginary parts and try to use HC2R transforms. The former option seems the most practical.Which one might solve your issue?"
-#Francis
I am working with acoustic data that shows decibel levels broken down between frequencies (1/3 octave bands). These values were imported from a flat text file and all have 1 decimal (e.g., 74.1 or -8.0).
I need to perform a series of calculations on the table in order to obtain other acoustic measures (calculated minute-level data by applying acoustic formulas to my given second-level data.) I am attempting to do this with a series of nested select statements. First, I needed to get the decibel values divided by 10. I did fine with that. Now I'd like to feed the generated fields output from this select statement into another that raises 10 to the power of my generated values.
So, if the 20000_Hz field had a value of 16.3, my generated table would have a value of 1.63 for that record, and I'd like to nest that into another select statement that generates 10^1.63 for that field and record.
To do this, I've been experimenting with the POWER() function. I tried POWER(10,my_generated_field) and got all zeros. I realized that the format of the base determines the format of the output, meaning that if I did something like POWER(10.0000000000000000000,my_generated_field) I'd start to see actual numbers like 0.0000000000032151321. Also, I tried altering my table to change the data type for decibel values to decimal(38,35) to see what effect this would have. I believe I initially set the data type as float using the flat file import tool.
To my surprise, numbers that were imported from the flat text file did not simply have more zeros tacked on the end, but had other numbers. For instance, a number like 46.8 now might read something like 46.8246546546843543210058 rather than 46.8000000000000000 as I'd expect.
So my two questions are:
1) Why did changing data types not create the results I expected, and where is SQL getting these other numbers?
2) How should I handle data types for my decibel values so that I don't loose accuracy when doing the 10^field_value thing?
I've spent some time reading about data types, the POWER() function, etc., but still don't feel like I'm going to understand this on my own.
I have trouble understanding where the numbers in the P(A|B,E) table are coming from in the alarm burglary example. I understand that P(B) and P(E) is chosen from knowledge about the domain. But I do not understand how many of the values in the CPT which can be chosen and which has to be calculated in order to make the tables valid. I assume that the P(J|A) and P(J|¬A) are chosen by expert knowledge? And then it must be the same for P(J|M).. or would these also have to be calculated by using given values?
I see with a binary example which is given here in the table on page 7:
https://cseweb.ucsd.edu/~elkan/250A/bayesnets.pdf, they are using the same numbers, but how have they calculated the values 0.95, 0.94, 0.29 and 0.001?
All the values in CPTs must come from somewhere, and cannot be calculated from other CPTs. There are two major approaches to get the numbers:
Have a domain expert specify the numbers.
Have a data set that contains joint realizations of the random variables. Then the numbers within the CPTs can be calculated from the respective frequencies within the data set. Note that this procedure becomes more complicated when not all variables are observed within the data set.
In addition, it is possible to mix approach 1 and 2.
I am solving three non-linear equations in three variables (H0D,H0S and H1S) using FindRoot. In addition to the three variables of interest, there are four parameters in these equations that I would like to be able to vary. My parameters and the range in which I want to vary them are as follows:
CF∈{0,15} , CR∈{0,8} , T∈{0,0.35} , H1R∈{40,79}
The problem is that my non-linear system may not have any solutions for part of this parameter range. What I basically want to ask is if there is a smart way to find out exactly what part of my parameter range admits real solutions.
I could run a FindRoot inside a loop but because of non-linearity, FindRoot is very sensitive to initial conditions so frequently error messages could be because of bad initial conditions rather than absence of a solution.
Is there a way for me to find out what parameter space works, short of plugging 10^4 combinations of parameter values by hand and playing around with the initial conditions and hoping that FindRoot gives me a solution?
Thanks a lot,