It’s sometimes faster to ask from someone who has already learnt the syntax.
In this case one has to do e.g.
names(data$somecol)
To get the collection and then iteration through it is almost like in Python:
for(i in names(data$somecol)) {
# do something
}
> Bert Gunter kirjoitti 6.11.2017 k
> On 26 Sep 2016, at 19:41, Matti Viljamaa wrote:
>
> Thank you.
>
> However, I’m having some trouble converting your code to use clka, because
> the model I was using was:
>
> fit2 <- lm(ruotsi.pist ~ mies + koulu + clka + koulu*clka, data=dta)
I mean, not to u
varitB
>, pch=16
>, xlab='lka'
> , ylab='ruotsi.pist'
>, main='Lukio B'
>)
> curve( rpBylka, from = min( dta$lka ), max( dta$lka ), add=TRUE, col="red" )
>
> On Sun, 25 Sep 2016, Matti Viljamaa wrote:
>
>>
&g
> On 25 Sep 2016, at 19:37, Matti Viljamaa wrote:
>
> Okay here’s a pretty short code to reproduce it:
>
> data <-
> read.table("http://users.jyu.fi/~slahola/files/glm1_datoja/yoruotsi.txt";,
> header=TRUE)
data$clka <- I(data$lka - mean(data$
hat makes an example reproducible (e.g. [1] or [2]), and
>> ask
>>> your questions with reproducible code and data so we can give you
>>> concrete responses.
>>>
>>> [1] http://adv-r.had.co.nz/Reproducibility.html
>>> [2]
>>>
>
Writing:
bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*lka+bs["kouluB:clka"]*clka
i.e. without that being inside curve produces a vector of length 375.
So now it seems that curve() is really skipping some lka-/x-values.
> On 25 Sep 2
I’m trying to plot regression lines using curve()
The way I do it is:
bs <- coef(fit2)
and then for example:
curve(bs["(Intercept)"]+bs["mies"]*0+bs["kouluB"]+bs["lka"]*x+bs["kouluB:clka"]*clka,
from=min(lka), to=max(lka), add=TRUE, col='red')
This above code runs into error:
Error in curve(
I have created a 2x2 plot using par(mfrow = c(2, 2)).
I can add x- and ylabels to individual plots, but what I want is to add overall
xlabel and ylabel for the entire 2x2 plot.
How to do this?
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and
I’m getting strange behaviour when trying to extract rows from a two-column
data.frame with double values.
My data looks like:
mom_iq kid_score
1 121.1175065
289.3618898
3 115.4432085
499.4496483
…
and I’m testing extracting rows that have mom_
I need to pick from a dataset those rows that have a double value set to 100.
However since the values in this column are like the following:
[1] 121.11750 89.36188 115.44320 99.44964 92.74571 107.90180
[7] 138.89310 125.14510 81.61953 95.07307 88.57700 94.85971
[13] 88.96280 114.11430 100
> On 08 Sep 2016, at 15:48, Michael Dewey wrote:
>
> Dear Matti
>
> On 08/09/2016 13:06, Matti Viljamaa wrote:
>> I’m trying to do a t-test, where the null hypothesis for the two data sets
>> has to be:
>>
>> “the means are the same”/“difference in mean
I’m trying to understand how to interpret the return values, specifically
“Coefficients:”, of R’s lm function. I’m using it with a dichotomic predictor
(mom_hs).
lm(data$kid_score ~ data$mom_hs) returns
Coefficients:
# (Intercept) data$mom_hs
# 77.5511.77
I read that the (Interce
I’m trying to do a t-test, where the null hypothesis for the two data sets has
to be:
“the means are the same”/“difference in means is equal to one”
Using the t.test function in R I’m able to see that it uses the following
“alternative hypothesis”:
alternative hypothesis: true difference in me
And why is the first term of ifelse(x == 0, zero, 0) + dpois(x, lambda) / (1 -
zero)
ifelse(x == 0, zero, 0)
rather than something corresponding to
zero+(1-zero)e^{-lambda}
https://en.wikipedia.org/wiki/Zero-inflated_model#Zero-inflated_Poisson
> On 22 Mar 2016, at 14:25, Matti Vilja
Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data. ~
> John Tukey
>
> 2016-03-22 13:04 GMT+01:00 Matti Viljamaa <
I’m doing some optimisation that I first did with normal Poisson (only
parameter theta was estimated), but now I’m doing the same with a zero-inflated
Poisson model which
gives me two estimated parameters theta and p (p is also pi in some notation).
My question is, is there something equivalent
16 matches
Mail list logo