In an exercise that asks to estimate the odds ratio the GLM is fitted without the intercept (see code below). It's the first time I see such a configuration and at first sight it seems right but I am unable to find an intuitive justification of why, I just generally feel that this way everything is explained by the levels of the predictor, but if I must explain why this is good and whether it is correct I can not. Can someone explain - wether fitting without intercept is correct, in this case and in general with response and regressor both factors - why - whether fitting with the intercept would be right or wrong - if right what would be the differences, in this and similar cases (factors, continuous variables it's clear)  library(MASS)    str(shuttle)  'data.frame': 256 obs. of  7 variables:   \$ wind     : Factor w/ 2 levels "head","tail":   \$ use      : Factor w/ 2 levels "auto","noauto": # other vars omitted  fit &lt;- glm(use ~ wind-1, family = "binomial", data = shuttle)    coeff &lt;- exp(coef(fit)) oddsRatio &lt;- coeff[1]/coeff[2] print(oddsRatio)  windhead [1] 1.032323
I'm exploring the effects of removing the intercept in a logistic regression model.  Assume a model:  $$logit(Y = 1) = \beta_1 x + \beta_2z + 0$$  with $x$ and $z$ being categorical variables with 2 levels each and no intercept.  I understood that having no intercept with categorical predictors produce coefficients that compare the $P(Y = 1)$ in each level of the two predictor against a null case where $P(Y=1) = 0.5$ or $logit(Y=1) = 0$.  I noticed a phenomenon that can understand. Using glm() function in R if you change the order of the variable in the right hand part of the formula, the coefficients change too. But even more oddly, the coefficient of the first variable is always the same.  Here's an R demo:  y &lt;- as.factor(sample(rep(1:2), 30, T)) x &lt;- as.factor(sample(rep(1:2), 30, T)) z &lt;- as.factor(sample(rep(1:2), 30, T))  coef(glm(y ~ x + z - 1, binomial) #        x1         x2         z2  #-0.1764783  0.3260739 -0.1335192  coef(glm(y ~ z + x - 1, binomial)) #        z1         z2         x2  #-0.1764783 -0.3099976  0.5025523    As you can see the first predictors have the same coefficient while the other are different in the two models.  Here is what I expected and instead behave differently than what I though:   Since every level of the two predictors is compared to the same null case, I expected to have the same coefficients in the two models, independently from the order in which I use them. I expected to see the coefficients of every level of every predictor, instead the coefficient for the 1 level of the second predictor is not shown. I therefore assume that only the first variable is compared against the null case, while the second is compared against a reference level; but what is this level? Is it $P(Y = 1 | X = 1 \cap Z = 1)$? Reproducing one of the models WITH the intercept we get:  coef(glm(y ~ x + z - 1, binomial) #        x1         x2         z2  #-0.1764783  0.3260739 -0.1335192  coef(glm(y ~ x + z, binomial)) #(Intercept)         x2          z2  #-0.1764783   0.5025523  -0.1335192    As expected x1 become the intercept, and x2 is likely relative to x1. z1 is missing also in this case and z2 is the same as in the model without intercept.  Thus should I assume that the comparison against the null case $P(Y = 1) = 0.5$ is made only for the first variable in a formula, while the other are compared against the usual intercept? Is this behavior normal? What about the fact that the first coefficient has the same value whichever the order of the predictors in the formula? What if I want to compare all level of each predictor against the null case and have a coefficient for all levels? Or it's theoretically impossible for some reason I don't get?
Question involving discriminant of quadratic congruence in elementary number theory. Why can't I pass the table name to a prepared PDO statement?  $stmt = $dbh-&gt;prepare('SELECT * FROM :table WHERE 1'); if ($stmt-&gt;execute(array(':table' =&gt; 'users'))) {     var_dump($stmt-&gt;fetchAll()); }   Is there another safe way to insert a table name into a SQL query? With safe, I mean that I don't want to do  $sql = "SELECT * FROM $table WHERE 1" tikz relative coordinates Suppose one defines coordinates a and b. One may draw a line connecting these two coordinates (\draw (a) -- (b)). Suppose one desires to draw a line that is shifted upward 1 unit relative to a and b. A first guess is the command \draw (a){}+(0,1) -- (b){}+(0,1). This command, however, connects the point a+(0,1) to the point b, presumably because addition is subsequent to the draw command. How does one obtain the desired result (drawing from a+(0,1) to b+(0,1)?  MWE:  \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}  \draw[fill] (0,0) circle (2pt) coordinate (a);  \draw[fill] (5,0) circle (2pt) coordinate (b);  \draw (a) -- (b);  \draw (a){}+(0,1) -- (b){}+(0,1); \end{tikzpicture} \end{document}     Edit: How does one draw coordinates at a point shifted relative to the arithmetic average of the coordinates of two points (something akin to \node at ($(((s1)+(s2))/2)+(0,1)$)). When to use reinterpret_cast? I am little confused with the applicability of reinterpret_cast vs static_cast. From what I have read the general rules are to use static cast when the types can be interpreted at compile time hence the word static. This is the cast the C++ compiler uses internally for implicit casts also.  reinterpret_casts are applicable in two scenarios:   convert integer types to pointer types and vice versa  convert one pointer type to another. The general idea I get is this is unportable and should be avoided.     Where I am a little confused is one usage which I need, I am calling C++ from C and the C code needs to hold on to the C++ object so basically it holds a void*. What cast should be used to convert between the void * and the Class type?  I have seen usage of both static_cast and reinterpret_cast? Though from what I have been reading it appears static is better as the cast can happen at compile time? Though it says to use reinterpret_cast to convert from one pointer type to another? dimension of a subspace spanned by two subspaces If $M$ and $ N$ be the subspaces of a vector space $V$ then prove that  $(\dim M) + (\dim N) = (\dim M+N) + (\dim M \cap N)$. How does transvoxel algorithm work and how can I implement It? I'm working with Beamer and I would like to create boxes with round corners. I use \ovalbox, but I would like to control the thickness of the line. How can I do this? I also tried \thinlines, but I still not understand the sintax since I didn't find a minimal example. I am able to parse strings containing date/time with time.strptime  &gt;&gt;&gt; import time &gt;&gt;&gt; time.strptime('30/03/09 16:31:32', '%d/%m/%y %H:%M:%S') (2009, 3, 30, 16, 31, 32, 0, 89, -1)   How can I parse a time string that contains milliseconds?  &gt;&gt;&gt; time.strptime('30/03/09 16:31:32.123', '%d/%m/%y %H:%M:%S') Traceback (most recent call last):   File "&lt;stdin&gt;", line 1, in &lt;module&gt;   File "/usr/lib/python2.5/_strptime.py", line 333, in strptime     data_string[found.end():]) ValueError: unconverted data remains: .123 Experimental observation of matter/antimatter in the universe Given three variables, y and x, which are positive continuous, and z, which is categorical, I have two candidate models given by:  fit.me &lt;- lmer( y ~ 1 + x + ( 1 + x | factor(z) ) )   and  fit.fe &lt;- lm( y ~ 1 + x )   I hope to compare these models to determine which model is more appropriate. It seems to me that in some sense fit.fe is nested within fit.me. Typically, when this general scenario holds, a chi-squared test can be performed. In R, we can perform this test with the following command,  anova(fit.fe,fit.me)   When both models contain random-effects (generated by lmer from the lme4 package), the anova() command works fine. Owing to boundary parameters, it is normally advisable to test the resulting Chi-Square statistic via simulation, nonetheless, we can still use the statistic in the simulation procedure.  When both models contain only fixed-effects, this approach---and, the associated anova() command---work fine.  However, when one model contains random effects and the reduced model contains only fixed-effects, as in the above scenario, the anova() command doesn't work.  More specifically, I get the following error:   &gt; anova(fit.fe, fit.me)  Error: $ operator not defined for this S4 class   Is there anything wrong with using the Chi-Square approach from above (with simulation)? Or is this simply a problem of anova() not knowing how to deal with linear models generated by different functions?  In other words, would it be appropriate to manually generate the Chi-Square statistic derived from the models? If so, what are the appropriate degrees of freedom for comparing these models? By my reckoning:  $$ F = \frac{\left((SSE_{reduced}-SSE_{full})/(p-k)\right)}{\left((SSE_{full})/(n-p-1)\right)} \sim F_{p-k,n-p-1} $$  We are estimating two parameters in the fixed effects model (slope and intercept) and two more parameters (variance parameters for the random slope and random intercept) in the mixed-effects model. Typically, the intercept parameter isn't counted in the degrees of freedom computation, so that implies that $k=1$ and $p=k+2=3$; having said that I'm not sure if the variance parameters for the random-effects parameters should be included in the degrees of freedom computation; the variance estimates for fixed-effect parameters are not considered, but I believe that to be because the parameter estimates for fixed effects are assumed to be unknown constants whilst they are considered to be unknowable random variables for mixed effects. I would appreciate some assistance on this issue.  Finally, does anybody have a more appropriate (R-based) solution to comparing these models? XMLHttpRequest Origin null is not allowed Access-Control-Allow-Origin for file:/// to file:/// (Serverless) Reprojecting raster from lat/lon to UTM in R? i have to turn it into a  UTM in order to make the buffer functional.  wets&lt;-readOGR(dsn=".",layer="shapefile") r.raster &lt;- raster() extent(r.raster) &lt;- extent(wets) res(r.raster) &lt;- 100   wets.r &lt;- rasterize(wet,r.raster) plot(wets.r) wetsbuf&lt;-buffer(wets.r,width=500)   During the buffer creation which is the last line of code, it gives this warning:  Warning message:   In couldBeLonLat(x) :   raster has a longitude/latitude CRS, but coordinates do not match that   here's the info    summary(wets.r)           layer  Min.        1  1st Qu.     1  Median      2  3rd Qu.     9  Max.       11  NA's    52629  summary(wets)    Object of class SpatialPolygonsDataFrame Coordinates:       min       max  x  683705  714088.8  y 4326266 4343768.0  Is projected: TRUE   proj4string :  [+proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=0 +datum=GGRS87  +units=m +no_defs +ellps=GRS80 +towgs84=-199.87,74.79,246.62]  Data attributes:    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.      0.0     2.5     5.0     5.0     7.5    10.0         wets.r  class       : RasterLayer  dimensions  : 175, 304, 53200  (nrow, ncol, ncell) resolution  : 100, 100  (x, y) extent      : 683705, 714105, 4326268, 4343768  (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0  data source : in memory names       : layer  values      : 1, 11  (min, max) attributes  :    ID FID  from:  1   0  to  : 11  10   I have to change the prjection in order to be possible to do the buffer. In the sentence-     You must wear a suit to an interview   shouldn't the to be replaced by for? Or what's the difference between these two here? nodejs vs node on ubuntu 12.04 Custom date format with jQuery validation plugin How can I specify a custom date formate to be validated with the  for jQuery? How to show that $K\leq S_4$ is a normal subgroup? Let $K=\{(1),(1,2),(3,4),(2,4),(1,4),(2,3)\}$ is a subgrope of $S_4$, we want to show that it is a normal subgroup.  I know that i have to examine the condition of normality in $S_4$ i.e. for all $g\in S_4, g^{-1}Kg=K$. I think this takes times or I am missing something near. Please give me the right hint. Thank you.  Edit: $K = \{(1),(12)(34),(13)(24),(14)(23)\}.$ Can anyone offer any help with this..? I read it at school around 1976 but cannot remember the title nor the author. Thank you in advance!  A lone astronaut called - I think- Steve is stranded on a distant planet when his ship runs low on fuel.   His only companion is - again I think - a parrot. The fuel his ship uses is a filament or wire which is kept on a spool.   On exploring the locale he has landed in he discovers a huge building half-buried in a mountainside. He enters the building and discovers it is a museum filled with thousands of glass cases containing preserved specimens of various life forms as well as machines.   There is a robot curator that does repairs and, as the astronaut finds out, prepares cases for new exhibits.   On analysing the wire in one of the machines he discovers that is suitable as fuel for his ship so he winds a length of it onto his ships spool and leaves the planet just ahead of the robot collecting him and his parrot as museum exhibits... list transparency across non consecutive slides Root partition size remains same after partition resize with gparted I had resized my root partition from 30gb to 70gb using gparted. But Ubuntu still shows that I have the same old disk size while gparted shows that I acually have 70gb and that the other 40gb is somehow used. How can I fix this?  Output of 'df -h':  Filesystem      Size  Used Avail Use% Mounted on /dev/sda5        30G   16G   13G  55% / none            4.0K     0  4.0K   0% /sys/fs/cgroup udev            1.9G  8.0K  1.9G   1% /dev tmpfs           391M  884K  390M   1% /run none            5.0M     0  5.0M   0% /run/lock none            2.0G  284K  2.0G   1% /run/shm none            100M   48K  100M   1% /run/user /dev/sda6       341G  115G  227G  34% /media/Data /dev/sdb1       932G  459G  474G  50% /media/sidharth/passport   Output of mount:  /dev/sda5 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/cgroup type tmpfs (rw) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755) /dev/sda6 on /media/Data type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) gvfsd-fuse on /run/user/sidharth/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=sidharth) /dev/sdb1 on /media/sidharth/passport type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096) Disable two column mode for separate part I am writing a document using the report class in two column mode, but I need a \section to spread across both columns, but how can I set that?  Something like  \documentclass[10pt,danish,a4paper,twoside,twocolumn]{report} \input{preamble.tex} \begin{document}  % This section should spread over both columns \section{Name}  \lipsum[1-3] \end{document}