How to solve y must be binary error on Hmisc?
I am trying to extract the Concordance index of a glmer model by using somers2 of the Hmisc package in R.
probs < binomial()$linkinv(fitted(my.glmer.model))
somers2(probs, as.numeric(my.df$my.col)1)
By I get this error:
Error in somers2(probs, as.numeric(my.df$my.col) 1) :
y must be binary
But, when I ask about my y:
0 1
655 697
Isn't this as binary as it gets? I'm very stuck. Any help will be appreciated!!
See also questions close to this topic

(R) Adding rows to a data frame using cor() is not working properly
I am trying to create a neat list of correlation values, which I then want to sort. However, when I try to produce this list, I obtain a list with the correlation variables pasted around my text.
I am using a for loop that is based on two 'if' conditions. When the condition is true, I want to add the correlation value to the data frame. If it is not true, the value has to be 0. I have tried to use rbind to add all rows together after running through one of the two conditions.
edit I tried adding cbind(corl, i) in each of the 'if' conditions, in order to specify the associated index value for each correlation output, or 0 when ifcondition is not met. This throws the error "names do not match previous names". Furthermore, I tried to add cbind at the end of the forloop (see ##), but this also returns an error.
However, I get an error warning when I want to cbind correlation values alongside fixed "0" values (e.g. when the condition is false).
My code is currently as follows:
for (i in listLength) {
if (cases[i, 2] > threshold) { monitor < subset(idFiles, ID == i); monitor < na.omit(monitor); corl < cor(monitor["sulfate"], monitor["nitrate"]); } else { corl < 0; } ## frame < cbind(frame, corl, i); frame < rbind(frame, corl); }
print(frame);
When I run the function now, the output is, as mentioned, a list of values, but alas without a clean index. The text of the correlation function (nitrate and sulfate), surrounds the index value and makes the table difficult to interpret. As well, I cannot run the sort() function on this table, to sort the values from e.g. high to low, based on the index number.
Could anyone provide me with a suggestion on how to obtain a tidy list with indexes for the correlation values, which can be sorted from e.g. increasing to decreasing values, while keeping the link to the index number?
Thanks in advance for any help!

Tukey test after LMM keeping contrasts
I want to test a 2x3 factorial design and contrasted the variables like this
my.helmert = matrix(c(2, 1, 1, 0, 1, 1), ncol = 2) contrasts(Target3$mask) = my.helmert contrasts(Target3$length)
So for mask I want to compare the first group with the average of the two other groups and in a second step the second with the third group.
This works fine in my LMM
Target3.2_TT.lmer = lmer(logTotalTime ~ mask*length+ (1+lengthSubject) +(1Trialnum), data = Target3)
There is a significant interaction between mask and length, that´s why I want to take a look at this effect and calculate a post hoc test (Turkey) like this:
emmeans(Target3.2_TT.lmer, pairwise ~ mask : length)
This also works pretty fine with one problem: now my contrasts are gone. The text calculates the differences for all masks and not just 1 vs. 2 and 3 and 2 vs. 3. Is there a possibility to keep my contrasts in the Post hoc test?

RMarkdown: How can I wrap a table (made with kable) in text when knitting to PDF
I'm trying to wrap a table in text and ran into multiple problems:
When trying to just simply position the figure to the left, the caption does not get leftaligned as well and stays centered (which defeats the purpose of left aligning):
```{r tableVerbrauchUSB} kable(USB_Summary2018, booktabs = TRUE, caption = 'Antibiotikaverbrauch in DDDs des Jahres 2018')%>% kable_styling(latex_options = "hold_position", position = "left") ```
When trying to use the
"float_left"
command as specified in the kable_styling options, it looks like this (note: I had to delete thelatex_options = "hold_position
, it wouldn't knit otherwise):I have no idea what is happening to my table with
float_left
, but it seems to completly break it.If important, my yamlheader:
 output: bookdown::pdf_document2: fig_caption: yes number_sections: yes toc: no lang: de geometry: margin = 1in fontsize: 11pt headerincludes:  \usepackage{fancyhdr}  \usepackage[doublespacing]{setspace} #Options: singlespacing, onehalfspacing, doublespacing  \usepackage{chngcntr}  \counterwithout{figure}{section}  \counterwithout{table}{section}  \usepackage{microtype}  \usepackage{amsmath}  \usepackage{float}  \floatplacement{figure}{H}  \floatplacement{table}{H}  \usepackage{wrapfig}  \setlength{\parindent}{1cm} 
Can anybody tell me how I can have a table that is wrapped in text?

How to solve '' aregImpute error : 'column_name' is constant ''
I would like to delete some of the entries in my dataframe and impute them by using the remaining information by means of aregImpute function. However, when I randomly delete 25% of the data in some of the columns, some columns are left with only one single value (i.e. they are each equal to a constant number n). Then I get the following error:
Error in aregImpute(fmla, data = df_pmm_imp, n.impute = 5, nk = 0) : X01154H.exp is constant
Here is a reproducible example:
df = data.frame(replicate(10,sample(0:100,1000,rep=TRUE))) df[,10]= 0 smp_size = floor(0.25 * nrow(df)) set.seed(123) missing_ind = sample(seq_len(nrow(df)), size = smp_size) df_pmm_imp[missing_ind,c(6:10)] = NA fmla = as.formula(paste(" ~ ", paste(names(df), collapse=" +"))) impute_arg = aregImpute(fmla , data = df, n.impute=5, nk=0) # Error in aregImpute(fmla, data = df, n.impute = 5, nk = 0) : X10 is constant
Is there a way to fix this problem? I understand that a constant column does not provide much information, so it might be leading to problems. However, i don't think it should prevent the whole imputation. For instance, a better practice that comes to my mind would be to assign that constant value to all of the missing variables in the column.
Thanks in advance.

Bootcov in rms package not working when cluster variable included in regression as fixed effect
I'm trying to use bootcov to get clustered standard errors for a regression analysis on panel data. In the analysis, I'm including the cluster variable as a fixed effect to address clusterlevel confounding. However, including the cluster variable as a fixed effect causes bootcov to throw an error ("Warning message:...fit failure in 200 resamples. Might try increasing maxit"). I imagine this is because the coefficient matrix varies over bootstrap replications depending on which clusters are selected (here's a similar issue and solution on STATA).
Does anyone know a way around this problem? If not, I can try to manually edit the function myself. Unfortunately, I can't use the cluster option in robcov because my analysis actually requires the Glm function rather than the ols function. Furthermore, I want to stick with the rms package because my analysis involves restricted cubic splines, which rms makes easy to model.
Thanks for the help. I copied an example below.
#load package library(rms) #make df x < rnorm(1000) y < sample(c(1:100),1000, replace=TRUE) z < factor(sample(c(1:25), 1000, replace=TRUE)) df < data.frame(y,x,z) #set datadist dd < datadist(df) options(datadist='dd') #works when cluster variable isn't included as fixed effect in regression reg < ols(x ~ y, df, x=TRUE, y=TRUE) reg_clus < bootcov(reg, df$z) summary(reg_clus) #doesn't work when cluster variable included as fixed effect in regression reg2 < ols(x ~ y + z, df, x=TRUE, y=TRUE) reg_clus2 < bootcov(reg2, df$z) summary(reg_clus2)

What are the basic steps for training?
Creative Groups provides the best ****PLC** Training** in Bangalore and Scada Training in Bangalore. We offers the automation training like Plc, Hmi, Vfd Servo Drives forth..,
**[http://creativegroups.co/][1]**
⇨ PLC Hardware configurations for (PLC,DI,DO,AI,AO,FM MODULE). ⇨ Configuration Profibus or Profinet module GSD on HW configuration. ⇨ MOD BUS Module data Analyzing methods. ⇨ LAD/ STL program instructions. ⇨ FC , FB,DB,UDT,OB , SFC, SFB concepts. ⇨ PLC clock memory , retentive memory, High speed input pulse programs. ⇨ Analog scaling, Un scaling, READ / WRITE DATA from PROFIBUS & PROFINET. ⇨ Indirect address Programming methods. ⇨ Creating source files of program. ⇨ CFC programming. ⇨ SFC programming.