How can I do a for loop that does to a data.frame column what:
for x in xs:
does in Python?
Obviously the data.frame column in question holds "levels". What if the
data.frame is in matrix form?
BR, Matti
__
R-help@r-project.org mailing list -- To
So I'm getting:
Error in nlm(neglikhood, p = c(0.1, 0.1), hessian = T, x = elinajat) :
non-finite value supplied by 'nlm'
In addition: There were 50 or more warnings (use warnings() to see the
first 50)
with the following (neglikelihood of 1-param. Weibull):
neglikhood <- function(theta,x)
So I'm a beginner in R and I was testing the removal of elements from a
data.frame.
The way I remove the element(s) with the minimum value in kid_score
variable is to do:
kidmomhs <- data[kidmomhs$kid_score != min(kidmomhs$kid_score),]
So now kidmomhs is the same data, but without the row(s)
What are the red line and cut line in lm's Residuals vs Fitted plot?
As seen in e.g.:
http://i.imgur.com/QvZ6oeT.png
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the p
I'm having a bit of trouble plotting the regression line of
multivariable linear model.
Specifically my model has one response and two predictors, i.e. it's of
the form
Y = b_0+b_1*X_1+b_2*X_2
Plotting the regression line for a single predictor model
Y = b_0+b_1*X_1
is simple enough, just
I'm trying to use interaction terms in lm and for the following types of
models:
fit3_hs <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age +
kidmomhsage$mom_hs + kidmomhsage$mom_age * 1)
fit3_nohs <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age +
kidmomhsage$mom_hs + kidmomhsage$mom_age * 0)
1?
On 2016-09-18 20:41, mviljamaa wrote:
I'm trying to use interaction terms in lm and for the following types
of models:
fit3_hs <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age +
kidmomhsage$mom_hs + kidmomhsage$mom_age * 1)
fit3_nohs <- lm(kidmomhsage$kid_score ~ kidmomhsage$mo
On Sep 18, 2016, at 11:01 AM, mviljamaa wrote:
Also if you, rather than doing what's done below, do:
fit3 <- lm(kidmomhsage$kid_score ~ kidmomhsage$mom_age +
kidmomhsage$mom_hs + kidmomhsage$mom_age * kidmomhsage$mom_hs)
Then this gives the result:
Call:
lm(formula = kidmomhsage$k
Do you mean that the red line is a regression line?
Why is the regression (line) weighted?
On 2016-09-19 14:41, S Ellison wrote:
What are the red line and cut line in lm's Residuals vs Fitted plot?
The dotted line is at 0 and the red line is a locally weighted
regression calculated using lowess
I'm trying to plot two data sets on the same plot by using
par(new=TRUE).
However this results in the axis numbering and labels being plotted
twice as seen in the following picture:
http://i.imgur.com/4b1sNIc.png
How can I get the axis numbering and labels to not overlap? I could also
manag
I'm trying to take lm on a subset of my dataset and to do this I believe
I need to pass my subset of the data as the subset parameter of lm.
So I do my subsetting:
firstkids <- kidmomhsage[0:234,], i.e. the first 234 rows of the data
frame.
Then construct the model:
fit4 <- lm(kidmomhsage$k
So I found out that to remove the (Intercept) term from lm's model one
can add -1 to the predictors. I.e. do lm(resp ~ x1 + x2 - 1)
Another way is to add 0, e.g. lm(resp ~ 0 + x1 + x2).
Adding (or setting the (Intercept) term) zero seems more logical than
subtracting one, but why is there the
On 2016-09-25 18:30, Duncan Murdoch wrote:
On 25/09/2016 9:10 AM, Matti Viljamaa wrote:
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 skippi
eat-r-reproducible-example
--
Sent from my phone. Please excuse my brevity.
On September 25, 2016 8:36:49 AM PDT, mviljamaa
wrote:
On 2016-09-25 18:30, Duncan Murdoch wrote:
On 25/09/2016 9:10 AM, Matti Viljamaa wrote:
Writing:
bs["(Intercept)"]+bs["mies"]*0+bs["kouluB&q
I'm doing logistic regression and I need to infer the coefficients as
odds ratios.
I first did my model using lm(), but now that I need odd ratios, then
should I have used glm() like displayed here:
http://r.789695.n4.nabble.com/Odds-ratio-from-Logistic-model-in-R-td2630277.html
How can I use uniroot to find a root in the interval (0,1) when my
function does not change sign in this interval.
I've tried plugging in some values and seems like e.g. f(50) < 0 and
then I can pick c(0,50). But this sounds really weird, given that I need
to find a root in (0,1).
So what ar
I'm using ts.plot() to plot a matrix of time series (each column is a
ts).
What I noticed is that ts.plot() creates a lot of overlapping lines
which makes it difficult to distinguish different series.
What options exist for making the series more easily read?
I'm doing Normal approximation to binomial distribution.
My variables are generated by rbinom.
Here:
http://msemac.redwoods.edu/~darnold/math15/spring2013/R/Activities/ApproxBinomWithNorm.html
it's claimed that normal approximation is done using the command pnorm.
Question:
Where to get qua
I'm using lm() for a model that has a predictor that has two values
{poika, tyttö} (boy and girl in Finnish).
I make a model with this categorical variable:
fit1 <- lm(dta$X.U.FEFF..mpist. ~ dta$sukup + dta$HISEI + dta$SES)
and while the variable/vector is here named as dta$sukup, what lm()
r
My conception of prediction intervals is the following:
"a prediction interval gives an interval within which we expect next y_i
to lie with a specified probability"
So when using predict() for my model:
predict(fit4, interval="prediction")[1:20,]
I get:
fit lwr upr
1 491
I'm using predict() for my glm() logistic model, but I'm having trouble
relating the predicted results to the rows that produced them.
I want to be able to plot predictions along some categorical variables.
So what can I do in order to get predicted values but also know what
variable values pr
I have a slight doubt with using text() with the label parameter having
to contain a vector of of integers (specifically integers in the range
[1, 21] corresponding to factors of my categorical variable that I want
to numbers to tell).
What I'm currently plotting is the following command:
tex
22 matches
Mail list logo